added dependency check to install.sh

This commit is contained in:
Surferlul 2021-08-25 07:09:19 +02:00
parent 50944b1137
commit c64131859b

View File

@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env sh
deps="7z git tar curl"
for i in $deps; do
if [ -z "$(command -v $i)" ] ; then
echo "Dependency $i NOT met!"
exit
fi
done
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
CACHE_DIR="/tmp/surferlul_awesome" CACHE_DIR="/tmp/surferlul_awesome"
[ -d "$CACHE_DIR" ] && echo "Removing previous cache" && rm -rf /tmp/surferlul_awesome [ -d "$CACHE_DIR" ] && echo "Removing previous cache" && rm -rf /tmp/surferlul_awesome
@ -10,6 +17,6 @@ echo "Downloading Vicious widgets for AwesomeWM"
git clone https://github.com/vicious-widgets/vicious.git $CACHE_DIR/vicious git clone https://github.com/vicious-widgets/vicious.git $CACHE_DIR/vicious
echo "Moving configs to install location" echo "Moving configs to install location"
mv $CACHE_DIR $HOME/.config/awesome mv $CACHE_DIR $HOME/.config/awesome
[ "$1" != "--preserve-git" ] && rm -rf $HOME/.config/awesome/.git [ "$1" != "--preserve-git" ] && echo "Removing git from configs" && rm -rf $HOME/.config/awesome/.git
[ ! -d "$HOME/.fonts" ] && echo "Creating ~/.fonts directory" && mkdir $HOME/.fonts [ ! -d "$HOME/.fonts" ] && echo "Creating ~/.fonts directory" && mkdir $HOME/.fonts
[ -z "$(ls $HOME/.fonts | grep '[Ii]ndie.*[Ff]lower')" ] && echo "Indie Flower doesn't exist, installing" && mkdir $CACHE_DIR && curl 'https://google-webfonts-helper.herokuapp.com/api/fonts/indie-flower?download=zip&subsets=latin&variants=regular' > $CACHE_DIR/IndieFlower.zip && 7z e -y $CACHE_DIR/IndieFlower.zip -o$CACHE_DIR/ && cp $CACHE_DIR/*.ttf $HOME/.fonts && rm -rf $CACHE_DIR [ -z "$(ls $HOME/.fonts | grep '[Ii]ndie.*[Ff]lower')" ] && echo "Indie Flower doesn't exist, installing" && mkdir $CACHE_DIR && curl 'https://google-webfonts-helper.herokuapp.com/api/fonts/indie-flower?download=zip&subsets=latin&variants=regular' > $CACHE_DIR/IndieFlower.zip && 7z e -y $CACHE_DIR/IndieFlower.zip -o$CACHE_DIR/ && cp $CACHE_DIR/*.ttf $HOME/.fonts && rm -rf $CACHE_DIR