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 .DEFAULT_GOAL := help
#=============================================== #===============================================
@ -109,7 +109,7 @@ omz-clean:
omz-fancy: omz-fancy:
@./install/omz-fancy @./install/omz-fancy
##openvpn: Install openvpn v2.5.8 (src) ##openvpn: Install openvpn v2.6.3 (src)
openvpn: openvpn:
@./install/openvpn @./install/openvpn

74
helpers
View File

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

View File

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

View File

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

View File

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

View File

@ -1,34 +1,27 @@
#!/bin/bash #!/bin/bash
##makedesc: Install papirus-icon-theme (latest) ##makedesc: Install papirus-icon-theme (latest)
source `dirname $0`/../helpers || exit 255
echo title
echo "==============================================="
echo "Installing papirus-icon-theme (latest)..."
echo "==============================================="
echo
installed() { mkdir -p "$HOME/install/papirus-icon-theme" "$HOME/.local/share/icons/"
command -v "$1" >/dev/null 2>&1
}
if installed git; then if installed git; then
mkdir -p "$HOME/install/" clone_quick https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/"
git clone https://github.com/PapirusDevelopmentTeam/papirus-icon-theme.git "$HOME/install/papirus-icon-theme" --depth=1 --single-branch
else else
! installed wget && sudo apt install -y wget download https://github.com/PapirusDevelopmentTeam/papirus-icon-theme/archive/refs/heads/master.zip -O "$HOME/install/papirus-icon-theme.zip" && \
mkdir -p "$HOME/install/papirus-icon-theme" unzip -oq "$HOME/install/papirus-icon-theme.zip" -d "$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" rm -f "$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 fi
mkdir -p "$HOME/.local/share/icons/" symlink "$HOME/install/papirus-icon-theme/Papirus" "$HOME/.local/share/icons/Papirus" && \
ln -sf "$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" && \
ln -sf "$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"
ln -sf "$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 #!/bin/bash
##makedesc: Install postgresql (latest) and php-pgsql (if php is installed) ##makedesc: Install postgresql (latest) and php-pgsql (if php is installed)
source `dirname $0`/../helpers || exit 255
echo title
echo "==============================================="
echo "Installing postgresql (latest)..."
echo "==============================================="
echo
installed() { require postgresql postgresql-contrib && \
command -v "$1" >/dev/null 2>&1 sudo service postgresql restart && \
} {
echo
sudo apt install -y --autoremove postgresql postgresql-contrib success "openvpn installed!"
sudo service postgresql restart postgres --version
installed 'php' && sudo apt install -y --autoremove php-pgsql echo
}

View File

@ -1,28 +1,31 @@
#!/bin/bash #!/bin/bash
##makedesc: Install postman (latest) ##makedesc: Install postman (latest)
source `dirname $0`/../helpers || exit 255
echo # https://learning.postman.com/docs/getting-started/installation-and-updates/#installing-postman-on-linux
echo "==============================================="
echo "Installing postman (latest)..."
echo "==============================================="
echo
mkdir -p $HOME/install/postman title
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
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] [Desktop Entry]
Name=Postman Name=Postman
Exec=$HOME/.local/bin/postman Exec=$HOME/.local/bin/postman %U
Icon=$HOME/install/postman/Postman/app/icons/icon_128x128.png Icon=$HOME/install/Postman/app/icons/icon_128x128.png
Categories=Utility,Network Categories=Development,Network
Terminal=false Terminal=false
Type=Application Type=Application
Encoding=UTF-8 Encoding=UTF-8
EOF EOF
sudo update-desktop-database
[ $? = 0 ] && {
echo
success "Postman installed!"
echo
}