New types of make rules + omz refactorings

This commit is contained in:
Anthony Axenov 2022-08-19 20:58:15 +08:00
parent 2c9af9b1c5
commit 43f6c8c9e9
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
7 changed files with 149 additions and 85 deletions

View File

@ -1,4 +1,4 @@
# Autogenerated at 15.07.2022 22:54 using ./gen-makefile
# Autogenerated at 19.08.2022 20:58 using ./gen-makefile
##composer: [PACK] php + composer
composer: php composer-clean
@ -9,140 +9,155 @@ flameshot: qt5 flameshot-build
##lamp: [PACK] Apache + php + mariadb
lamp: apache php mariadb
##omz: [PACK] zsh + omz + powerline10k + MesloLGS fonts
omz: zsh omz-clean
##omz: [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh
##apache: Install apache2 (latest)
apache:
./install/apache
@./install/apache
##apt: Install bunch of software from apt
apt:
./install/apt
@./install/apt
##canon-mg2500: Install Canon Pixma MG2500
##canon-mg2500: Install Canon Pixma MG2500 + ppa
canon-mg2500:
./install/canon-mg2500
@./install/canon-mg2500
##chrome: Install google chrome (latest)
chrome:
./install/chrome
@./install/chrome
##composer-clean: Install composer (latest)
composer-clean:
./install/composer-clean
@./install/composer-clean
##docker: Install docker (latest) + docker-compose (latest) + ppa
docker:
./install/docker
@./install/docker
##droidcam: Install droidcam v1.8.2
droidcam:
./install/droidcam
@./install/droidcam
##droidcam-obs: Install droidcam-obs plugin v1.5.1
droidcam-obs:
./install/droidcam-obs
@./install/droidcam-obs
##flameshot-build: [TODO] Build flameshot from src (latest)
flameshot-build:
./install/flameshot-build
@./install/flameshot-build
##git: Install git (latest)
git:
./install/git
@./install/git
##golang: Install golang v1.18.3
golang:
./install/golang
@./install/golang
##grubc: Install grub-customizer (latest) + ppa
grubc:
./install/grubc
@./install/grubc
##kde-appmenu: Install KDE Window AppMenu Applet
kde-appmenu:
./install/kde-appmenu
@./install/kde-appmenu
##libreoffice: Install libreoffice
libreoffice:
./install/libreoffice
@./install/libreoffice
##lite-xl: Install lite-xl v2.0.5 (draft)
lite-xl:
./install/lite-xl
@./install/lite-xl
##mariadb: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed)
mariadb:
./install/mariadb
@./install/mariadb
##nodejs: Install nodejs + npm via nvm
nodejs:
./install/nodejs
@./install/nodejs
##omz-clean: Install omz (latest) + powerline10k + MesloLGS fonts
##ntfy: Install ntfy (latest) + ppa
ntfy:
@./install/ntfy
##omz-clean: Install omz (latest)
omz-clean:
./install/omz-clean
@./install/omz-clean
##omz-fancy: Install omz fancy (powerline10k + MesloLGS font)
omz-fancy:
@./install/omz-fancy
##papirus: Install papirus-icon-theme (latest)
papirus:
./install/papirus
@./install/papirus
##pgsql: Install postgresql (latest) and php-pgsql (if php is installed)
pgsql:
./install/pgsql
@./install/pgsql
##php: Install php v8.1 + ppa
php:
./install/php
@./install/php
##postman: Install postman (latest)
postman:
./install/postman
@./install/postman
##qt5: Install qt5
qt5:
./install/qt5
@./install/qt5
##rustdesk: Install rustdesk client v1.1.9 (deb)
rustdesk:
./install/rustdesk
@./install/rustdesk
##snap: Install bunch of software from snap
snap:
./install/snap
@./install/snap
##syncthing: Install syncthing (latest) + ppa
syncthing:
./install/syncthing
@./install/syncthing
##telebit: Install telebit (latest)
telebit:
./install/telebit
@./install/telebit
##ulauncher: Install ulauncher (latest) + ppa
ulauncher:
./install/ulauncher
@./install/ulauncher
##wine: Install wine (latest) + ppa (focal)
wine:
./install/wine
@./install/wine
##zint: Install zint (latest)
zint:
./install/zint
@./install/zint
##zsh: Install vanilla zsh
zsh:
./install/zsh
@./install/zsh
##help: Show this help message
help: Makefile
@echo "Usage:"
@echo "\tmake <goal>\n"
@echo "\tmake <goal>\t - Install software"
@echo "\tmake +<goal>\t - Install software"
@echo "\tmake ^<goal>\t - Upgrade software"
@echo "\tmake @<goal>\t - Uninstall software"
@echo "Available goals:"
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>'
%_:
@cat ./install/$*
@sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/"
+%:
@$(MAKE) $*
^%:
@./upgrade/$*
@%:
@./uninstall/$*

View File

