14,19c14 < # please do not change $VENDORPREFIX as it will allow for desktop files < # belonging to AppImages to be recognized by future AppImageKit components < # such as desktop integration daemons < VENDORPREFIX=appimagekit < < if [ -z $APPDIR ] ; then --- > if [ -z "$APPDIR" ] ; then 36d30 < DESKTOP_FILE="$APPDIR/joplin.desktop" 86,107d79 < check_prevent() < { < FILE=$1 < if [ -e "$FILE" ] ; then < exit 0 < fi < } < < # exit immediately of one of these files is present < # (e.g., because the desktop environment wants to handle desktop integration itself) < check_prevent "$HOME/.local/share/$VENDORPREFIX/no_desktopintegration" < check_prevent "/usr/share/$VENDORPREFIX/no_desktopintegration" < check_prevent "/etc/$VENDORPREFIX/no_desktopintegration" < < # exit immediately if appimaged is running < pidof appimaged 2>/dev/null && exit 0 < < # exit immediately if $DESKTOPINTEGRATION is not empty < if [ ! -z "$DESKTOPINTEGRATION" ] ; then < exit 0 < fi < 111c83 < if [ -z $(which $DEP) ] ; then --- > if [ -z $(which "$DEP") ] ; then 117,121d88 < if [ ! -f "$DESKTOP_FILE" ] ; then < echo "Desktop file is missing. Please run ${THIS} from within an AppImage." < exit 0 < fi < 127,221d93 < # determine where the desktop file should be installed < if [[ $EUID -ne 0 ]]; then < DESTINATION_DIR_DESKTOP="$HOME/.local/share/applications" < SYSTEM_WIDE="" < else < DESTINATION_DIR_DESKTOP="/usr/local/share/applications" < # for xdg-mime and xdg-icon-resource < SYSTEM_WIDE="--mode system" < fi < < desktopFilePath="$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-joplin.desktop" < < # check if the desktop file is already there and if so, whether it points to the same AppImage < if [ -e "$desktopFilePath" ] ; then < INSTALLED_APP_VERSION=$(grep "^X-AppImage-BuildId=" "$DESTINATION_DIR_DESKTOP/$VENDORPREFIX-joplin.desktop" | head -n 1 | cut -d " " -f 1) < APP_VERSION=$(grep "^X-AppImage-BuildId=" "$DESKTOP_FILE" | head -n 1 | cut -d " " -f 1) < #echo "installed: $INSTALLED_APP_VERSION image: $APP_VERSION" < if [ "$INSTALLED_APP_VERSION" == "$APP_VERSION" ] ; then < exit 0 < fi < fi < < < < < if [ -z "$APPIMAGE_SILENT_INSTALL" ] ; then < # we ask the user only if we have found no reason to skip until here < yesno "Install" "Would you like to integrate $(basename $APPIMAGE) with your system?\n\nThis will add it to your applications menu and install icons.\nIf you don't do this you can still launch the application by double-clicking on the AppImage." < fi < < < # check whether dependencies are present in base system (we do not bundle these) < # http://cgit.freedesktop.org/xdg/desktop-file-utils/ < check_dep desktop-file-install < check_dep xdg-icon-resource < check_dep xdg-mime < check_dep xdg-desktop-menu < < desktop-file-install --rebuild-mime-info-cache \ < --vendor=$VENDORPREFIX --set-key=Exec --set-value="\"${APPIMAGE}\" %U" \ < --set-key=X-AppImage-Comment --set-value="Generated by ${THIS}" \ < --set-icon="appimagekit-joplin" --set-key=TryExec --set-value=${APPIMAGE// /\\s} "$DESKTOP_FILE" \ < --dir "$DESTINATION_DIR_DESKTOP" \ < --mode=755 < < # uninstall previous icons < xdg-icon-resource uninstall --noupdate --size 16 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 24 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 32 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 48 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 64 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 72 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 96 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 128 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 256 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 512 "appimagekit-joplin" < xdg-icon-resource uninstall --noupdate --size 1024 "appimagekit-joplin" < < # install the icon files < < xdg-icon-resource install --noupdate --context apps --size 16 "$APPDIR/usr/share/icons/hicolor/16x16/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 24 "$APPDIR/usr/share/icons/hicolor/24x24/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 32 "$APPDIR/usr/share/icons/hicolor/32x32/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 48 "$APPDIR/usr/share/icons/hicolor/48x48/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 64 "$APPDIR/usr/share/icons/hicolor/64x64/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 96 "$APPDIR/usr/share/icons/hicolor/96x96/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 128 "$APPDIR/usr/share/icons/hicolor/128x128/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 256 "$APPDIR/usr/share/icons/hicolor/256x256/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 512 "$APPDIR/usr/share/icons/hicolor/512x512/apps/joplin.png" "appimagekit-joplin" < < xdg-icon-resource install --noupdate --context apps --size 1024 "$APPDIR/usr/share/icons/hicolor/1024x1024/apps/joplin.png" "appimagekit-joplin" < < < < < xdg-icon-resource forceupdate < < # Install the icon files for the mime type < ICONS=$(find "${APPDIR}/usr/share/icons/" -wholename "*/mimetypes/*.png" 2>/dev/null || true) < for ICON in $ICONS ; do < ICON_SIZE=$(echo "${ICON}" | rev | cut -d "/" -f 3 | rev | cut -d "x" -f 1) < xdg-icon-resource install --context mimetypes --size ${ICON_SIZE} "${ICON}" $(basename $ICON | sed -e 's/.png//g') < done < < xdg-desktop-menu forceupdate < # for MIME < gtk-update-icon-cache