Code update for Window Maker version 0.50.0
[wmaker-crm.git] / util / wmaker.inst.in
blobd4cedf435ba0b1eaacbb9d23dbf0eeac4664e3df
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 mkdir $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
151 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
152 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
153 make_dir $GSDIR/Library/WindowMaker/Themes
158 if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
159 echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
160 make_dir $GSDIR/Library/WindowMaker/Backgrounds
161 else
162 echo "Default Backgrounds directory already exists. Skipping..."
166 if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
167 echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
168 make_dir $GSDIR/Library/WindowMaker/IconSets
169 else
170 echo "Default IconSets directory already exists. Skipping..."
174 if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
175 echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
176 make_dir $GSDIR/Library/WindowMaker/Pixmaps
177 else
178 echo "Default Pixmaps directory already exists. Skipping..."
182 if [ ! -d "$GSDIR/Library/WindowMaker/Sounds" ]; then
183 echo "Creating sound library $GSDIR/Library/WindowMaker/Sounds"
184 make_dir $GSDIR/Library/WindowMaker/Sounds
185 else
186 echo "Default Sounds directory already exists. Skipping..."
190 if [ ! -d "$GSDIR/Library/WindowMaker/SoundSets" ]; then
191 echo "Creating sound set library $GSDIR/Library/WindowMaker/SoundSets"
192 make_dir $GSDIR/Library/WindowMaker/SoundSets
193 else
194 echo "Default SoundSets directory already exists. Skipping..."
198 if test -z #LITE# ; then
199 for i in $FILES; do
200 if [ -f "$GSDIR/Library/WindowMaker/$i" ]; then
201 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
202 echo "Do you wish to replace it? <y/n/a> [n] $all"
203 if [ "$all" != "a" ]; then
204 read foo
205 if [ "$foo" = "a" -o "$foo" = "A" ]; then
206 all="a"
209 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
210 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
212 else
213 copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
215 done
218 cp $GLOBALDIR/README $GSDIR/Library/WindowMaker
219 cp -i $GLOBALDIR/autostart.sh $GSDIR/Library/WindowMaker/autostart
220 chmod +rx $GSDIR/Library/WindowMaker/autostart
223 #######################
225 DATE=`date +%m%d%H%M`
227 show_end_message() {
229 echo
230 echo "Installation Finished"
231 echo
232 if test -z #LITE# ; then
233 echo "There are menus in 2 different file formats. The plain text format and"
234 echo "the property list format. The plain text format is more flexible, but"
235 echo "the menu in the property list format can be edited graphically. The"
236 echo "menu that will be used by default is the plain text. Read"
237 echo "$GSDIR/Library/WindowMaker/README for information on how to change it."
238 else
239 echo "Your copy of Window Maker is configured especially for KDE."
240 echo "Window Maker application menus are not available."
244 if test -z `grep wmaker ~/.xinitrc`; then
245 show_end_message
246 exit 0
249 trap "show_end_message;exit" 2
251 echo
252 echo "Now the .xinitrc, .Xclients or .xsession script must be updated so that"
253 echo "it calls wmaker when you start an X session."
254 echo "Type the name of the file that must be changed (normally .xinitrc)."
255 echo "If the file already exists, it will be backed up with a .old.$DATE extension"
256 echo "If you want to edit it by hand, hit <Control>-C now."
257 read file
259 if test "x$file" = "x"; then
260 echo "Using .xinitrc as a default value"
261 file=.xinitrc
264 if [ -f $USERDIR/$file ]; then
265 mv $USERDIR/$file $USERDIR/$file.old.$DATE
268 make_script $USERDIR/$file
270 show_end_message