diff --git a/scripts/scan/batch-scan.sh b/scripts/scan/batch-scan.sh index 68871c1..e80daff 100755 --- a/scripts/scan/batch-scan.sh +++ b/scripts/scan/batch-scan.sh @@ -34,6 +34,6 @@ while true; do continue fi printf "> #"$counter": scanning to '"$file"' finished!\n" - postprocess "$file" "$directory" "$counter" + #postprocess "$file" "$directory" "$counter" ((counter++)) done diff --git a/scripts/update/alpine.sh b/scripts/update/alpine.sh index 01e1855..56dfb0d 100755 --- a/scripts/update/alpine.sh +++ b/scripts/update/alpine.sh @@ -19,7 +19,7 @@ for arg in "$@"; do noconfirm="true" ;; -r|--reboot) - reboot="true"G + reboot="true" ;; esac done @@ -27,12 +27,7 @@ done printf ""$font_colored_bold">> system update started..."$font_default"\n" printf ""$font_colored"> updating packages..."$font_default"\n" -[[ "$noconfirm" ]] && apk update --progress || apk update --progress --interactive -[[ "$noconfirm" ]] && apk upgrade --progress || apk update --progress --interactive - -printf ""$font_colored"> cleaning cache..."$font_default"\n" -apk cache clean &> /dev/null -rm -rf "/var/cache/apk/*" +[[ "$noconfirm" ]] && apk --update-cache upgrade --progress || apk --update-cache upgrade --progress --interactive orphans="$(apk list --orphaned | awk '{print $1}' 2> /dev/null)" if [[ "$orphans" ]]; then @@ -46,6 +41,10 @@ fi script="$(dirname $(realpath $0))/conf.d/$(hostname).sh" [[ -x "$script" ]] && printf ""$font_colored"> executing script "$script"..."$font_default"\n" && (. "$script") +printf ""$font_colored"> cleaning cache..."$font_default"\n" +apk cache clean &> /dev/null +rm -rf "/var/cache/apk/*" + printf ""$font_colored_bold">> system updated finished!"$font_default"\n" [[ ! "$reboot" ]] && exit 0 diff --git a/scripts/update/arch.sh b/scripts/update/arch.sh index 9bf229f..6546d6e 100755 --- a/scripts/update/arch.sh +++ b/scripts/update/arch.sh @@ -25,6 +25,9 @@ for arg in "$@"; do esac done +# sudo +sudo id -u 2&> /dev/null + printf "${BOLD}${YELLOW}>> starting system update...${DEFAULT}\n" # upgrade installed packages diff --git a/scripts/update/update.sh b/scripts/update/update.sh index a0c4d81..e1b8f58 100755 --- a/scripts/update/update.sh +++ b/scripts/update/update.sh @@ -8,17 +8,20 @@ distro="$(grep "^ID" /etc/*release | cut -d "=" -f2)" script="$(dirname $(realpath $0))/$distro.sh" # check if update script exists -[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1 +[ ! -x "$script" ] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1 args="" for arg in "$@"; do - [[ -n "$args" ]] && args="$args " + [ -n "$args" ] && args="$args " args="$args$arg" done # execute update script -if [[ "$EUID" == "0" ]]; then - "$script" $args +#if [ "$distro" == "arch" ]; then +# "$script" $args +if [ "$(id -u)" -eq 0 ] || [ "$distro" == "arch" ]; then +#elif [ "$(id -u)" -eq 0 ]; then + "$script" $args else sudo "$script" $args fi