mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-07 06:14:13 +01:00
wmaker.inst: quote shell variables
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
This commit is contained in:
committed by
Carlos R. Mafra
parent
ba5fceb21c
commit
51134d2438
@@ -20,21 +20,21 @@ LOCALE="${LC_ALL-${LC_MESSAGES-$LANG}}"
|
|||||||
GLOBALDIR="#pkgdatadir#"
|
GLOBALDIR="#pkgdatadir#"
|
||||||
GLOBALDEFDIR="#sysconfdir#"
|
GLOBALDEFDIR="#sysconfdir#"
|
||||||
|
|
||||||
USERDIR=$HOME
|
USERDIR="$HOME"
|
||||||
|
|
||||||
VERSION="#version#"
|
VERSION="#version#"
|
||||||
|
|
||||||
BINDIR="#bindir#"
|
BINDIR="#bindir#"
|
||||||
|
|
||||||
make_dir() {
|
make_dir() {
|
||||||
mkdir $1
|
mkdir "$1"
|
||||||
chmod +rwx $1
|
chmod +rwx "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
make_script() {
|
make_script() {
|
||||||
ISCRIPT=$1
|
ISCRIPT="$1"
|
||||||
|
|
||||||
cat << EOF >> $ISCRIPT
|
cat << EOF >> "$ISCRIPT"
|
||||||
# Window Maker default X session startup script
|
# Window Maker default X session startup script
|
||||||
|
|
||||||
PATH="\$PATH:$BINDIR"
|
PATH="\$PATH:$BINDIR"
|
||||||
@@ -42,12 +42,12 @@ PATH="\$PATH:$BINDIR"
|
|||||||
# If you login from xdm, uncomment this to make error messages appear
|
# If you login from xdm, uncomment this to make error messages appear
|
||||||
# in the console window.
|
# in the console window.
|
||||||
#
|
#
|
||||||
# tail -f $HOME/.xsession-errors > /dev/console &
|
# tail -f "$HOME"/.xsession-errors > /dev/console &
|
||||||
|
|
||||||
exec wmaker
|
exec wmaker
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
chmod +rx $ISCRIPT
|
chmod +rx "$ISCRIPT"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -55,38 +55,38 @@ EOF
|
|||||||
# Copy files considering special cases
|
# Copy files considering special cases
|
||||||
#
|
#
|
||||||
copy() {
|
copy() {
|
||||||
source=$1
|
source="$1"
|
||||||
target=$2
|
target="$2"
|
||||||
file=`basename $source`
|
file="$(basename "$source")"
|
||||||
rm -f $target
|
rm -f "$target"
|
||||||
if [ "$file" = "WindowMaker" ]; then
|
if [ "$file" = "WindowMaker" ]; then
|
||||||
sed -e "s|~/GNUstep|$GSDIR|g" $source > $target
|
sed -e "s|~/GNUstep|$GSDIR|g" "$source" > "$target"
|
||||||
elif [ "$file" = "WMRootMenu" ]; then
|
elif [ "$file" = "WMRootMenu" ]; then
|
||||||
if [ "$LOCALE" ]; then
|
if [ "$LOCALE" ]; then
|
||||||
if [ -f $GLOBALDIR/plmenu.$LOCALE ]; then
|
if [ -f "$GLOBALDIR/plmenu.$LOCALE" ]; then
|
||||||
source=$GLOBALDIR/plmenu.$LOCALE
|
source="$GLOBALDIR/plmenu.$LOCALE"
|
||||||
elif [ -f $GLOBALDIR/plmenu.${LOCALE%.*} ]; then
|
elif [ -f "$GLOBALDIR/plmenu.${LOCALE%.*}" ]; then
|
||||||
source=$GLOBALDIR/plmenu.${LOCALE%.*}
|
source="$GLOBALDIR/plmenu.${LOCALE%.*}"
|
||||||
elif [ -f $GLOBALDIR/plmenu.${LOCALE%_*} ]; then
|
elif [ -f "$GLOBALDIR/plmenu.${LOCALE%_*}" ]; then
|
||||||
source=$GLOBALDIR/plmenu.${LOCALE%_*}
|
source="$GLOBALDIR/plmenu.${LOCALE%_*}"
|
||||||
elif [ -f $GLOBALDIR/menu.${LOCALE%_*} ]; then
|
elif [ -f "$GLOBALDIR/menu.${LOCALE%_*}" ]; then
|
||||||
source=$GLOBALDIR/menu.${LOCALE%_*}
|
source="$GLOBALDIR/menu.${LOCALE%_*}"
|
||||||
else
|
else
|
||||||
source=$GLOBALDIR/plmenu
|
source="$GLOBALDIR/plmenu"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
source=$GLOBALDIR/plmenu
|
source="$GLOBALDIR/plmenu"
|
||||||
fi
|
fi
|
||||||
sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
|
sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
|
||||||
$source > $GSDIR/Defaults/WMRootMenu
|
"$source" > "$GSDIR/Defaults/WMRootMenu"
|
||||||
else
|
else
|
||||||
if test "x$GNUSTEP_USER_ROOT" = "x"; then
|
if test "x$GNUSTEP_USER_ROOT" = "x"; then
|
||||||
sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
|
sed -e "s:#wmdatadir#:$GLOBALDIR:g" \
|
||||||
$source > $target
|
"$source" > "$target"
|
||||||
else
|
else
|
||||||
sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
|
sed -e "s|\$HOME/GNUstep|$GSDIR|g" \
|
||||||
-e "s:#wmdatadir#:$GLOBALDIR:g" \
|
-e "s:#wmdatadir#:$GLOBALDIR:g" \
|
||||||
$source > $target
|
"$source" > "$target"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -96,13 +96,13 @@ copy() {
|
|||||||
echo "Installing WindowMaker $VERSION for current user..."
|
echo "Installing WindowMaker $VERSION for current user..."
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d $GLOBALDIR ]; then
|
if [ ! -d "$GLOBALDIR" ]; then
|
||||||
echo "Could not find global data files"
|
echo "Could not find global data files"
|
||||||
echo "Make sure you have installed Window Maker correctly"
|
echo "Make sure you have installed Window Maker correctly"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $GLOBALDEFDIR ]; then
|
if [ ! -d "$GLOBALDEFDIR" ]; then
|
||||||
echo "Could not find global configurations files"
|
echo "Could not find global configurations files"
|
||||||
echo "Make sure you have installed Window Maker correctly"
|
echo "Make sure you have installed Window Maker correctly"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -115,34 +115,34 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if test "x$GNUSTEP_USER_ROOT" = "x"; then
|
if test "x$GNUSTEP_USER_ROOT" = "x"; then
|
||||||
cd $USERDIR
|
cd "$USERDIR"
|
||||||
GSDIR=$USERDIR/GNUstep
|
GSDIR="$USERDIR/GNUstep"
|
||||||
if [ ! -d $GSDIR ]; then
|
if [ ! -d "$GSDIR" ]; then
|
||||||
echo "Creating $GSDIR user directory"
|
echo "Creating $GSDIR user directory"
|
||||||
make_dir $GSDIR
|
make_dir "$GSDIR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
GSDIR=$GNUSTEP_USER_ROOT
|
GSDIR="$GNUSTEP_USER_ROOT"
|
||||||
if [ ! -d $GSDIR ]; then
|
if [ ! -d "$GSDIR" ]; then
|
||||||
echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
|
echo "Directory specified in GNUSTEP_USER_ROOT environment variable does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd $GSDIR
|
cd "$GSDIR"
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Defaults" ]; then
|
if [ ! -d "$GSDIR/Defaults" ]; then
|
||||||
make_dir $GSDIR/Defaults
|
make_dir "$GSDIR/Defaults"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Copying defaults database..."
|
echo "Copying defaults database..."
|
||||||
|
|
||||||
FILES=`(cd $GLOBALDEFDIR;ls -d *)`
|
FILES="$(cd "$GLOBALDEFDIR" && ls -d *)"
|
||||||
all=""
|
all=""
|
||||||
for i in $FILES; do
|
for i in $FILES; do
|
||||||
if [ ! -d $GLOBALDEFDIR/$i ]; then
|
if [ ! -d "$GLOBALDEFDIR/$i" ]; then
|
||||||
if [ -f $GSDIR/Defaults/$i -a -z "$BATCH" ]; then
|
if [ -f "$GSDIR/Defaults/$i" -a -z "$BATCH" ]; then
|
||||||
echo "The configuration file \"$i\" already exists in your defaults database."
|
echo "The configuration file \"$i\" already exists in your defaults database."
|
||||||
echo "Do you wish to replace it? <y/n/a> [n] $all"
|
echo "Do you wish to replace it? <y/n/a> [n] $all"
|
||||||
if [ "$all" != "a" ]; then
|
if [ "$all" != "a" ]; then
|
||||||
@@ -152,10 +152,10 @@ for i in $FILES; do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
|
if [ "$foo" = "y" -o "$foo" = "Y" -o "$all" = "a" ]; then
|
||||||
copy $GLOBALDEFDIR/$i $GSDIR/Defaults/$i
|
copy "$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
copy $GLOBALDEFDIR/$i $GSDIR/Defaults/$i
|
copy "$GLOBALDEFDIR/$i" "$GSDIR/Defaults/$i"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -163,36 +163,36 @@ done
|
|||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/Icons/" ]; then
|
if [ ! -d "$GSDIR/Library/Icons/" ]; then
|
||||||
echo "Creating icon library directory $GSDIR/Library/Icons"
|
echo "Creating icon library directory $GSDIR/Library/Icons"
|
||||||
if [ ! -d $GSDIR/Library ]; then
|
if [ ! -d "$GSDIR/Library" ]; then
|
||||||
make_dir $GSDIR/Library
|
make_dir "$GSDIR/Library"
|
||||||
fi
|
fi
|
||||||
make_dir $GSDIR/Library/Icons
|
make_dir "$GSDIR/Library/Icons"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/" ]; then
|
||||||
echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
|
echo "Creating WindowMaker data library directory $GSDIR/Library/WindowMaker"
|
||||||
if [ ! -d $GSDIR/Library ]; then
|
if [ ! -d "$GSDIR/Library" ]; then
|
||||||
make_dir $GSDIR/Library
|
make_dir "$GSDIR/Library"
|
||||||
fi
|
fi
|
||||||
make_dir $GSDIR/Library/WindowMaker
|
make_dir "$GSDIR/Library/WindowMaker"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/Styles" ]; then
|
||||||
echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
|
echo "Creating style library $GSDIR/Library/WindowMaker/Styles"
|
||||||
make_dir $GSDIR/Library/WindowMaker/Styles
|
make_dir "$GSDIR/Library/WindowMaker/Styles"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/Themes" ]; then
|
||||||
echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
|
echo "Creating theme library $GSDIR/Library/WindowMaker/Themes"
|
||||||
make_dir $GSDIR/Library/WindowMaker/Themes
|
make_dir "$GSDIR/Library/WindowMaker/Themes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/Backgrounds" ]; then
|
||||||
echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
|
echo "Creating bg image library $GSDIR/Library/WindowMaker/Backgrounds"
|
||||||
make_dir $GSDIR/Library/WindowMaker/Backgrounds
|
make_dir "$GSDIR/Library/WindowMaker/Backgrounds"
|
||||||
else
|
else
|
||||||
echo "Default Backgrounds directory already exists. Skipping..."
|
echo "Default Backgrounds directory already exists. Skipping..."
|
||||||
fi
|
fi
|
||||||
@@ -200,7 +200,7 @@ fi
|
|||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/IconSets" ]; then
|
||||||
echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
|
echo "Creating icon setup library $GSDIR/Library/WindowMaker/IconSets"
|
||||||
make_dir $GSDIR/Library/WindowMaker/IconSets
|
make_dir "$GSDIR/Library/WindowMaker/IconSets"
|
||||||
else
|
else
|
||||||
echo "Default IconSets directory already exists. Skipping..."
|
echo "Default IconSets directory already exists. Skipping..."
|
||||||
fi
|
fi
|
||||||
@@ -208,22 +208,22 @@ fi
|
|||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/Pixmaps" ]; then
|
||||||
echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
|
echo "Creating pixmap library $GSDIR/Library/WindowMaker/Pixmaps"
|
||||||
make_dir $GSDIR/Library/WindowMaker/Pixmaps
|
make_dir "$GSDIR/Library/WindowMaker/Pixmaps"
|
||||||
else
|
else
|
||||||
echo "Default Pixmaps directory already exists. Skipping..."
|
echo "Default Pixmaps directory already exists. Skipping..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/CachedPixmaps" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/CachedPixmaps" ]; then
|
||||||
make_dir $GSDIR/Library/WindowMaker/CachedPixmaps
|
make_dir "$GSDIR/Library/WindowMaker/CachedPixmaps"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$GSDIR/Library/WindowMaker/WPrefs" ]; then
|
if [ ! -d "$GSDIR/Library/WindowMaker/WPrefs" ]; then
|
||||||
make_dir $GSDIR/Library/WindowMaker/WPrefs
|
make_dir "$GSDIR/Library/WindowMaker/WPrefs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "#LITE#" ; then
|
if test -z "#LITE#" ; then
|
||||||
FILES=`(cd $GLOBALDIR; ls menu menu.* plmenu plmenu.?? wmmacros)`
|
FILES="$(cd "$GLOBALDIR" && ls menu menu.* plmenu plmenu.?? wmmacros)"
|
||||||
for i in $FILES; do
|
for i in $FILES; do
|
||||||
# xx herbert
|
# xx herbert
|
||||||
if [ -f "$GSDIR/Library/WindowMaker/$i" -a -z "$BATCH" ]; then
|
if [ -f "$GSDIR/Library/WindowMaker/$i" -a -z "$BATCH" ]; then
|
||||||
@@ -237,24 +237,24 @@ for i in $FILES; do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
|
if [ "$foo" = "y" -o "$foo" = "Y" -o "$foo" = "a" ]; then
|
||||||
copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
|
copy "$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
copy $GLOBALDIR/$i $GSDIR/Library/WindowMaker/$i
|
copy "$GLOBALDIR/$i" "$GSDIR/Library/WindowMaker/$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp $GLOBALDIR/README.themes $GSDIR/Library/WindowMaker
|
cp "$GLOBALDIR/README.themes" "$GSDIR/Library/WindowMaker"
|
||||||
cp $GLOBALDIR/README $GSDIR/Library/WindowMaker
|
cp "$GLOBALDIR/README" "$GSDIR/Library/WindowMaker"
|
||||||
|
|
||||||
test -f ~$GSDIR/Library/WindowMaker/autostart || \
|
test -f "$GSDIR/Library/WindowMaker/autostart" || \
|
||||||
cp $GLOBALDIR/autostart.sh $GSDIR/Library/WindowMaker/autostart
|
cp "$GLOBALDIR/autostart.sh" "$GSDIR/Library/WindowMaker/autostart"
|
||||||
chmod +rx $GSDIR/Library/WindowMaker/autostart
|
chmod +rx "$GSDIR/Library/WindowMaker/autostart"
|
||||||
|
|
||||||
test -f ~$GSDIR/Library/WindowMaker/exitscript || \
|
test -f "$GSDIR/Library/WindowMaker/exitscript" || \
|
||||||
cp $GLOBALDIR/exitscript.sh $GSDIR/Library/WindowMaker/exitscript
|
cp "$GLOBALDIR/exitscript.sh" "$GSDIR/Library/WindowMaker/exitscript"
|
||||||
chmod +rx $GSDIR/Library/WindowMaker/exitscript
|
chmod +rx "$GSDIR/Library/WindowMaker/exitscript"
|
||||||
|
|
||||||
# xx herbert
|
# xx herbert
|
||||||
if test -n "$BATCH" ; then
|
if test -n "$BATCH" ; then
|
||||||
@@ -267,7 +267,7 @@ fi
|
|||||||
#
|
#
|
||||||
#######################
|
#######################
|
||||||
|
|
||||||
DATE=`date +%b%d.%T`
|
DATE="$(date +%b%d.%T)"
|
||||||
|
|
||||||
show_end_message() {
|
show_end_message() {
|
||||||
|
|
||||||
@@ -295,13 +295,13 @@ fi
|
|||||||
wmaker_found=0
|
wmaker_found=0
|
||||||
for xinit in .xinitrc .Xclients .xsession; do
|
for xinit in .xinitrc .Xclients .xsession; do
|
||||||
test ! -f "$HOME/$xinit" && continue
|
test ! -f "$HOME/$xinit" && continue
|
||||||
res="`grep wmaker $HOME/$xinit`"
|
res="$(grep wmaker "$HOME/$xinit")"
|
||||||
if test "x$res" != x; then
|
if test "x$res" != x; then
|
||||||
wmaker_found=1
|
wmaker_found=1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if test $wmaker_found = 1; then
|
if test "$wmaker_found" = 1; then
|
||||||
echo "Found Window Maker to already be your default window manager."
|
echo "Found Window Maker to already be your default window manager."
|
||||||
show_end_message
|
show_end_message
|
||||||
exit 0
|
exit 0
|
||||||
@@ -324,11 +324,10 @@ if test "x$file" = "x"; then
|
|||||||
file=.xinitrc
|
file=.xinitrc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $USERDIR/$file ]; then
|
if [ -f "$USERDIR/$file" ]; then
|
||||||
mv $USERDIR/$file $USERDIR/$file.old.$DATE
|
mv "$USERDIR/$file" "$USERDIR/$file.old.$DATE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make_script $USERDIR/$file
|
make_script "$USERDIR/$file"
|
||||||
|
|
||||||
show_end_message
|
show_end_message
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user