diff --git a/makefile b/makefile new file mode 100644 index 0000000..b210392 --- /dev/null +++ b/makefile @@ -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." \ No newline at end of file diff --git a/update b/update index 658a7a7..bac9cde 100644 --- a/update +++ b/update @@ -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;; diff --git a/update.conf b/update.conf index a03ff55..c2bff83 100644 --- a/update.conf +++ b/update.conf @@ -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