File appimage-update.sh of Package AppImageUpdate
#!/bin/bash
#
# appimage-update.sh wrapper
#
# Author: munix9@googlemail.com
# License: MIT
#
export TEXTDOMAIN="appimage-update.sh"
export TEXTDOMAINDIR="/usr/share/locale"
_t () {
local t="${1:-???}"
echo "$(gettext -s "$t")"
}
_file="$1"
_old="${_file}.zs-old"
_title="AppImageUpdate - $(_t "Check for update")"
_sp="$(printf " %0.s " {1..50})"
[[ -n $_file ]] || {
kdialog --title "$_title" --error "$_sp<br><b>$(_t "Missing file operand.")</b><br>"
exit 1
}
[[ -r $_file ]] || {
kdialog --title "$_title" --error "$_file<br>$_sp<br><b>$(_t "File not found.")</b><br>"
exit 1
}
# check for update
/usr/bin/AppImageUpdate -j "$_file" >/dev/null 2>&1
if [[ $? -eq 0 ]] ; then
kdialog --title "$_title" --msgbox "$_file<br>$_sp<br><b>$(_t "AppImage already up to date.")</b><br>"
elif [[ $? -eq 1 ]] ; then
kdialog --title "$_title" --yesno "$_file<br>$_sp<br><b>$(_t "Update available. Perform update?")</b><br>"
[[ $? -eq 0 ]] && {
/usr/bin/AppImageUpdate "$_file"
[[ $? -eq 0 ]] && [[ -f $_old ]] && {
kdialog --title "$_title" --yesno "$_old<br>$_sp<br><b>$(_t "Remove old AppImage file?")</b><br>"
[[ $? -eq 0 ]] && rm -f "$_old"
}
}
#[[ $? -eq 0 ]] && kdialog --title "$_title" --msgbox "run AppImageUpdate"
else
kdialog --title "$_title" --error "$_file<br>$_sp<br><b>$(_t "Error checking file for updates.")</b><br>"
fi