summaryrefslogtreecommitdiff
path: root/altosui/linux-install.sh
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-07-15 00:44:14 -0700
committerKeith Packard <keithp@keithp.com>2014-07-15 00:44:14 -0700
commitec7ceb607f5ba7e1ed5cfd32b7a452a5f364b095 (patch)
tree7b636eff039ab5a71dfd493c336fec420d1d6787 /altosui/linux-install.sh
parentfb914d37018a585a879161483609d3c0be556d1e (diff)
linux-fat: Fix up fat linux install icons, mime types and .desktop files
use the standard xdg utilities to install mime type and .desktop files. The standard xdg icon installer doesn't handle svg icons, so we have to do those manually. With this patch, xfce, gnome3 and kde4 all place the applications in user-visible menus, display correct file icons and launch correct applications for our file types. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosui/linux-install.sh')
-rw-r--r--altosui/linux-install.sh79
1 files changed, 42 insertions, 37 deletions
diff --git a/altosui/linux-install.sh b/altosui/linux-install.sh
index 957b1aad..2e44c2aa 100644
--- a/altosui/linux-install.sh
+++ b/altosui/linux-install.sh
@@ -130,6 +130,7 @@ esac
#
# Create the .desktop file by editing the paths
#
+
case "$target" in
/*)
target_abs="$target"
@@ -149,43 +150,46 @@ for infile in "$target"/AltOS/*.desktop.in; do
done
#
-# Figure out where to install the .desktop files. If we can, write it
-# to the public /usr/share/applications, otherwise, write it to the
-# per-user ~/.local/share/applications
+# Install the .desktop file
#
-public=/usr/share/applications
-private=$HOME/.local/share/applications
-apps=""
+for desktop in "$target"/AltOS/*.desktop; do
+ case `id -u` in
+ 0)
+ xdg-desktop-menu install --mode system "$desktop"
+ ;;
+ *)
+ xdg-desktop-menu install --mode user "$desktop"
+ ;;
+ esac
+done
-if [ -d "$public" -a -w "$public" ]; then
- apps="$public"
-else
- mkdir -p "$private" >/dev/null 2>&1
- if [ -d "$private" -a -w "$private" ]; then
- apps="$private"
- fi
-fi
-
-case "$apps" in
-"")
- echo "Cannot install application icon"
- finish 1
- ;;
-esac
+#
+# Install mime type file
+#
+
+for mimetype in "$target"/AltOS/*-mimetypes.xml; do
+ case `id -u` in
+ 0)
+ xdg-mime install --mode system "$mimetype"
+ ;;
+ *)
+ xdg-mime install --mode user "$mimetype"
+ ;;
+ esac
+done
-echo -n "Installing .desktop files to $apps..."
+#
+# Install icons
+#
-cp "$target"/AltOS/*.desktop "$apps"
+for icon_dir in /usr/share/icons/hicolor/scalable/mimetypes "$HOME/.icons" "$HOME/.kde/share/icons"; do
+ if [ -w "$icon_dir" ]; then
+ cp "$target"/AltOS/*.svg "$icon_dir"
+ update-icon-caches "$icon_dir"
+ fi
+done
-case "$?" in
-0)
- echo " done."
- ;;
-*)
- echo " failed."
- ;;
-esac
#
# Install icon to desktop if desired
@@ -222,13 +226,14 @@ if [ -d $HOME/Desktop ]; then
esac
done
- echo -n "Installing desktop icons..."
case "$do_desktop" in
- [yY]*)
- for d in "$target"/AltOS/*.desktop; do
- ln -f -s "$d" "$HOME/Desktop/"
- done
- ;;
+ [yY]*)
+ echo -n "Installing desktop icons..."
+ for d in "$target"/AltOS/*.desktop; do
+ base=`basename $d`
+ cp --remove-destination "$d" "$HOME/Desktop/"
+ done
+ ;;
esac
echo " done."