From c1150af922db42af27bec517274d597b74a5a13b Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Thu, 25 Aug 2022 22:33:02 +0800 Subject: [PATCH] Descriptions parsing improved --- Makefile | 86 +++++++++++++++++++++++++------------------------ README.md | 6 ++-- gen-makefile | 12 ++++--- packs/composer | 2 +- packs/flameshot | 2 +- packs/lamp | 2 +- packs/omz | 2 +- 7 files changed, 58 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index d538aff..b8b9093 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ -# Autogenerated at 22.08.2022 19:06 using ./gen-makefile +# Autogenerated at 25.08.2022 22:32 using ./gen-makefile .DEFAULT_GOAL := help #=============================================== # Scripts listed in ./packs #=============================================== -##composer: [PACK] php + composer +# [PACK] php + composer composer: php composer-clean -##flameshot: [TODO] [PACK] qt5 + flameshot from source +# [TODO] [PACK] qt5 + flameshot from source flameshot: qt5 flameshot-build -##lamp: [PACK] Apache + php + mariadb +# [PACK] Apache + php + mariadb lamp: apache php mariadb -##omz: [PACK] zsh + omz + powerline10k + MesloLGS font +# [PACK] zsh + omz + powerline10k + MesloLGS font omz: zsh omz-clean omz-fancy chsh -s /usr/bin/zsh @exec zsh @@ -23,158 +23,160 @@ omz: zsh omz-clean omz-fancy # Scripts listed in ./install #=============================================== -##apache: Install apache2 (latest) +# Install apache2 (latest) apache: @./install/apache -##apt: Install bunch of software from apt +# Install bunch of software from apt apt: @./install/apt -##canon-mg2500: Install Canon Pixma MG2500 + ppa +# Install Canon Pixma MG2500 + ppa canon-mg2500: @./install/canon-mg2500 -##chrome: Install google chrome (latest) +# Install google chrome (latest) chrome: @./install/chrome -##composer-clean: Install composer (latest) +# Install composer (latest) composer-clean: @./install/composer-clean -##docker: Install docker (latest) + docker-compose (latest) + ppa +# Install docker (latest) + docker-compose (latest) + ppa docker: @./install/docker -##droidcam: Install droidcam v1.8.2 +# Install droidcam v1.8.2 droidcam: @./install/droidcam -##droidcam-obs: Install droidcam-obs plugin v1.5.1 +# Install droidcam-obs plugin v1.5.1 droidcam-obs: @./install/droidcam-obs -##file-templates-kde: Install file templates (KDE) +# Install file templates (KDE) file-templates-kde: @./install/file-templates-kde -##flameshot-build: [TODO] Build flameshot from src (latest) +# [TODO] Build flameshot from src (latest) flameshot-build: @./install/flameshot-build -##git: Install git (latest) +# Install git (latest) git: @./install/git -##golang: Install golang v1.18.3 +# Install golang v1.18.3 golang: @./install/golang -##grubc: Install grub-customizer (latest) + ppa +# Install grub-customizer (latest) + ppa grubc: @./install/grubc -##kde-appmenu: Install KDE Window AppMenu Applet +# Install KDE Window AppMenu Applet kde-appmenu: @./install/kde-appmenu -##libreoffice: Install libreoffice +# Install libreoffice libreoffice: @./install/libreoffice -##lite-xl: Install lite-xl v2.0.5 (draft) +# Install lite-xl v2.0.5 (draft) lite-xl: @./install/lite-xl -##mariadb: Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed) +# Install mariadb (latest) and php-mysql + phpMyAdmin (if php is installed) mariadb: @./install/mariadb -##nodejs: Install nodejs + npm via nvm +# Install nodejs + npm via nvm nodejs: @./install/nodejs -##ntfy: Install ntfy (latest) + ppa +# Install ntfy (latest) + ppa ntfy: @./install/ntfy -##omz-clean: Install omz (latest) +# Install omz (latest) omz-clean: @./install/omz-clean -##omz-fancy: Install omz fancy (powerline10k + MesloLGS font) +# Install omz fancy (powerline10k + MesloLGS font) omz-fancy: @./install/omz-fancy -##papirus: Install papirus-icon-theme (latest) +# Install papirus-icon-theme (latest) papirus: @./install/papirus -##pgsql: Install postgresql (latest) and php-pgsql (if php is installed) +# Install postgresql (latest) and php-pgsql (if php is installed) pgsql: @./install/pgsql -##php: Install php v8.1 + ppa +# Install php v8.1 + ppa php: @./install/php -##postman: Install postman (latest) +# Install postman (latest) postman: @./install/postman -##qt5: Install qt5 +# Install qt5 qt5: @./install/qt5 -##rustdesk: Install rustdesk client v1.1.9 (deb) +# Install rustdesk client v1.1.9 (deb) rustdesk: @./install/rustdesk -##snap: Install bunch of software from snap +# Install bunch of software from snap snap: @./install/snap -##syncthing: Install syncthing (latest) + ppa +# Install syncthing (latest) + ppa syncthing: @./install/syncthing -##telebit: Install telebit (latest) +# Install telebit (latest) telebit: @./install/telebit -##ulauncher: Install ulauncher (latest) + ppa +# Install ulauncher (latest) + ppa ulauncher: @./install/ulauncher -##wine: Install wine (latest) + ppa (focal) +# Install wine (latest) + ppa (focal) wine: @./install/wine -##zint: Install zint (latest) +# Install zint (latest) zint: @./install/zint -##zsh: Install vanilla zsh +# Install vanilla zsh zsh: @./install/zsh self: @./gen-makefile + help: Makefile @echo "Ubuntu software installator" @echo @echo "Usage:" - @echo "\tmake help\t - Show this help" - @echo "\tmake GOAL\t - Install software" + @echo "\tmake help\t - Show this help" + @echo "\tmake self\t - Regenerate Makefile (alias of ./gen-makefile)" + @echo "\tmake GOAL\t - Install software" @echo "\tmake ^GOAL\t - Upgrade software" @echo "\tmake @GOAL\t - Uninstall software" @echo @echo "You can combine GOALs, e.g. 'make @docker docker' will reinstall docker." @echo @echo "Available GOALs:" - @sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/" + @sed -n '/^#/{N;s/# *\(.*\)\n\([^# .].*:\)/\t\2\1/p}' $< | column -ts ':' +%: @$(MAKE) $* ^%: diff --git a/README.md b/README.md index d5f6166..6277786 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Requirements * Ubuntu >= 20.04 (not tested with version < 20) -* `bash`, `zsh` or other `sh`-compatible shell +* `bash`, `zsh` or other POSIX-compatible shell * `make` (optional but recommended) * `wget` (necessary for some scripts) * `git` (necessary for some scripts) @@ -61,11 +61,11 @@ You can create new file inside `./packs` dir. Syntax is same as classic makefile with one important and necessary addition -- a comment started with `##`: ```makefile -##mypack1: Pack description +# Pack description mypack1: goal1 goal2 goalX ... ... -##mypackX: Pack description +# Pack description mypackX: goalA goalB @cp file1 file2 ... diff --git a/gen-makefile b/gen-makefile index 56b2bd2..24aa98c 100755 --- a/gen-makefile +++ b/gen-makefile @@ -28,26 +28,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 "# ${desc}\n${name}:\n\t@${file}\n" >> Makefile done; cat << "EOF" >> Makefile self: @./gen-makefile + help: Makefile @echo "Ubuntu software installator" @echo @echo "Usage:" - @echo "\tmake help\t - Show this help" - @echo "\tmake GOAL\t - Install software" + @echo "\tmake help\t - Show this help" + @echo "\tmake self\t - Regenerate Makefile (alias of ./gen-makefile)" + @echo "\tmake GOAL\t - Install software" @echo "\tmake ^GOAL\t - Upgrade software" @echo "\tmake @GOAL\t - Uninstall software" @echo @echo "You can combine GOALs, e.g. 'make @docker docker' will reinstall docker." @echo @echo "Available GOALs:" - @sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/" + @sed -n '/^#/{N;s/# *\(.*\)\n\([^# .].*:\)/\t\2\1/p}' $< | column -ts ':' +%: @$(MAKE) $* ^%: @@ -59,4 +61,4 @@ EOF echo "New ./Makefile has been generated!" echo "Old one has been saved as ./Makefile.bak" echo -make -s help +make diff --git a/packs/composer b/packs/composer index ce641e7..c09e316 100644 --- a/packs/composer +++ b/packs/composer @@ -1,2 +1,2 @@ -##composer: [PACK] php + composer +# [PACK] php + composer composer: php composer-clean diff --git a/packs/flameshot b/packs/flameshot index 8b6e870..d6416f3 100644 --- a/packs/flameshot +++ b/packs/flameshot @@ -1,2 +1,2 @@ -##flameshot: [TODO] [PACK] qt5 + flameshot from source +# [TODO] [PACK] qt5 + flameshot from source flameshot: qt5 flameshot-build diff --git a/packs/lamp b/packs/lamp index 014dbb5..b2c385a 100644 --- a/packs/lamp +++ b/packs/lamp @@ -1,2 +1,2 @@ -##lamp: [PACK] Apache + php + mariadb +# [PACK] Apache + php + mariadb lamp: apache php mariadb diff --git a/packs/omz b/packs/omz index c364876..79e62c7 100644 --- a/packs/omz +++ b/packs/omz @@ -1,4 +1,4 @@ -##omz: [PACK] zsh + omz + powerline10k + MesloLGS font +# [PACK] zsh + omz + powerline10k + MesloLGS font omz: zsh omz-clean omz-fancy chsh -s /usr/bin/zsh @exec zsh