/[packages]/cauldron/WindowMaker/current/SOURCES/WindowMaker-wmaker.inst
ViewVC logotype

Contents of /cauldron/WindowMaker/current/SOURCES/WindowMaker-wmaker.inst

Parent Directory Parent Directory | Revision Log Revision Log


Revision 57463 - (show annotations) (download)
Wed Feb 23 16:02:32 2011 UTC (13 years, 2 months ago) by ahmad
File size: 8187 byte(s)
imported package WindowMaker
1 #!/bin/sh
2 #
3 # Install Window Maker for the current user
4 #
5
6 # xx herbert
7 if test x"$1" = x"--batch" ; then
8 BATCH="1"
9 else
10 BATCH=""
11 fi
12 # /xx herbert
13
14 # directory where system wide configuration is stored
15 GLOBALDIR="/usr/share/WindowMaker"
16 GLOBALDEFDIR="/etc/X11/WindowMaker"
17
18 USERDIR=$HOME
19
20 VERSION="0.91.0"
21
22 BINDIR="/usr/bin"
23
24 make_dir() {
25 mkdir $1
26 chmod +rwx $1
27 }
28
29 make_script() {
30 ISCRIPT=$1
31
32 cat << EOF >> $ISCRIPT
33 # Window Maker default X session startup script
34
35 PATH="\$PATH:$BINDIR"
36
37 # If you login from xdm, uncomment this to make error messages appear
38 # in the console window.
39 #
40 # tail -f $HOME/.xsession-errors > /dev/console &
41
42 exec wmaker
43
44 EOF
45 chmod +rx $ISCRIPT
46 }
47
48
49 #
50 # Copy files considering special cases
51 #
52 copy() {
53 source=$1
54 target=$2
55 file=`basename $source`
56 rm -f $target
57 mbytes=`echo $LANG | grep -e [zh:ja:ko]`
58 if [ "$file" = "WMRootMenu" ]; then
59 echo \"$GSDIR/Library/WindowMaker/menu\" > \
60 $target
61 elif [ "$file" = "WindowMaker" ]; then
62 # Multibyte characters aware.
63 if [ x"$mbytes" != x ]; then
64 sed -e "s|MultiByteText = NO|MultiByteText = YES|g" \
65 -e "s|helvetica-[a-z]*-r-normal-\*-[0-9]*|*-medium-r-normal-*-14|g" \
66 -e "s|~/GNUstep|$GSDIR|g" $source > $target
67 else
68 sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
69 fi
70 elif [ "$file" = "WMGLOBAL" ]; then
71 if [ x"$mbytes" != x ]; then
72 sed -e "s|MultiByteText = NO|MultiByteText = YES|g" \
73 -e "s|helvetica-[a-z]*-r-normal-\*-|*-medium-r-normal-*-|g" \
74 $source > $target
75 fi
76 elif [ "$file" = "WMMail" ]; then
77 if [ x"$mbytes" != x ]; then
78 sed -e "s|helvetica-[a-z]*-|*-medium-|g" \
79 $source > $target
80 fi
81 else
82 if test "x$GNUSTEP_USER_ROOT" = "x"; then
83 sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
84 $source > $target
85 else
86 sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
87 -e "s:#wmdatadir#:$GLOBALDIR:g" \
88 $source > $target
89 fi
90 fi
91 }
92
93
94
95 echo "Installing WindowMaker $VERSION for current user..."
96
97
98 if [ ! -d $GLOBALDIR ]; then
99 echo "Could not find global data files"
100 echo "Make sure you have installed Window Maker correctly"
101 exit 1
102 fi
103
104 if [ ! -d $GLOBALDEFDIR ]; then
105 echo "Could not find global configurations files"
106 echo "Make sure you have installed Window Maker correctly"
107 exit 1
108 fi
109
110 if [ ! -d "$USERDIR" ]; then
111 echo "Could not find user directory $USERDIR"
112 exit 1
113 fi
114
115
116 if test "x$GNUSTEP_USER_ROOT" = "x"; then
117 cd $USERDIR
118 GSDIR=$USERDIR/GNUstep
119 if [ ! -d $GSDIR ]; then
120 echo "Creating $GSDIR user directory"
121 make_dir $GSDIR
122 fi
123 else
124 GSDIR=$GNUSTEP_USER_ROOT
125 if [ ! -d $GSDIR ]; then
126 echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
127 exit 1
128 fi
129 cd $GSDIR
130 cd ..
131 fi
132
133
134 if [ ! -d "$GSDIR/.AppInfo" ]; then
135 make_dir $GSDIR/.AppInfo
136 fi
137
138 if [ ! -d "$GSDIR/Defaults" ]; then
139 make_dir $GSDIR/Defaults
140 fi
141
142 echo "Copying defaults database..."
143
144 FILES=`(cd $GLOBALDEFDIR;ls -d *)`
145 all=""
146 for i in $FILES; do
147 if [ ! -d $GLOBALDEFDIR/$i ]; then
148 if [ -f $GSDIR/Defaults/$i -a -z "$BATCH" ]; then
149 echo "The configuration file \"$i\" already exists in your defaults database."
150 echo "Do you wish to replace it? <y/n/a> [n] $all"
151 if [ "$all" != "a" ]; then
152 read foo
153 if [ "$foo" = "a" -o "$foo" = "A" ]; then
154 all="a"
155 fi
156 fi
157 if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
158 copy $GLOBALDEFDIR/$i $GSDIR/Defaults/$i
159 fi
160 else
161 copy $GLOBALDEFDIR/$i $GSDIR/Defaults/$i
162 fi
163 fi
164 done
165
166
167 if [ ! -d "$GSDIR/Library/Icons/" ]; then
168 echo "Creating icon library directory $GSDIR/Library/Icons"
169 if [ ! -d $GSDIR/Library ]; then
170 make_dir $GSDIR/Library
171 fi
172 make_dir $GSDIR/Library/Icons
173 fi
174
175
176 if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
177 echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
178 if [ ! -d $GSDIR/Library ]; then
179 make_dir $GSDIR/Library
180 fi
181 make_dir $GSDIR/Library/WindowMaker
182 fi
183
184 if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
185 echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
186 make_dir $GSDIR/Library/WindowMaker/Styles
187 fi
188
189
190 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
191 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
192 make_dir $GSDIR/Library/WindowMaker/Themes
193 fi
194
195
196
197 if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
198 echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
199 make_dir $GSDIR/Library/WindowMaker/Backgrounds
200 else
201 echo "Default Backgrounds directory already exists. Skipping..."
202 fi
203
204
205 if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
206 echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
207 make_dir $GSDIR/Library/WindowMaker/IconSets
208 else
209 echo "Default IconSets directory already exists. Skipping..."
210 fi
211
212
213 if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
214 echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
215 make_dir $GSDIR/Library/WindowMaker/Pixmaps
216 else
217 echo "Default Pixmaps directory already exists. Skipping..."
218 fi
219
220
221 if [ ! -d "$GSDIR/Library/WindowMaker/Sounds" ]; then
222 echo "Creating sound library $GSDIR/Library/WindowMaker/Sounds"
223 make_dir $GSDIR/Library/WindowMaker/Sounds
224 else
225 echo "Default Sounds directory already exists. Skipping..."
226 fi
227
228
229 if [ ! -d "$GSDIR/Library/WindowMaker/SoundSets" ]; then
230 echo "Creating sound set library $GSDIR/Library/WindowMaker/SoundSets"
231 make_dir $GSDIR/Library/WindowMaker/SoundSets
232 else
233 echo "Default SoundSets directory already exists. Skipping..."
234 fi
235
236
237 if test -z "" ; then
238 FILES=`(cd $GLOBALDIR; ls menu menu.* plmenu plmenu.?? wmmacros)`
239 for i in $FILES; do
240 # xx herbert
241 if [ -f "$GSDIR/Library/WindowMaker/$i" -a -z "$BATCH" ]; then
242 # /xx herbert
243 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
244 echo "Do you wish to replace it? <y/n/a> [n] $all"
245 if [ "$all" != "a" ]; then
246 read foo
247 if [ "$foo" = "a" -o "$foo" = "A" ]; then
248 all="a"
249 fi
250 fi
251 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
252 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
253 fi
254 else
255 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
256 fi
257 done
258 fi
259
260 cp $GLOBALDIR/README.themes $GSDIR/Library/WindowMaker
261 cp $GLOBALDIR/README $GSDIR/Library/WindowMaker
262
263 test -f ~$GSDIR/Library/WindowMaker/autostart || \
264 cp $GLOBALDIR/autostart.sh $GSDIR/Library/WindowMaker/autostart
265 chmod +rx $GSDIR/Library/WindowMaker/autostart
266
267 test -f ~$GSDIR/Library/WindowMaker/exitscript || \
268 cp $GLOBALDIR/exitscript.sh $GSDIR/Library/WindowMaker/exitscript
269 chmod +rx $GSDIR/Library/WindowMaker/exitscript
270
271 # xx herbert
272 if test -n "$BATCH" ; then
273 echo "Installation Finished"
274 exit 0
275 fi
276 # /xx herbert
277
278
279 #
280 #######################
281
282 DATE=`date +%b%d.%T`
283
284 show_end_message() {
285
286 echo
287 echo "Installation Finished"
288 echo
289 if test -z "" ; then
290 echo "There are menus in 2 different file formats. The plain text format and"
291 echo "the property list format. The plain text format is more flexible, but"
292 echo "the menu in the property list format can be edited graphically. The"
293 echo "menu that will be used by default is the plain text. Read"
294 echo "$GSDIR/Library/WindowMaker/README for information on how to change it."
295 else
296 echo "Your copy of Window Maker is configured especially for KDE."
297 echo "Window Maker application menus are not available."
298 fi
299 }
300
301 #wmaker_found=0
302 #for xinit in .xinitrc .Xclients .xsession; do
303 # test ! -f "$HOME/$xinit" && continue
304 # res="`grep wmaker $HOME/$xinit`"
305 # if test "x$res" != x; then
306 # wmaker_found=1
307 # break
308 # fi
309 #done
310 #if test $wmaker_found = 1; then
311 # echo "Found Window Maker to already be your default window manager."
312 # show_end_message
313 # exit 0
314 #fi
315 #
316 #
317 #trap "show_end_message;exit" 2
318 #
319 #echo
320 #echo "Now the .xinitrc, .Xclients or .xsession script must be updated so that"
321 #echo "it calls wmaker when you start an X session."
322 #echo "If the file already exists, it will be backed up with a .old.$DATE "
323 #echo "extension"
324 #echo "Using .xinitrc as a default value"
325 #
326 #file=.xinitrc
327 #
328 #if [ -f $USERDIR/$file ]; then
329 # mv $USERDIR/$file $USERDIR/$file.old.$DATE
330 #fi
331 #
332 #make_script $USERDIR/$file
333
334 #show_end_message
335

  ViewVC Help
Powered by ViewVC 1.1.30