OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 #--------------------------------------------- | 2 #--------------------------------------------- |
3 # xdg-desktop-menu | 3 # xdg-desktop-menu |
4 # | 4 # |
5 # Utility script to install menu items on a Linux desktop. | 5 # Utility script to install menu items on a Linux desktop. |
6 # Refer to the usage() function below for usage. | 6 # Refer to the usage() function below for usage. |
7 # | 7 # |
8 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | 8 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
9 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> | 9 # Copyright 2009-2010, Rex Dieter <rdieter@fedoraproject.org> |
10 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> | 10 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DEBUG 2 "Found default apps for $MIME: $default_app" | 81 DEBUG 2 "Found default apps for $MIME: $default_app" |
82 default_app="$default_app;" | 82 default_app="$default_app;" |
83 break; | 83 break; |
84 fi | 84 fi |
85 done | 85 done |
86 DEBUG 2 "Current default apps for $MIME: $default_app" | 86 DEBUG 2 "Current default apps for $MIME: $default_app" |
87 if echo "$default_app" | grep "$2" > /dev/null 2> /dev/null; then | 87 if echo "$default_app" | grep "$2" > /dev/null 2> /dev/null; then |
88 # App already listed as default | 88 # App already listed as default |
89 continue; | 89 continue; |
90 fi | 90 fi |
91 default_file="$1/defaults.list" | 91 default_file="$(readlink -f "$1/defaults.list")" |
92 DEBUG 1 "Updating $default_file" | 92 DEBUG 1 "Updating $default_file" |
93 grep -v "$MIME=" $default_file > ${default_file}.new 2> /dev/null | 93 grep -v "$MIME=" $default_file > ${default_file}.new 2> /dev/null |
94 if ! grep "[Default Applications]" ${default_file}.new > /dev/null; then | 94 if ! grep "[Default Applications]" ${default_file}.new > /dev/null; then |
95 echo "[Default Applications]" >> ${default_file}.new | 95 echo "[Default Applications]" >> ${default_file}.new |
96 fi | 96 fi |
97 echo $MIME="$default_app$2" >> ${default_file}.new | 97 echo $MIME="$default_app$2" >> ${default_file}.new |
98 mv ${default_file}.new $default_file | 98 mv ${default_file}.new $default_file |
99 done | 99 done |
100 } | 100 } |
101 | 101 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 | 619 |
620 ;; | 620 ;; |
621 esac | 621 esac |
622 done | 622 done |
623 | 623 |
624 if [ x"$update" = x"yes" ] ; then | 624 if [ x"$update" = x"yes" ] ; then |
625 update_desktop_database | 625 update_desktop_database |
626 fi | 626 fi |
627 | 627 |
628 exit_success | 628 exit_success |
OLD | NEW |