From 43f6c8c9e93e2416c4964947e4e34a94c119b161 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Fri, 19 Aug 2022 20:58:15 +0800 Subject: [PATCH] New types of make rules + omz refactorings --- Makefile | 99 +++++++++++++++++++++++++++-------------------- gen-makefile | 23 ++++++----- install/omz-clean | 34 +--------------- install/omz-fancy | 51 ++++++++++++++++++++++++ packs/omz | 6 ++- uninstall/omz | 11 ++++++ upgrade/omz | 10 +++++ 7 files changed, 149 insertions(+), 85 deletions(-) create mode 100755 install/omz-fancy create mode 100755 uninstall/omz create mode 100755 upgrade/omz diff --git a/Makefile b/Makefile index 06d1db0..85c64d5 100644 --- a/Makefile +++ b/Makefile @@ -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 \n" + @echo "\tmake \t - Install software" + @echo "\tmake +\t - Install software" + @echo "\tmake ^\t - Upgrade software" + @echo "\tmake @\t - Uninstall software" @echo "Available goals:" - @sed -n 's/^##//p' $< | column -t -s ':' | sed -e "s/^/\t/" - -##_: Same as 'cat ./install/' -%_: - @cat ./install/$* + @sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/" ++%: + @$(MAKE) $* +^%: + @./upgrade/$* +@%: + @./uninstall/$* diff --git a/gen-makefile b/gen-makefile index b1bcb10..7c2bca8 100755 --- a/gen-makefile +++ b/gen-makefile @@ -12,23 +12,28 @@ for file in ./install/*; do name=${name%.sh} desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file}) [ -z "$desc" ] && desc='' - 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 \n" + @echo "\tmake \t - Install software" + @echo "\tmake +\t - Install software" + @echo "\tmake ^\t - Upgrade software" + @echo "\tmake @\t - Uninstall software" @echo "Available goals:" - @sed -n 's/^##//p' \$< | column -t -s ':' | sed -e "s/^/\t/" - -##_: Same as 'cat ./install/' -%_: - @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 diff --git a/install/omz-clean b/install/omz-clean index dcfbad9..713865a 100755 --- a/install/omz-clean +++ b/install/omz-clean @@ -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 diff --git a/install/omz-fancy b/install/omz-fancy new file mode 100755 index 0000000..98fb0fb --- /dev/null +++ b/install/omz-fancy @@ -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 diff --git a/packs/omz b/packs/omz index 6b28ad7..c364876 100644 --- a/packs/omz +++ b/packs/omz @@ -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 diff --git a/uninstall/omz b/uninstall/omz new file mode 100755 index 0000000..b0205a5 --- /dev/null +++ b/uninstall/omz @@ -0,0 +1,11 @@ +#!/bin/bash +##makedesc: Uninstalling omz + +echo +echo "===============================================" +echo "Uninstalling omz..." +echo "===============================================" +echo + +bash $ZSH/tools/uninstall.sh +exec bash diff --git a/upgrade/omz b/upgrade/omz new file mode 100755 index 0000000..e92e312 --- /dev/null +++ b/upgrade/omz @@ -0,0 +1,10 @@ +#!/bin/bash +##makedesc: Upgrading omz + +echo +echo "===============================================" +echo "Upgrading omz..." +echo "===============================================" +echo + +bash $ZSH/tools/upgrade.sh