3 # Install Window Maker for the current user
7 if test "x$1" = "x--batch" ; then
14 # name of menu file we install (menu, plmenu)
17 LOCALE
="${LC_ALL-${LC_MESSAGES-$LANG}}"
19 # directory where system wide configuration is stored
20 GLOBALDIR
="#pkgdatadir#"
21 GLOBALDEFDIR
="#sysconfdir#"
37 cat << EOF >> "$ISCRIPT"
38 # Window Maker default X session startup script
42 # If you login from xdm, uncomment this to make error messages appear
43 # in the console window.
45 # tail -f "$HOME"/.xsession-errors > /dev/console &
55 # Copy files considering special cases
60 file="$(basename "$source")"
62 if [ "$file" = "WindowMaker" ]; then
63 sed -e "s|~/GNUstep|$GSDIR|g" "$source" > "$target"
65 if test "x$GNUSTEP_USER_ROOT" = "x"; then
66 sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
69 sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
70 -e "s:#wmdatadir#:$GLOBALDIR:g" \
80 wmgenmenu
> $GSDIR/Defaults
/WMRootMenu
83 echo "Installing WindowMaker $VERSION for current user..."
86 if [ ! -d "$GLOBALDIR" ]; then
87 echo "Could not find global data files"
88 echo "Make sure you have installed Window Maker correctly"
92 if [ ! -d "$GLOBALDEFDIR" ]; then
93 echo "Could not find global configurations files"
94 echo "Make sure you have installed Window Maker correctly"
98 if [ ! -d "$USERDIR" ]; then
99 echo "Could not find user directory $USERDIR"
104 if test "x$GNUSTEP_USER_ROOT" = "x"; then
106 GSDIR
="$USERDIR/GNUstep"
107 if [ ! -d "$GSDIR" ]; then
108 echo "Creating $GSDIR user directory"
112 GSDIR
="$GNUSTEP_USER_ROOT"
113 if [ ! -d "$GSDIR" ]; then
114 echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
122 if [ ! -d "$GSDIR/Defaults" ]; then
123 make_dir
"$GSDIR/Defaults"
126 echo "Copying defaults database..."
128 FILES
="$(cd "$GLOBALDEFDIR" && ls -d *)"
131 if [ ! -d "$GLOBALDEFDIR/$i" ]; then
132 if [ -f "$GSDIR/Defaults/$i" -a -z "$BATCH" ]; then
133 echo "The configuration file \"$i\" already exists in your defaults database."
134 echo "Do you wish to replace it? <y/n/a> [n] $all"
135 if [ "$all" != "a" ]; then
137 if [ "$foo" = "a" -o "$foo" = "A" ]; then
141 if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
142 copy
"$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
145 copy
"$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
152 if [ ! -d "$GSDIR/Library/Icons/" ]; then
153 echo "Creating icon library directory $GSDIR/Library/Icons"
154 if [ ! -d "$GSDIR/Library" ]; then
155 make_dir
"$GSDIR/Library"
157 make_dir
"$GSDIR/Library/Icons"
161 if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
162 echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
163 if [ ! -d "$GSDIR/Library" ]; then
164 make_dir
"$GSDIR/Library"
166 make_dir
"$GSDIR/Library/WindowMaker"
169 if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
170 echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
171 make_dir
"$GSDIR/Library/WindowMaker/Styles"
175 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
176 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
177 make_dir
"$GSDIR/Library/WindowMaker/Themes"
181 if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
182 echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
183 make_dir
"$GSDIR/Library/WindowMaker/Backgrounds"
185 echo "Default Backgrounds directory already exists. Skipping..."
189 if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
190 echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
191 make_dir
"$GSDIR/Library/WindowMaker/IconSets"
193 echo "Default IconSets directory already exists. Skipping..."
197 if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
198 echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
199 make_dir
"$GSDIR/Library/WindowMaker/Pixmaps"
201 echo "Default Pixmaps directory already exists. Skipping..."
205 if [ ! -d "$GSDIR/Library/WindowMaker/CachedPixmaps" ]; then
206 make_dir
"$GSDIR/Library/WindowMaker/CachedPixmaps"
209 if [ ! -d "$GSDIR/Library/WindowMaker/WPrefs" ]; then
210 make_dir
"$GSDIR/Library/WindowMaker/WPrefs"
213 if test -z "#LITE#" ; then
214 FILES
="$(cd "$GLOBALDIR" && ls menu menu.* plmenu plmenu.?? wmmacros)"
217 if [ -f "$GSDIR/Library/WindowMaker/$i" -a -z "$BATCH" ]; then
219 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
220 echo "Do you wish to replace it? <y/n/a> [n] $all"
221 if [ "$all" != "a" ]; then
223 if [ "$foo" = "a" -o "$foo" = "A" ]; then
227 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
228 copy
"$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
231 copy
"$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
236 cp "$GLOBALDIR/README.themes" "$GSDIR/Library/WindowMaker"
237 cp "$GLOBALDIR/README" "$GSDIR/Library/WindowMaker"
239 test -f "$GSDIR/Library/WindowMaker/autostart" || \
240 cp "$GLOBALDIR/autostart.sh" "$GSDIR/Library/WindowMaker/autostart"
241 chmod +rx
"$GSDIR/Library/WindowMaker/autostart"
243 test -f "$GSDIR/Library/WindowMaker/exitscript" || \
244 cp "$GLOBALDIR/exitscript.sh" "$GSDIR/Library/WindowMaker/exitscript"
245 chmod +rx
"$GSDIR/Library/WindowMaker/exitscript"
248 if test -n "$BATCH" ; then
249 echo "Installation Finished"
256 #######################
258 DATE
="$(date +%b%d.%T)"
263 echo "Installation Finished"
265 echo "There are menus in 2 different file formats. The plain text format and"
266 echo "the property list format. The plain text format is more flexible, but"
267 echo "the menu in the property list format can be edited graphically. The"
268 echo "menu that will be used by default is the property list one. Read"
269 echo " $GSDIR/Library/WindowMaker/README"
270 echo "for information on how to change it."
271 if [ "${inst_menu%.*}" = "menu" ]; then
272 echo "However, since you have locale set to $LOCALE and plmenu for such locale"
273 echo "was not found, your WMRootMenu contains path to text formated menu:"
274 echo " $GSDIR/Library/WindowMaker/$inst_menu"
279 for xinit
in .xinitrc .Xclients .xsession
; do
280 test ! -f "$HOME/$xinit" && continue
281 res
="$(grep wmaker "$HOME/$xinit")"
282 if test "x$res" != x
; then
287 if test "$wmaker_found" = 1; then
288 echo "Found Window Maker to already be your default window manager."
294 trap "show_end_message;exit" 2
297 echo "Now the .xinitrc, .Xclients or .xsession script must be updated so that"
298 echo "it calls wmaker when you start an X session."
299 echo "Type the name of the file that must be changed (normally .xinitrc)."
300 echo "If the file already exists, it will be backed up with a .old.$DATE "
302 echo "If you want to edit it by hand, hit <Control>-C now."
305 if test "x$file" = "x"; then
306 echo "Using .xinitrc as a default value"
310 if [ -f "$USERDIR/$file" ]; then
311 mv "$USERDIR/$file" "$USERDIR/$file.old.$DATE"
314 make_script
"$USERDIR/$file"