-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·73 lines (59 loc) · 1.74 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
FORCE_UPDATE=false
THEME=""
while getopts ":f" opt; do
case ${opt} in
f)
FORCE_UPDATE=true
;;
\? )
echo "invalid option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND -1))
THEME="$1"
if [ -z "$THEME" ]; then
echo "error: theme argument is required."
exit 1
fi
if [ ! -f "./$THEME" ]; then
echo "error: theme '$THEME' does not exist."
exit 1
fi
echo "FORCE_UPDATE: $FORCE_UPDATE"
echo "THEME: $THEME"
#############
BASEDIR=$(dirname "$0")
cd $BASEDIR
echo "[build]# synchronizing configuration files..."
cp ./configuration/bashrc ~/.bashrc
source ~/.bashrc
cp -r ./configuration/nvim/* ~/.config/nvim/
cp ./configuration/picom.conf ~/.config/picom/picom.conf
echo "[build]# synchronized configuration files"
update_suckless_tool()
{
NAME=$1
SRC=$2
DEST=$3
echo "[build]# updating $NAME..."
if ! cmp --silent -- "$SRC" "$DEST" || ! cmp --silent -- "$THEME" "$(dirname $DEST)/theme.h" || $FORCE_UPDATE; then
cp $SRC $DEST
cp $THEME "$(dirname $DEST)/theme.h"
cd $(dirname $DEST)
sudo make install -s
cd ../../
else
echo "[build]# $NAME is already up to date"
fi
}
echo "[build]# updating system software..."
update_suckless_tool "window-manager (dwm6.2)" "./configuration/dwm6.2-config.h" "./sucklesstools/dwm-6.2/config.h"
update_suckless_tool "terminal (st)" "./configuration/st-config.h" "./sucklesstools/st/config.h"
update_suckless_tool "status-bar (slstatus)" "./configuration/slstatus-config.h" "./sucklesstools/slstatus/config.h"
update_suckless_tool "system-interface (dmenu)" "./configuration/dmenu-config.h" "./sucklesstools/dmenu/config.h"
cd scripts
sudo ./setup 2> /dev/null
echo "[build]# system software updated"