Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: third_party/xdg-utils/scripts/xdg-desktop-icon.in

Issue 151098: Patch from mdm@google.com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/bin/sh
2 #---------------------------------------------
3 # xdg-desktop-icon
4 #
5 # Utility script to install desktop items on a Linux desktop.
6 #
7 # Refer to the usage() function below for usage.
8 #
9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
10 # Copyright 2006, Jeremy White <jwhite@codeweavers.com>
11 #
12 # LICENSE:
13 #
14 #---------------------------------------------
15
16 usage()
17 {
18 cat << _USAGE
19 _USAGE
20 }
21
22 manualpage()
23 {
24 cat << _MANUALPAGE
25 _MANUALPAGE
26 }
27
28 #@xdg-utils-common@
29
30 [ x"$1" != x"" ] || exit_failure_syntax
31
32 action=
33 desktop_file=
34
35 case $1 in
36 install)
37 action=install
38 ;;
39
40 uninstall)
41 action=uninstall
42 ;;
43
44 *)
45 exit_failure_syntax "unknown command '$1'"
46 ;;
47 esac
48
49 shift
50
51 vendor=true
52 while [ $# -gt 0 ] ; do
53 parm=$1
54 shift
55
56 case $parm in
57 --novendor)
58 vendor=false
59 ;;
60
61 -*)
62 exit_failure_syntax "unexpected option '$parm'"
63 ;;
64
65 *)
66 if [ -n "$desktop_file" ] ; then
67 exit_failure_syntax "unexpected argument '$parm'"
68 fi
69 if [ "$action" = "install" ] ; then
70 check_input_file "$parm"
71 fi
72 desktop_file=$parm
73 ;;
74 esac
75 done
76
77 # Shouldn't happen
78 if [ -z "$action" ] ; then
79 exit_failure_syntax "command argument missing"
80 fi
81
82 if [ -z "$desktop_file" ] ; then
83 exit_failure_syntax "FILE argument missing"
84 fi
85
86 filetype=
87 case $desktop_file in
88 *.desktop)
89 filetype=desktop
90 if [ "$vendor" = "true" -a "$action" = "install" ] ; then
91 check_vendor_prefix "$desktop_file"
92 fi
93 ;;
94 *)
95 filetype=other
96 ;;
97 esac
98
99 my_umask=077
100 desktop_dir="$HOME/Desktop"
101 desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/nul l`
102 if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then
103 desktop_dir_gnome="$HOME"
104 # Don't create $HOME/Desktop if it doesn't exist
105 [ -w $desktop_dir ] || desktop_dir=
106 fi
107 if [ -n "$desktop_dir_kde" ]; then
108 if [ ! -d "$desktop_dir_kde" ]; then
109 save_umask=`umask`
110 umask $my_umask
111 mkdir -p $desktop_dir_kde
112 umask $save_umask
113 fi
114 # Is the KDE desktop dir != $HOME/Desktop ?
115 if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; t hen
116 # If so, don't create $HOME/Desktop if it doesn't exist
117 [ -w $desktop_dir ] || desktop_dir=
118 else
119 desktop_dir_kde=
120 fi
121 fi
122 desktop_dir="$desktop_dir $desktop_dir_kde $desktop_dir_gnome"
123
124 basefile=`basename $desktop_file`
125
126 DEBUG 1 "$action $desktop_file in $desktop_dir"
127
128 case $action in
129 install)
130 save_umask=`umask`
131 umask $my_umask
132
133 for x in $desktop_dir ; do
134 mkdir -p $x
135 eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
136 done
137
138 umask $save_umask
139 ;;
140
141 uninstall)
142 for x in $desktop_dir ; do
143 rm -f $x/$basefile
144 done
145
146 ;;
147 esac
148
149 exit_success
150
151
OLDNEW
« no previous file with comments | « third_party/xdg-utils/scripts/xdg-desktop-icon ('k') | third_party/xdg-utils/scripts/xdg-desktop-menu » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698