My script does not work properly, what is wrong?
by lancsuk from LinuxQuestions.org on (#5EXD5)
Hiya,
I was stuggling to install Xmonad on Slackware current, to me the best way to install Xmonad on Slackware current I think is stack.
I wrote a small script to make it easier to install and it works almost perfect.
Code:#!/bin/bash
PRGNAM=xmonad
PRGNAM_HOME=$HOME/.$PRGNAM
LPATH=$HOME/.local/bin
CWD=$(pwd)
if [ ! -d $LPATH ]; then
mkdir -p $LPATH
echo 'export PATH=\$PATH:$LPATH >> $HOME/.bash_profile'
source $HOME/.bash_profile
fi
wget -qO- https://get.haskellstack.org/ | sh
stack setup
mkdir -p $PRGNAM_HOME
cd $PRGNAM_HOME
# from inside of $PRGNAM_HOME/
git clone "https://github.com/xmonad/xmonad" xmonad-git
git clone "https://github.com/xmonad/xmonad-contrib" xmonad-contrib-git
git clone "https://github.com/jaor/xmobar" xmobar-git
stack init
mv $PRGNAM_HOME/stack.yaml $PRGNAM_HOME/stack.yaml.orig
cp $CWD/stack.yaml $PRGNAM_HOME/stack.yaml || exit 1
# from inside of $PRGNAM_HOME
stack install
cp $CWD/build $PRGNAM_HOME/build || exit 1
chmod a+x $PRGNAM_HOME/build
cp $CWD/xmonad.hs $PRGNAM_HOME/ || exit 1
cp $CWD/xmobarrc ~/.xmobarrc || exit 1
cp $CWD/xinitrc.xmonad ~/.xinitrc || exit 1
cp -a $CWD/wallpaper ~/wallpaper || exit 1But the if then statement does not work properly in particular to source my .bash_profile file....
Code:if [ ! -d $LPATH ]; then
mkdir -p $LPATH
echo 'export PATH=\$PATH:$LPATH >> $HOME/.bash_profile'
source $HOME/.bash_profile
fi....to source my bash_profile manually works great, but I prefer a 100% automatically installation.
any suggestions?
thanks Frank


I was stuggling to install Xmonad on Slackware current, to me the best way to install Xmonad on Slackware current I think is stack.
I wrote a small script to make it easier to install and it works almost perfect.
Code:#!/bin/bash
PRGNAM=xmonad
PRGNAM_HOME=$HOME/.$PRGNAM
LPATH=$HOME/.local/bin
CWD=$(pwd)
if [ ! -d $LPATH ]; then
mkdir -p $LPATH
echo 'export PATH=\$PATH:$LPATH >> $HOME/.bash_profile'
source $HOME/.bash_profile
fi
wget -qO- https://get.haskellstack.org/ | sh
stack setup
mkdir -p $PRGNAM_HOME
cd $PRGNAM_HOME
# from inside of $PRGNAM_HOME/
git clone "https://github.com/xmonad/xmonad" xmonad-git
git clone "https://github.com/xmonad/xmonad-contrib" xmonad-contrib-git
git clone "https://github.com/jaor/xmobar" xmobar-git
stack init
mv $PRGNAM_HOME/stack.yaml $PRGNAM_HOME/stack.yaml.orig
cp $CWD/stack.yaml $PRGNAM_HOME/stack.yaml || exit 1
# from inside of $PRGNAM_HOME
stack install
cp $CWD/build $PRGNAM_HOME/build || exit 1
chmod a+x $PRGNAM_HOME/build
cp $CWD/xmonad.hs $PRGNAM_HOME/ || exit 1
cp $CWD/xmobarrc ~/.xmobarrc || exit 1
cp $CWD/xinitrc.xmonad ~/.xinitrc || exit 1
cp -a $CWD/wallpaper ~/wallpaper || exit 1But the if then statement does not work properly in particular to source my .bash_profile file....
Code:if [ ! -d $LPATH ]; then
mkdir -p $LPATH
echo 'export PATH=\$PATH:$LPATH >> $HOME/.bash_profile'
source $HOME/.bash_profile
fi....to source my bash_profile manually works great, but I prefer a 100% automatically installation.
any suggestions?
thanks Frank