Made the install script actually work.

It installs dwmbar to /usr/bin and skeleton stuff to /usr/share/dwmbar
This commit is contained in:
Archie Hilton (thytom) 2019-10-22 23:02:57 +01:00
parent 16ea007427
commit 6de7a8e0a7
2 changed files with 26 additions and 20 deletions

21
dwmbar
View file

@ -2,17 +2,26 @@
VERSION="0.0.1"
RC_LOCATION="/home/$USER/.config/dwmbar/dwmbarrc"
if [[ -f $DEFAULT_RC_LOCATION ]]; then
>&2 echo "No dwmbarrc found."
exit 1
fi
CONFIG_DIR="/home/$USER/.config/dwmbar"
MODULES_DIR="$CONFIG_DIR/modules"
CUSTOM_DIR="$MODULES_DIR/custom"
DWMBARRC="$CONFIG_DIR/dwmbarrc"
CACHE_DIR="$CONFIG_DIR/.cache"
print_help(){
echo "dwmbar $VERSION"
}
install_files(){
[[ ! -d $CONFIG_DIR ]] && cp -r /usr/share/dwmbar $CONFIG_DIR
[[ ! -f $DWMBARRC ]] && cp /usr/share/dwmbar/dwmbarrc $DWMBARRC
[[ ! -d $MODULES_DIR ]] && cp /usr/share/dwmbar/modules $MODULES_DIR
[[ ! -d $CUSTOM_DIR ]] && mkdir $CUSTOM_DIR
[[ ! -d $CACHE_DIR ]] && mkdir $CACHE_DIR
}
install_files
while :; do
xsetroot -name "$(exec $RC_LOCATION)"
done

View file

@ -1,9 +1,5 @@
#!/bin/bash
CONFIG_DIR="/home/$USER/.config/dwmbar"
MODULES_DIR="$CONFIG_DIR/modules"
CUSTOM_DIR="$MODULES_DIR/custom"
DWMBARRC="$CONFIG_DIR/dwmbarrc"
DWMBAR="/usr/bin/dwmbar"
if [ "$EUID" -ne 0 ]
@ -15,13 +11,14 @@ if [[ ! -f "dwmbar" ]]; then
echo "dwmbar executable not found."
fi
# Create /usr/share/dwmbar
# Containing example dwmbarrc and modules
mkdir --parents "/usr/share/dwmbar/"
cp -r "./modules" "/usr/share/dwmbar/modules"
cp -r "./dwmbarrc" "/usr/share/dwmbar/dwmbarrc"
echo "./dwmbar --> /usr/bin/dwmbar"
cp "./dwmbar" "/usr/bin/dwmbar"
mkdir -p "$CUSTOM_DIR"
for script in $(ls modules); do
echo "modules/$script -> $MODULES_DIR/$script"
cp "modules/$script" "$MODULES_DIR/$script"
done
[[ ! -f "$DWMBARRC" ]] && cp "./dwmbarrc" "$DWMBARRC"
[[ $? -eq 0 ]] && echo "Installation completed successfully"