Revert "- removed debug ouptut"

This reverts commit 4c09537776.
This commit is contained in:
2025-11-19 20:57:16 +01:00
parent 4c09537776
commit c2bd45267a

View File

@@ -40,6 +40,11 @@ alias dirsizes='du -kh --apparent-size --max-depth=1 | sort -hr'
alias start_x11_vnc="x11vnc -many -display :0 -no6 -rfbport 5900 -auth /var/run/lightdm/root/:0 -rfbauth $HOME/.vnc/passwd"
commandExists() {
type $1 2 >& 1 > /dev/null
}
rsyncLink() {
source=$1;
linkSource="$(realpath $source)";
@@ -47,18 +52,25 @@ rsyncLink() {
shift;
dest=$1;
shift;
echo "rsync $DEFAULT_RSYNC --one-file-system --link-dest=$linkSource $source $dest $*;"
rsync $DEFAULT_RSYNC --one-file-system --link-dest=$linkSource $source $dest $*;
}
updateSystem() {
executeAndNotify "doUpdateSystem $1" "system updated" "system update failed"
}
doUpdateSystem() {
updatePackages $1;
updateFlatpak $1;
}
updateFlatpak() {
if [[ ! $(commandExists flatpak) ]]; then
return 1;
fi
noconfirm=
if [[ $1 == "-y" ]]; then
noconfirm="--assumeyes";
@@ -76,7 +88,7 @@ doUpdateFlatpak() {
# executes command and notifies upon failure
execute() {
dir="$(pwd)";
dir=${dir##*/};
dir=${dir##*/}; # cut off previous path (/path/to/foo.txt -> foo.txt)
if [[ -n "$2" ]]; then
errLog=$2;
else
@@ -100,17 +112,9 @@ executeAndNotify () {
winLog="execution of \"$1\" succeeded";
fi
echo ""
echo "******************************************"
echo "executeAndNotify \"$1\" \"$winLog\" \"$3\""
echo "******************************************"
echo ""
if ! execute "$1" "$3"; then # arguments in quotes so they are interpreted as ONE argument each by execute()
echo "failed \"$1\" -> \"$3\""
return 1;
fi
echo "succeeded \"$1\" -> \"$winLog\""
notifyInfo "$dir: $winLog";
}
@@ -123,11 +127,19 @@ finds () {
# sends a desktop-notification with an icon signalling an error
notifyError () {
notify-send "$1" --icon=data-warning;
if [[ ! $(commandExists notify-send) ]]; then
echo "ERROR: $1";
else
notify-send "$1" --icon=data-warning;
fi
}
# sends a desktop-notification with an icon signalling a simple information
notifyInfo () {
notify-send "$1" --icon=preferences-desktop-notification;
if [[ ! $(commandExists notify-send) ]]; then
echo "INFO: $1";
else
notify-send "$1" --icon=preferences-desktop-notification;
fi
}