2022-07-04 09:56:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
mv Makefile Makefile.bak
|
2022-08-19 13:26:09 +00:00
|
|
|
|
|
|
|
cat << EOF >> Makefile
|
|
|
|
# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
2022-08-25 04:40:36 +00:00
|
|
|
#===============================================
|
|
|
|
# Scripts listed in ./packs
|
|
|
|
#===============================================
|
|
|
|
|
2022-08-19 13:26:09 +00:00
|
|
|
EOF
|
2022-07-04 09:56:45 +00:00
|
|
|
|
2022-07-04 11:34:00 +00:00
|
|
|
for file in ./packs/*; do
|
2022-08-25 04:40:36 +00:00
|
|
|
cat "$file" >> Makefile
|
2022-07-04 14:22:05 +00:00
|
|
|
echo >> Makefile
|
2022-07-04 11:34:00 +00:00
|
|
|
done;
|
|
|
|
|
2022-08-25 04:40:36 +00:00
|
|
|
cat << EOF >> Makefile
|
|
|
|
#===============================================
|
|
|
|
# Scripts listed in ./install
|
|
|
|
#===============================================
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2022-07-04 11:34:00 +00:00
|
|
|
for file in ./install/*; do
|
2022-07-04 09:56:45 +00:00
|
|
|
name=${file##*/}
|
|
|
|
name=${name%.sh}
|
2022-07-04 11:08:37 +00:00
|
|
|
desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
|
2022-07-04 09:56:45 +00:00
|
|
|
[ -z "$desc" ] && desc='<no description>'
|
2022-08-19 12:58:15 +00:00
|
|
|
echo -e "##${name}: ${desc}\n${name}:\n\t@${file}\n" >> Makefile
|
2022-07-04 09:56:45 +00:00
|
|
|
done;
|
|
|
|
|
2022-08-19 12:58:15 +00:00
|
|
|
cat << "EOF" >> Makefile
|
2022-08-25 04:40:36 +00:00
|
|
|
|
|
|
|
self:
|
|
|
|
@./gen-makefile
|
2022-07-04 09:56:45 +00:00
|
|
|
help: Makefile
|
2022-08-25 04:40:36 +00:00
|
|
|
@echo "Ubuntu software installator"
|
|
|
|
@echo
|
2022-07-04 09:56:45 +00:00
|
|
|
@echo "Usage:"
|
2022-08-25 04:40:36 +00:00
|
|
|
@echo "\tmake help\t - Show this help"
|
|
|
|
@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:"
|
2022-08-19 12:58:15 +00:00
|
|
|
@sed -n 's/^##//p' $< | column -ts ':' | sed -e "s/^/\t/"
|
|
|
|
+%:
|
|
|
|
@$(MAKE) $*
|
|
|
|
^%:
|
|
|
|
@./upgrade/$*
|
|
|
|
@%:
|
|
|
|
@./uninstall/$*
|
2022-07-04 09:56:45 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
echo "New ./Makefile has been generated!"
|
|
|
|
echo "Old one has been saved as ./Makefile.bak"
|
|
|
|
echo
|
2022-08-19 12:58:15 +00:00
|
|
|
make -s help
|