Updating to version 0.20.2
[wmaker-crm.git] / util / wmaker.inst.in
blob7dc1de266d29ad9f55104a0d00e9080995ea8a95
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#"
17 make_script() {
18 ISCRIPT=$1
20 cat << EOF >> $ISCRIPT
21 #!/bin/sh
22 # Window Maker default X session startup script
24 PATH="\$PATH:$BINDIR"
26 # If you login from xdm, uncomment this to make error messages appear
27 # in the console window.
29 # tail -f $HOME/.xsession-errors > /dev/console
31 exec wmaker
33 EOF
34 chmod +rx $ISCRIPT
39 # Copy files considering special cases
41 copy() {
42 source=$1
43 target=$2
44 file=`basename $source`
45 rm -f $target
46 if [ "$file" = "WMRootMenu" ]; then
47 echo \"$GSDIR/Library/WindowMaker/menu\" > \
48 $target
49 elif [ "$file" = "WindowMaker" ]; then
50 sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
51 else
52 if test "x$GNUSTEP_USER_ROOT" = "x"; then
53 cp $source $target
54 else
55 sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
62 echo "Installing WindowMaker $VERSION for current user..."
65 if [ ! -d $GLOBALDIR ]; then
66 echo "Could not find global configurations files"
67 echo "Make sure you've installed Window Maker correctly"
68 exit 1
71 if [ ! -d "$USERDIR" ]; then
72 echo "Could not find user directory $USERDIR"
73 exit 1
77 if test "x$GNUSTEP_USER_ROOT" = "x"; then
78 cd $USERDIR
79 GSDIR=$USERDIR/GNUstep
80 if [ ! -d $GSDIR ]; then
81 echo "Creating $GSDIR user directory"
82 mkdir $GSDIR
84 else
85 GSDIR=$GNUSTEP_USER_ROOT
86 if [ ! -d $GSDIR ]; then
87 echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
88 exit 1
90 cd $GSDIR
91 cd ..
95 if [ ! -d "$GSDIR/.AppInfo" ]; then
96 mkdir $GSDIR/.AppInfo
99 if [ ! -d "$GSDIR/Defaults" ]; then
100 mkdir $GSDIR/Defaults
103 echo "Copying defaults database..."
105 FILES=`(cd $GLOBALDIR/Defaults;ls *)`
106 all=""
107 for i in $FILES; do
108 if [ -f $GSDIR/Defaults/$i ]; then
109 echo "The configuration file \"$i\" already exists in your defaults database."
110 echo "Do you wish to replace it? <y/n/a> [n] $all"
111 if [ "$all" != "a" ]; then
112 read foo
113 if [ "$foo" = "a" -o "$foo" = "A" ]; then
114 all="a"
117 if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
118 copy $GLOBALDIR/Defaults/$i $GSDIR/Defaults/$i
120 else
121 copy $GLOBALDIR/Defaults/$i $GSDIR/Defaults/$i
123 done
126 if [ ! -d "$GSDIR/Library/Icons/" ]; then
127 echo "Creating icon library directory $GSDIR/Library/Icons"
128 if [ ! -d $GSDIR/Library ]; then
129 mkdir $GSDIR/Library
131 mkdir $GSDIR/Library/Icons
135 if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
136 echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
137 if [ ! -d $GSDIR/Library ]; then
138 mkdir $GSDIR/Library
140 mkdir $GSDIR/Library/WindowMaker
143 if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
144 echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
145 mkdir $GSDIR/Library/WindowMaker/Styles
146 else
147 echo "Styles directory already exists. Skipping..."
151 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
152 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
153 mkdir $GSDIR/Library/WindowMaker/Themes
154 else
155 echo "Themes directory already exists. Skipping..."
159 if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
160 echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
161 mkdir $GSDIR/Library/WindowMaker/Backgrounds
162 else
163 echo "Default Backgrounds directory already exists. Skipping..."
167 if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
168 echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
169 mkdir $GSDIR/Library/WindowMaker/IconSets
170 else
171 echo "Default IconSets directory already exists. Skipping..."
175 if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
176 echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
177 mkdir $GSDIR/Library/WindowMaker/Pixmaps
178 else
179 echo "Default Pixmaps directory already exists. Skipping..."
183 if [ ! -d "$GSDIR/Library/WindowMaker/Sounds" ]; then
184 echo "Creating sound library $GSDIR/Library/WindowMaker/Sounds"
185 mkdir $GSDIR/Library/WindowMaker/Sounds
186 else
187 echo "Default Sounds directory already exists. Skipping..."
191 if [ ! -d "$GSDIR/Library/WindowMaker/SoundSets" ]; then
192 echo "Creating sound set library $GSDIR/Library/WindowMaker/SoundSets"
193 mkdir $GSDIR/Library/WindowMaker/SoundSets
194 else
195 echo "Default SoundSets directory already exists. Skipping..."
199 echo "Copying default menu configuration files..."
200 FILES=`(cd $GLOBALDIR;ls -1 menu* plmenu wmmacros)`
201 all=""
202 for i in $FILES; do
203 if [ -f "$GSDIR/Library/WindowMaker/$i" ]; then
204 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
205 echo "Do you wish to replace it? <y/n/a> [n] $all"
206 if [ "$all" != "a" ]; then
207 read foo
208 if [ "$foo" = "a" -o "$foo" = "A" ]; then
209 all="a"
212 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
213 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
215 else
216 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
218 done
221 cp $GLOBALDIR/README $GSDIR/Library/WindowMaker
222 cp -i $GLOBALDIR/autostart.sh $GSDIR/Library/WindowMaker/autostart
223 chmod +rx $GSDIR/Library/WindowMaker/autostart
226 #######################
228 DATE=`date +%m%d%H%M`
230 show_end_message() {
232 echo
233 echo "Installation Finished"
234 echo
235 echo "There are menus in 2 different file formats. The plain text format and"
236 echo "the property list format. The plain text format is more flexible, but"
237 echo "the menu in the property list format can be edited graphically. The"
238 echo "menu that will be used by default is the plain text. Read"
239 echo "$GSDIR/Library/WindowMaker/README for information on how to change it."
244 trap "show_end_message;exit" 2
246 echo
247 echo "Now the .xinitrc, .Xclients or .xsession script must be updated so that"
248 echo "it calls wmaker when you start an X session."
249 echo "Type the name of the file that must be changed (normally .xinitrc)."
250 echo "If the file already exists, it will be backed up with a .old.$DATE extension"
251 echo "If you want to edit it by hand, hit <Control>-C now."
252 read file
254 if test "x$file" = "x"; then
255 echo "Using .xinitrc as a default value"
256 file=.xinitrc
259 if [ -f $USERDIR/$file ]; then
260 mv $USERDIR/$file $USERDIR/$file.old.$DATE
263 make_script $USERDIR/$file
265 show_end_message