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#"
35 # Copy files considering special cases
40 file="$(basename "$source")"
42 if [ "$file" = "WindowMaker" ]; then
43 sed -e "s|~/GNUstep|$GSDIR|g" "$source" > "$target"
45 if test "x$WMAKER_USER_ROOT" != "x"; then
46 sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
56 wmgenmenu
> $GSDIR/Defaults
/WMRootMenu
59 echo "Installing WindowMaker $VERSION for current user..."
62 if [ ! -d "$GLOBALDIR" ]; then
63 echo "Could not find global data files"
64 echo "Make sure you have installed Window Maker correctly"
68 if [ ! -d "$GLOBALDEFDIR" ]; then
69 echo "Could not find global configurations files"
70 echo "Make sure you have installed Window Maker correctly"
74 if [ ! -d "$USERDIR" ]; then
75 echo "Could not find user directory $USERDIR"
80 if test "x$WMAKER_USER_ROOT" = "x"; then
82 GSDIR
="$USERDIR/GNUstep"
83 if [ ! -d "$GSDIR" ]; then
84 echo "Creating $GSDIR user directory"
88 GSDIR
="$WMAKER_USER_ROOT"
89 if [ ! -d "$GSDIR" ]; then
90 # in this case, and in this case only, mkdir needs -p option
92 echo "Directory specified in WMAKER_USER_ROOT environment variable does not exist and could not be created"
95 chmod +rwx
$GSDIR ||
exit 1
102 if [ ! -d "$GSDIR/Defaults" ]; then
103 make_dir
"$GSDIR/Defaults"
106 echo "Copying defaults database..."
108 FILES
="$(cd "$GLOBALDEFDIR" && ls -d *)"
111 if [ ! -d "$GLOBALDEFDIR/$i" ]; then
112 if [ -f "$GSDIR/Defaults/$i" -a -z "$BATCH" ]; then
113 echo "The configuration file \"$i\" already exists in your defaults database."
114 echo "Do you wish to replace it? <y/n/a> [n] $all"
115 if [ "$all" != "a" ]; then
117 if [ "$foo" = "a" -o "$foo" = "A" ]; then
121 if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
122 copy
"$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
125 copy
"$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
132 if [ ! -d "$GSDIR/Library/Icons/" ]; then
133 echo "Creating icon library directory $GSDIR/Library/Icons"
134 if [ ! -d "$GSDIR/Library" ]; then
135 make_dir
"$GSDIR/Library"
137 make_dir
"$GSDIR/Library/Icons"
141 if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
142 echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
143 if [ ! -d "$GSDIR/Library" ]; then
144 make_dir
"$GSDIR/Library"
146 make_dir
"$GSDIR/Library/WindowMaker"
149 if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
150 echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
151 make_dir
"$GSDIR/Library/WindowMaker/Styles"
155 if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
156 echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
157 make_dir
"$GSDIR/Library/WindowMaker/Themes"
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"
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"
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"
181 echo "Default Pixmaps directory already exists. Skipping..."
185 if [ ! -d "$GSDIR/Library/WindowMaker/CachedPixmaps" ]; then
186 make_dir
"$GSDIR/Library/WindowMaker/CachedPixmaps"
189 if [ ! -d "$GSDIR/Library/WindowMaker/WPrefs" ]; then
190 make_dir
"$GSDIR/Library/WindowMaker/WPrefs"
193 if test -z "#LITE#" ; then
194 FILES
="$(cd "$GLOBALDIR" && ls menu menu.* plmenu plmenu.?? wmmacros)"
197 if [ -f "$GSDIR/Library/WindowMaker/$i" -a -z "$BATCH" ]; then
199 echo "The file \"$i\" already exists in $GSDIR/Library/WindowMaker"
200 echo "Do you wish to replace it? <y/n/a> [n] $all"
201 if [ "$all" != "a" ]; then
203 if [ "$foo" = "a" -o "$foo" = "A" ]; then
207 if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
208 copy
"$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
211 copy
"$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
216 cp "$GLOBALDIR/README.themes" "$GSDIR/Library/WindowMaker"
217 cp "$GLOBALDIR/README" "$GSDIR/Library/WindowMaker"
219 test -f "$GSDIR/Library/WindowMaker/autostart" || \
220 cp "$GLOBALDIR/autostart.sh" "$GSDIR/Library/WindowMaker/autostart"
221 chmod +rx
"$GSDIR/Library/WindowMaker/autostart"
223 test -f "$GSDIR/Library/WindowMaker/exitscript" || \
224 cp "$GLOBALDIR/exitscript.sh" "$GSDIR/Library/WindowMaker/exitscript"
225 chmod +rx
"$GSDIR/Library/WindowMaker/exitscript"
228 if test -n "$BATCH" ; then
229 echo "Installation Finished"
236 #######################
238 DATE
="$(date +%b%d.%T)"
243 echo "Installation Finished"
245 echo "There are menus in 2 different file formats. The plain text format and"
246 echo "the property list format. The plain text format is more flexible, but"
247 echo "the menu in the property list format can be edited graphically. The"
248 echo "menu that will be used by default is the property list one. Read"
249 echo " $GSDIR/Library/WindowMaker/README"
250 echo "for information on how to change it."
251 if [ "${inst_menu%.*}" = "menu" ]; then
252 echo "However, since you have locale set to $LOCALE and plmenu for such locale"
253 echo "was not found, your WMRootMenu contains path to text formated menu:"
254 echo " $GSDIR/Library/WindowMaker/$inst_menu"
259 for xinit
in .xinitrc .Xclients .xsession
; do
260 test ! -f "$HOME/$xinit" && continue
261 res
="$(grep wmaker "$HOME/$xinit")"
262 if test "x$res" != x
; then
267 if test "$wmaker_found" = 1; then
268 echo "Found Window Maker to already be your default window manager."
274 trap "show_end_message;exit" 2