X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2Flinux-install.sh;h=2e44c2aacf1b26f83afe2850400a3140d34bdf0e;hp=d7ec9517316e23520dde9e5efc04d1330f713a1e;hb=e9a3268285e97b7316c3321892e77814703ff71d;hpb=948a614a62754fd4fffd9b84ad83fd444e4f0437 diff --git a/altosui/linux-install.sh b/altosui/linux-install.sh index d7ec9517..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" @@ -141,55 +142,102 @@ esac BIN="$target_abs"/AltOS -desktop="$target"/AltOS/altos.desktop - -rm -f "$desktop" -sed -e "s;%bindir%;$BIN;" -e "s;%icondir%;$BIN;" "$target"/AltOS/altos.desktop.in > "$desktop" +for infile in "$target"/AltOS/*.desktop.in; do + desktop="$target"/AltOS/`basename "$infile" .in` + rm -f "$desktop" + sed -e "s;%bindir%;$BIN;" -e "s;%icondir%;$BIN;" "$infile" > "$desktop" + chmod +x "$desktop" +done # -# Figure out where to install the .desktop file. 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 +# -echo -n "Installing .desktop file to $apps..." +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 -cp "$desktop" "$apps" +# +# Install icons +# + +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 # +if [ -d $HOME/Desktop ]; then + default_desktop=n + if [ "$can_ask" = "y" ]; then + : + else + default_desktop=y + fi + answered=n + while [ "$answered" = "n" ]; do + echo -n "Install icons to desktop? [default: $default_desktop] " + if [ "$can_ask" = "y" ]; then + read do_desktop + else + echo + do_desktop="" + fi + + case "$do_desktop" in + "") + do_desktop=$default_desktop + ;; + esac + + case "$do_desktop" in + [yYnN]*) + answered=y + ;; + esac + done + + case "$do_desktop" in + [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." +fi finish 0