- added helper method to look up wether a command exists
- avoid calling flatpak or notify-send if not installed
This commit is contained in:
@@ -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"
|
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() {
|
rsyncLink() {
|
||||||
source=$1;
|
source=$1;
|
||||||
linkSource="$(realpath $source)";
|
linkSource="$(realpath $source)";
|
||||||
@@ -63,6 +68,9 @@ doUpdateSystem() {
|
|||||||
|
|
||||||
|
|
||||||
updateFlatpak() {
|
updateFlatpak() {
|
||||||
|
if [[ ! $(commandExists flatpak) ]]; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
noconfirm=
|
noconfirm=
|
||||||
if [[ $1 == "-y" ]]; then
|
if [[ $1 == "-y" ]]; then
|
||||||
noconfirm="--assumeyes";
|
noconfirm="--assumeyes";
|
||||||
@@ -119,11 +127,19 @@ finds () {
|
|||||||
|
|
||||||
# sends a desktop-notification with an icon signalling an error
|
# sends a desktop-notification with an icon signalling an error
|
||||||
notifyError () {
|
notifyError () {
|
||||||
|
if [[ ! $(commandExists notify-send) ]]; then
|
||||||
|
echo "ERROR: $1";
|
||||||
|
else
|
||||||
notify-send "$1" --icon=data-warning;
|
notify-send "$1" --icon=data-warning;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# sends a desktop-notification with an icon signalling a simple information
|
# sends a desktop-notification with an icon signalling a simple information
|
||||||
notifyInfo () {
|
notifyInfo () {
|
||||||
|
if [[ ! $(commandExists notify-send) ]]; then
|
||||||
|
echo "INFO: $1";
|
||||||
|
else
|
||||||
notify-send "$1" --icon=preferences-desktop-notification;
|
notify-send "$1" --icon=preferences-desktop-notification;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user