@ -12,23 +12,28 @@ for file in ./install/*; do
name=${name%.sh}
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>'
echo -e "##${name}: ${desc}\n${name}:\n\t${file}\n" >> Makefile
echo -e "##${name}: ${desc}\n${name}:\n\t@${file}\n" >> Makefile
done;
cat << EOF >> Makefile
cat << "EOF" >> Makefile
##help: Show this help message
help: Makefile
@echo "Usage:"
@echo "\tmake <goal>\n"
@echo "\tmake <goal>\t - Install software"
@echo "\tmake +<goal>\t - Install software"
@echo "\tmake ^<goal>\t - Upgrade software"
@echo "\tmake @<goal>\t - Uninstall software"
@echo "Available goals:"
@sed -n 's/^##//p' \$< | column -t -s ':' | sed -e "s/^/\t/"
##<goal>_: Same as 'cat ./install/<goal>'
%_:
@cat ./install/\$*
@sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/"
+%:
@$(MAKE) $*
^%:
@./upgrade/$*
@%:
@./uninstall/$*
EOF
echo "New ./Makefile has been generated!"
echo "Old one has been saved as ./Makefile.bak"
echo
make help
make -s help

View File

@ -1,9 +1,9 @@
#!/bin/bash
##makedesc: Install omz (latest) + powerline10k + MesloLGS fonts
##makedesc: Install omz (latest)
echo
echo "==============================================="
echo "Installing omz (latest) + powerline10k + MesloLGS fonts..."
echo "Installing omz (latest)..."
echo "==============================================="
echo
@ -16,34 +16,4 @@ if ! installed zsh || ! installed git || ! installed curl; then
exit 1
fi
echo
echo "1. Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
echo
echo "2. Installing MesloLGS fonts..."
mkdir -p ~/.local/share/fonts/
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf -O "~/.local/share/fonts/MesloLGS NF Regular.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf -O "~/.local/share/fonts/MesloLGS NF Bold.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf -O "~/.local/share/fonts/MesloLGS NF Italic.ttf"
wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf -O "~/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fc-cache -vf ~/.local/share/fonts/
echo
echo "3. Installing powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' ~/.zshrc
echo
echo "4. Installing plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i 's/^plugins=/#plugins=/g' ~/.zshrc
echo "plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)" >> ~/.zshrc
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in ~/.zshrc"
echo "- log out of your session and login again"
echo

51
install/omz-fancy Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
##makedesc: Install omz fancy (powerline10k + MesloLGS font)
echo
echo "==============================================="
echo "Installing omz fancy: powerline10k + MesloLGS font..."
echo "==============================================="
echo
installed() {
command -v "$1" >/dev/null 2>&1
}
if ! installed zsh || ! installed git || ! installed wget; then
echo "ERROR: you need git, zsh and wget to be installed!"
exit 1
fi
if [[ ! -d "$HOME/.oh-my-zsh" ]]; then
echo "ERROR: you need omz to be installed!"
exit 1
fi
echo
echo "1/3 Installing MesloLGS fonts..."
mkdir -p "$HOME/.local/share/fonts/"
FONTS_URL="https://github.com/romkatv/powerlevel10k-media/raw/master"
wget "$FONTS_URL/MesloLGS%20NF%20Regular.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Regular.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Italic.ttf"
wget "$FONTS_URL/MesloLGS%20NF%20Bold%20Italic.ttf" -O "$HOME/.local/share/fonts/MesloLGS NF Bold Italic.ttf"
fc-cache -vf "$HOME/.local/share/fonts/"
echo
echo "2/3 Installing powerlevel10k theme..."
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i 's#^ZSH_THEME=.*$#ZSH_THEME="powerlevel10k/powerlevel10k"#g' "$HOME/.zshrc"
echo
echo "3/3 Installing plugins..."
git clone https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
sed -i 's/^plugins=/plugins=(git laravel docker docker-compose composer zsh-autosuggestions zsh-syntax-highlighting)/g' $HOME/.zshrc
p10k configure
echo
echo "Finish! You need to:"
echo "- review your plugins in $HOME/.zshrc"
echo "- restart terminal windows to reload fonts and set 'MesloLGS NF Regular' as default font"
echo "- log out of your session and login again"
echo

View File

@ -1,2 +1,4 @@
##omz: [PACK] zsh + omz + powerline10k + MesloLGS fonts
omz: zsh omz-clean
##omz: [PACK] zsh + omz + powerline10k + MesloLGS font
omz: zsh omz-clean omz-fancy
chsh -s /usr/bin/zsh
@exec zsh

11
uninstall/omz Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
##makedesc: Uninstalling omz
echo
echo "==============================================="
echo "Uninstalling omz..."
echo "==============================================="
echo
bash $ZSH/tools/uninstall.sh
exec bash

10
upgrade/omz Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
##makedesc: Upgrading omz
echo
echo "==============================================="
echo "Upgrading omz..."
echo "==============================================="
echo
bash $ZSH/tools/upgrade.sh