- added helper method to look up wether a command exists

- avoid calling flatpak or notify-send if not installed
This commit is contained in:
SZIMNAU
2025-11-05 14:06:40 +01:00
parent 48bda2be2d
commit c794518817

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)";
@@ -63,6 +68,9 @@ doUpdateSystem() {
updateFlatpak() {
if [[ ! $(commandExists flatpak) ]]; then
return 1;
fi
noconfirm=
if [[ $1 == "-y" ]]; then
noconfirm="--assumeyes";
@@ -119,11 +127,19 @@ finds () {
# sends a desktop-notification with an icon signalling an error
notifyError () {
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 () {
if [[ ! $(commandExists notify-send) ]]; then
echo "INFO: $1";
else
notify-send "$1" --icon=preferences-desktop-notification;
fi
}