created a makefile && removed now useless code

Makefiles make install and unistalling way easier and mostly automated
This commit is contained in:
René Fuhry 2022-12-16 23:57:47 +01:00 committed by GitHub
parent 280d3a7cb0
commit a0ef64b4a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

11
makefile Normal file
View File

@ -0,0 +1,11 @@
install:
@echo "==> Installing update v0.4..."
@sudo install -Dm755 update /usr/local/bin/update
@echo $${HOME}
@cp update.conf $${HOME}/.config/
@echo "==> Finished."
uninstall:
@echo "==> Uninstalling update v0.4..."
@sudo rm /usr/local/bin/update $${HOME}/.config/update.conf
@echo "==> Finished."

13
update
View File

@ -2,7 +2,7 @@
# shellcheck source=/dev/null
# updates via an aur-helper and flatpak with flags
# version 0.4
# version 0.5
# add options to change aur-helper in the config
# maybe make a first time setup, which asks for backup_location and aur_helper, maybe even if you wanna opt-in to non-interactive flatpak-update (maybe a flag?)
@ -11,12 +11,7 @@
IGreen="\033[0;92m" # Green
NC="\033[0m" # Text Reset
# check if config exists, if not, then a config with default values will be created
if [ -f ~/.config/update/update.conf ]; then
source ~/.config/update/update.conf;
else
cp ~/bin/update_bash/update.conf ~/.config/update/update.conf && echo -e "${IGreen} created config file ${NC}" && source ~/.config/update/update.conf
fi
source ~/.config/update.conf
# output if wrong flag is used
Help() {
@ -76,10 +71,10 @@ while getopts 'fyagr' OPTION; do
update_with_aur_helper; update_with_flatpak ;;
g)
[[ $1 = -g ]] && update_with_aur_helper && update_with_flatpak;
after_backup && echo -e "${IGreen} after-backup complete ${NC}" && sleep 15s && shutdown now ;;
after_backup && echo -e "${IGreen} after-backup complete ${NC}" && sleep 3s && shutdown now ;;
r)
[[ $1 = -r ]] && update_with_aur_helper && update_with_flatpak;
after_backup && echo -e "${IGreen} after-backup complete ${NC}" && sleep 5s && reboot ;;
after_backup && echo -e "${IGreen} after-backup complete ${NC}" && sleep 3s && reboot ;;
?)
Help
exit 1;;

View File

@ -1,5 +1,3 @@
# update.conf should be in ~/.config/update/update.conf, unless you wanna manually change the config location in the script
# Backup to this folder
backup_location=~/
@ -8,4 +6,4 @@ aur_helper=yay
# if you should backup or not
# should stay true unless you know what you're doing
should_backup=$true
should_backup=true