This update includes the 0.20.3pre3 code
[wmaker-crm.git] / util / wmaker.inst.in
blob1d158af7ab7e49ecfed82f39dcd2a70ad6e64e59
1 #!/bin/sh
3 # Install Window Maker for the current user
6 # directory where system wide configuration is stored
7 GLOBALDIR="#pkgdatadir#"
9 USERDIR=$HOME
11 VERSION="#version#"
13 BINDIR="#bindir#"
15 make_dir() {
16 make_dir $1
17 chmod +rw $1
20 make_script() {
21 ISCRIPT=$1
23 cat << EOF >> $ISCRIPT
24 # Window Maker default X session startup script
26 PATH="\$PATH:$BINDIR"
28 # If you login from xdm, uncomment this to make error messages appear
29 # in the console window.
31 # tail -f $HOME/.xsession-errors > /dev/console
33 exec wmaker
35 EOF
36 chmod +rx $ISCRIPT
41 # Copy files considering special cases
43 copy() {
44 source=$1
45 target=$2
46 file=`basename $source`
47 rm -f $target
48 if [ "$file" = "WMRootMenu" ]; then
49 echo \"$GSDIR/Library/WindowMaker/menu\" > \
50 $target
51 elif [ "$file" = "WindowMaker" ]; then
52 sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
53 else
54 if test "x$GNUSTEP_USER_ROOT" = "x"; then
55 cp $source $target
56 else
57 sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
64 echo "Installing WindowMaker $VERSION for current user..."
67 if [ ! -d $GLOBALDIR ]; then
68 echo "Could not find global configurations files"
69 echo "Make sure you've installed Window Maker correctly"
70 exit 1
73 if [ ! -d "$USERDIR" ]; then
74 echo "Could not find user directory $USERDIR"
75 exit 1
79 if test "x$GNUSTEP_USER_ROOT" = "x"; then
80 cd $USERDIR
81 GSDIR=$USERDIR/GNUstep
82 if [ ! -d $GSDIR ]; then
83 echo "Creating $GSDIR user directory"
84 make_dir $GSDIR
86 else
87 GSDIR=$GNUSTEP_USER_ROOT
88 if [ ! -d $GSDIR ]; then
89 echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
90 exit 1
92 cd $GSDIR
93 cd ..
97 if [ ! -d "$GSDIR/.AppInfo" ]; then
98 make_dir $GSDIR/.AppInfo
101 if [ ! -d "$GSDIR/Defaults" ]; then
102 make_dir $GSDIR/Defaults
105 echo "Copying defaults database..."
107 FILES=`(cd $GLOBALDIR/Defaults;ls *)`
108 all=""
109 for i in $FILES; do
110 if [ -f $GSDIR/Defaults/$i ]; then
111 echo "The configuration file \"$i\" already exists in your defaults database."
112 echo "Do you wish to replace it? <y/n/a> [n] $all"
113 if [ "$all" != "a" ]; then
114 read foo
115 if [ "$foo" = "a" -o "$foo" = "A" ]; then
116 all="a"
119 if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
120 copy $GLOBALDIR/Defaults/$i $GSDIR/Defaults/$i
122 else
123 copy $GLOBALDIR/Defaults/$i $GSDIR/Defaults/$i
125 done
128 if [ ! -d "$GSDIR/Library/Icons/" ]; then
129 echo "Creating icon library directory $GSDIR/Library/Icons"
130 if [ ! -d $GSDIR/Library ]; then
131 make_dir $GSDIR/Library
133 make_dir $GSDIR/Library/Icons
137 if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
138 echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
139 if [ ! -d $GSDIR/Library ]; then
140 make_dir $GSDIR/Library
142 make_dir $GSDIR/Library/WindowMaker
145 if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
146 echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
147 make_dir $GSDIR/Library/WindowMaker/Styles
148 else
149 echo "Styles directory already exists. Skipping..."
153 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
154 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
155 make_dir $GSDIR/Library/WindowMaker/Themes
156 else
157 echo "Themes directory already exists. Skipping..."
161 if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
162 echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
163 make_dir $GSDIR/Library/WindowMaker/Backgrounds
164 else
165 echo "Default Backgrounds directory already exists. Skipping..."
169 if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
170 echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
171 make_dir $GSDIR/Library/WindowMaker/IconSets
172 else
173 echo "Default IconSets directory already exists. Skipping..."
177 if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
178 echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
179 make_dir $GSDIR/Library/WindowMaker/Pixmaps
180 else
181 echo "Default Pixmaps directory already exists. Skipping..."
185 if [ ! -d "$GSDIR/Library/WindowMaker/Sounds" ]; then
186 echo "Creating sound library $GSDIR/Library/WindowMaker/Sounds"
187 make_dir $GSDIR/Library/WindowMaker/Sounds
188 else
189 echo "Default Sounds directory already exists. Skipping..."
193 if [ ! -d "$GSDIR/Library/WindowMaker/SoundSets" ]; then
194 echo "Creating sound set library $GSDIR/Library/WindowMaker/SoundSets"
195 make_dir $GSDIR/Library/WindowMaker/SoundSets
196 else
197 echo "Default SoundSets directory already exists. Skipping..."
201 echo "Copying default menu configuration files..."
202 FILES=`(cd $GLOBALDIR;ls -1 menu* plmenu wmmacros)`
203 all=""
204 for i in $FILES; do
205 if [ -f "$GSDIR/Library/WindowMaker/$i" ]; then
206 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
207 echo "Do you wish to replace it? <y/n/a> [n] $all"
208 if [ "$all" != "a" ]; then
209 read foo
210 if [ "$foo" = "a" -o "$foo" = "A" ]; then
211 all="a"
214 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
215 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
217 else
218 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
220 done
223 cp $GLOBALDIR/README $GSDIR/Library/WindowMaker
224 cp -i $GLOBALDIR/autostart.sh $GSDIR/Library/WindowMaker/autostart
225 chmod +rx $GSDIR/Library/WindowMaker/autostart
228 #######################
230 DATE=`date +%m%d%H%M`
232 show_end_message() {
234 echo
235 echo "Installation Finished"
236 echo
237 echo "There are menus in 2 different file formats. The plain text format and"
238 echo "the property list format. The plain text format is more flexible, but"
239 echo "the menu in the property list format can be edited graphically. The"
240 echo "menu that will be used by default is the plain text. Read"
241 echo "$GSDIR/Library/WindowMaker/README for information on how to change it."
246 trap "show_end_message;exit" 2
248 echo
249 echo "Now the .xinitrc, .Xclients or .xsession script must be updated so that"
250 echo "it calls wmaker when you start an X session."
251 echo "Type the name of the file that must be changed (normally .xinitrc)."
252 echo "If the file already exists, it will be backed up with a .old.$DATE extension"
253 echo "If you want to edit it by hand, hit <Control>-C now."
254 read file
256 if test "x$file" = "x"; then
257 echo "Using .xinitrc as a default value"
258 file=.xinitrc
261 if [ -f $USERDIR/$file ]; then
262 mv $USERDIR/$file $USERDIR/$file.old.$DATE
265 make_script $USERDIR/$file
267 show_end_message