Merge branch 'wip' of git.axenov.dev:anthony/my-env into wip

This commit is contained in:
Anthony Axenov 2023-04-18 15:28:47 +08:00 committed by AnthonyAxenov
commit 50d313aab8
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
8 changed files with 120 additions and 113 deletions

View File

@ -1,4 +1,4 @@
# Autogenerated at 14.04.2023 12:03 using ./gen-makefile
# Autogenerated at 18.04.2023 15:28 using ./gen-makefile
.DEFAULT_GOAL := help
#===============================================
@ -109,7 +109,7 @@ omz-clean:
omz-fancy:
@./install/omz-fancy
##openvpn: Install openvpn v2.5.8 (src)
##openvpn: Install openvpn v2.6.3 (src)
openvpn:
@./install/openvpn

74
helpers
View File

@ -4,6 +4,40 @@ installed() {
command -v "$1" >/dev/null 2>&1
}
installed2() {
dpkg --list | grep -qw "ii $1"
}
apt_install() {
sudo apt install -y --autoremove "$*"
}
require() {
sw=()
for package in "$@"; do
if ! installed "$package" && ! installed2 "$package"; then
sw+=("$package")
fi
done
if [ ${#sw[@]} -gt 0 ]; then
info "This packages will be installed in your system:\n${sw[*]}"
apt_install "${sw[*]}"
[ $? -gt 0 ] && die "installation cancelled" 201
fi
}
require2() {
sw=()
for package in "$@"; do
if ! installed "$package" && ! installed2 "$package"; then
sw+=("$package")
fi
done
if [ ${#sw[@]} -gt 0 ]; then
die "This packages must be installed in your system:\n${sw[*]}" 200
fi
}
title() {
[ "$1" ] && title="$1" || title="$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${BASH_SOURCE[1]})"
info
@ -13,20 +47,17 @@ title() {
info
}
require() {
if ! installed "$1"; then
if [ "$2" ]; then
die "'$1' must to be installed in your system" 200
else
info "Installing '$1' because it is required to continue"
sudo apt install "$1"
[ $? -gt 0 ] && die "installation cancelled" 201
fi
fi
unpak_targz() {
require tar
tar -xzf "$1" -C "$2"
}
symlink() {
ln -sf "$1" "$2"
}
download() {
require wget 1
require wget
wget "$1" -O "$2"
}
@ -35,6 +66,11 @@ clone() {
git clone $*
}
clone_quick() {
require git
git clone $* --depth=1 --single-branch
}
abspath() {
echo $(realpath -q "${1/#\~/$HOME}")
}
@ -159,7 +195,6 @@ warn() {
error() {
print "${BOLD}${BLRED}${FWHITE}${IERROR} Error: ${BRESET}${FLRED} $1 " >&2
# print_stacktrace
}
fatal() {
@ -168,19 +203,8 @@ fatal() {
}
die() {
error "$1"
[ "$2" ] && exit $2 || exit 100
}
die_fatal() {
fatal "$1"
[ "$2" ] && exit $2 || exit 100
}
die_help() {
error "$1"
[ "$2" ] && is_function "$2".help && $2.help
[ "$3" ] && exit $3 || exit 100
error "${1:-halted}"
exit ${2:-100}
}
print_stacktrace() {

View File

@ -5,10 +5,10 @@ source `dirname $0`/../helpers || exit 255
# https://www.jetbrains.com/lp/mono/#how-to-install
title
require unzip
mkdir -p "$HOME/install/jbmono" "$HOME/.local/share/fonts/"
download "https://download.jetbrains.com/fonts/JetBrainsMono-2.304.zip" "$HOME/install/jbmono.zip" && \
unzip -oj "$HOME/install/jbmono.zip" "fonts/ttf/*.ttf" -d "$HOME/.local/share/fonts/" && \
fc-cache -vf "$HOME/.local/share/fonts/"

View File

@ -1,14 +1,9 @@
#!/bin/bash
##makedesc: Install KDE Backports
source `dirname $0`/../helpers || exit 255
echo
echo "==============================================="
echo "Installing KDE Backports..."
echo "==============================================="
echo
title
sudo add-apt-repository -y ppa:kubuntu-ppa/backports
# sudo add-apt-repository -y ppa:kubuntu-ppa/backports-extra
sudo apt update
# sudo pkcon update
sudo apt full-upgrade
sudo add-apt-repository -y ppa:kubuntu-ppa/backports && \
sudo apt update && \
sudo apt full-upgrade

View File

@ -1,37 +1,31 @@
#!/bin/bash
##makedesc: Install openvpn v2.5.8 (src)
##makedesc: Install openvpn v2.6.3 (src)
source `dirname $0`/../helpers || exit 255
# https://openvpn.net/community-downloads/
# https://openvpn.net/community-resources/installing-openvpn/
[ $1 ] && OVPNVER="$1" || OVPNVER='2.5.8'
[ "$1" ] && OVPNVER="$1" || OVPNVER='2.6.3'
echo
echo "==============================================="
echo "Installing openvpn v${OVPNVER} (src)..."
echo "==============================================="
echo
title "Installing openvpn v${OVPNVER} (src)..."
set -ex
sudo apt install -y \
libssl-dev \
require libssl-dev \
liblzo2-dev \
libpam0g-dev
mkdir -p "$HOME/install/"
wget "https://swupdate.openvpn.org/community/releases/openvpn-${OVPNVER}.tar.gz" \
-O "/tmp/openvpn-${OVPNVER}.tar.gz"
tar -xzf "/tmp/openvpn-${OVPNVER}.tar.gz" -C "$HOME/install/"
cd "$HOME/install/openvpn-${OVPNVER}"
sudo ./configure && \
download "https://swupdate.openvpn.org/community/releases/openvpn-${OVPNVER}.tar.gz" "$HOME/install/openvpn-${OVPNVER}.tar.gz" && \
unpak_targz "$HOME/install/openvpn-${OVPNVER}.tar.gz" "$HOME/install/" && \
cd "$HOME/install/openvpn-${OVPNVER}" && \
sudo ./configure && \
sudo make && \
sudo make install &&
sudo apt install -y \
network-manager-openvpn \
apt_install network-manager-openvpn \
network-manager-openvpn-gnome
echo
echo "Finish!"
openvpn --version
echo
[ $? = 0 ] && {
echo
success "openvpn installed!"
openvpn --version
echo
}

View File

@ -1,34 +1,27 @@
#!/bin/bash
##makedesc: Install papirus-icon-theme (latest)
source `dirname $0`/../helpers || exit 255
echo
echo "==============================================="
echo "Installing papirus-icon-theme (latest)..."
echo "==============================================="
echo
title
installed() {
command -v "$1" >/dev/null 2>&1
}
mkdir -p "$HOME/install/papirus-icon-theme" "$HOME/.local/share/icons/"
if installed git; then
mkdir -p "$HOME/install/"
git clone https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/papirus-icon-theme" --depth=1 --single-branch
clone_quick https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/"
else
! installed wget && sudo apt install -y wget
mkdir -p "$HOME/install/papirus-icon-theme"
wget https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip -O "$HOME/install/papirus-icon-theme.zip"
unzip -oq "$HOME/install/papirus-icon-theme.zip" -d "$HOME/install/papirus-icon-theme"
download https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip -O "$HOME/install/papirus-icon-theme.zip" && \
unzip -oq "$HOME/install/papirus-icon-theme.zip" -d "$HOME/install/papirus-icon-theme" && \
rm -f "$HOME/install/papirus-icon-theme.zip"
fi
mkdir -p "$HOME/.local/share/icons/"
ln -sf "$HOME/install/papirus-icon-theme/Papirus" "$HOME/.local/share/icons/Papirus"
ln -sf "$HOME/install/papirus-icon-theme/Papirus-Dark" "$HOME/.local/share/icons/Papirus-Dark"
ln -sf "$HOME/install/papirus-icon-theme/Papirus-Light" "$HOME/.local/share/icons/Papirus-Light"
symlink "$HOME/install/papirus-icon-theme/Papirus" "$HOME/.local/share/icons/Papirus" && \
symlink "$HOME/install/papirus-icon-theme/Papirus-Dark" "$HOME/.local/share/icons/Papirus-Dark" && \
symlink "$HOME/install/papirus-icon-theme/Papirus-Light" "$HOME/.local/share/icons/Papirus-Light"
[ $? = 0 ] && {
echo
success "Papirus icons installed!"
info "You can find them in $HOME/.local/share/icons/"
echo
}
echo
echo "Finish! Don't forget to change current icon theme."
echo "You can find them here:"
echo -e "\t$HOME/.local/share/icons/"
echo

View File

@ -1,16 +1,14 @@
#!/bin/bash
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
source `dirname $0`/../helpers || exit 255
echo
echo "==============================================="
echo "Installing postgresql (latest)..."
echo "==============================================="
echo
title
installed() {
command -v "$1" >/dev/null 2>&1
}
sudo apt install -y --autoremove postgresql postgresql-contrib
sudo service postgresql restart
installed 'php' && sudo apt install -y --autoremove php-pgsql
require postgresql postgresql-contrib && \
sudo service postgresql restart && \
{
echo
success "openvpn installed!"
postgres --version
echo
}

View File

@ -1,28 +1,31 @@
#!/bin/bash
##makedesc: Install postman (latest)
source `dirname $0`/../helpers || exit 255
echo
echo "==============================================="
echo "Installing postman (latest)..."
echo "==============================================="
echo
# https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
mkdir -p $HOME/install/postman
mkdir -p $HOME/.local/bin
wget "https://dl.pstmn.io/download/latest/linux64" -O $HOME/install/postman.tar.gz && \
tar -xzf $HOME/install/postman.tar.gz -C $HOME/install/postman && \
ln -sf $HOME/install/postman/Postman/Postman $HOME/.local/bin/postman && \
mkdir -p "$HOME/.local/share/applications" && \
cat << EOF > "$HOME/.local/share/applications/Postman.desktop"
#!/usr/bin/env xdg-open
title
mkdir -p "$HOME/install" && \
"$HOME/.local/bin" && \
"$HOME/.local/share/applications"
download "https://dl.pstmn.io/download/latest/linux64" $HOME/install/postman.tar.gz && \
unpak_targz "$HOME/install/postman.tar.gz" "$HOME/install" && \
symlink $HOME/install/Postman/Postman $HOME/.local/bin/postman && \
cat << EOF > "$HOME/.local/share/applications/Postman.desktop" && sudo update-desktop-database
[Desktop Entry]
Name=Postman
Exec=$HOME/.local/bin/postman
Icon=$HOME/install/postman/Postman/app/icons/icon_128x128.png
Categories=Utility,Network
Exec=$HOME/.local/bin/postman %U
Icon=$HOME/install/Postman/app/icons/icon_128x128.png
Categories=Development,Network
Terminal=false
Type=Application
Encoding=UTF-8
EOF
sudo update-desktop-database
[ $? = 0 ] && {
echo
success "Postman installed!"
echo
}