From fad2ddd2c3240ac23e58a2fa70f6c460fdf37174 Mon Sep 17 00:00:00 2001 From: Ohio2 Date: Sun, 3 Oct 2021 00:15:40 +0200 Subject: [PATCH] Ok DONE --- aps | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/aps b/aps index d7476c7..5b47d49 100755 --- a/aps +++ b/aps @@ -8,19 +8,21 @@ # OHIO: it's rewritten however it has some old code from aps (v0.0.8.1) # KEMAL: abandon all hope, ye who enter here. # OHIO: ^, however my code is cleaner than the mess before. -if [ -f "$XDG_CONFIG_HOME/al/config" ]; then - . $XDG_CONFIG_HOME/al/config -elif [ -f "$HOME/.config/al/config" ]; then - . $HOME/.config/al/config -elif [ -f "/etc/al/config" ]; then - . /etc/al/config -elif [ -f "/etc/skel/al/config" ]; then - . /etc/skel/al/config -elif [ -f $AL_CFG ]; then - . $AL_CFG -else - wrn "No config file!" -fi +function conf_fetch(){ + if [ -f "$XDG_CONFIG_HOME/al/config" ]; then + . $XDG_CONFIG_HOME/al/config + elif [ -f "$HOME/.config/al/config" ]; then + . $HOME/.config/al/config + elif [ -f "/etc/al/config" ]; then + . /etc/al/config + elif [ -f "/etc/skel/al/config" ]; then + . /etc/skel/al/config +#elif [ -f $AL_CFG ]; then +# . $AL_CFG + else + err "No config file!" + fi +} case ${debug} in on) set -x ;; esac @@ -36,9 +38,10 @@ function wrn(){ #} function err(){ echo -e "\e[34m==>\e[31m ERROR:\e[39m $1" && - rm ${lock} 2> /dev/null && + rm ${lock} 2> /dev/null exit 2 } +conf_fetch function notf(){ echo -e "\e[34m==>\e[36m NOTIFICATION:\e[39m $1" } @@ -200,7 +203,7 @@ sync_local_repo_database() { git clone "${2}" "${locpkg_database}/${1}" else # Local database for repo already exists - sync it - cd "${locpkg_database}/${1}" || die "Could not enter local database directory. Exiting..." + cd "${locpkg_database}/${1}" || err "Could not enter local database directory. Exiting..." git pull fi }