blob: 06cf145729152f3e107bc8ba677b10bb2815a65e (
plain)
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
|
#!/bin/sh
printusage() { echo "Usage: $0 [-b,--build] [<repo> ...] (repos: all,`echo $repos | tr ' ' ','`)" && exit; }
repos=$repos"blr dmenu dotconfig scripts st timmywm" #repos=$repos"dotconfig|dwmpatches|scripts|st|timmywm"
[ -z $1 ] || [ `echo "$@" | tr ' ' '\n' | grep -v -c '\-'` = 0 ] && printusage
# Colors
BOLD="\033[1m"
NORM="\033[0m"
CYN="\033[0;36m"
RED="\033[0;31m"
GRN="\033[0;32m"
MAG="\033[0;35m"
printsyncmsg() { echo "$CYN[Pulling repo '$arg'...]$NORM"; }
printsuccess() { echo "$BOLD$GRN[Successfully pulled repo '$arg']$NORM"; }
printerror() { echo "$BOLD$RED[Failed to pull repo '$arg']$NORM"; }
#change colors
printmakemsg() { echo "$MAG[Building repo '$arg'...]$NORM"; }
printmakesuccess() { echo "$BOLD$GRN[Successfully built repo '$arg']$NORM"; }
printmakeerror() { echo "$BOLD$RED[Failed to build repo '$arg']$NORM"; }
pullrepo() {
printsyncmsg
cd $1 && git pull --verbose \
&& printsuccess || printerror
}
makerepo() {
if echo "$opts" | grep '\-b'; then
printmakemsg
doas make clean install \
&& printmakesuccess || printmakeerror
fi
}
makeautoconf() { make autoconfig && echo "$BOLD$GRN[Automatically configured '$repo']$NORM"; }
pullblr() { pullrepo ~/.local/src/programs/blr; }
pulldmenu() { pullrepo ~/.local/src/programs/dmenu && makeautoconf && makerepo; }
pulldotconfig() { pullrepo ~/.config; }
pullscripts() { pullrepo ~/.local/bin; }
pullst() { pullrepo ~/.local/src/programs/st && makeautoconf && makerepo; }
pulltimmywm() { pullrepo ~/.local/src/programs/timmywm && makeautoconf && makerepo; }
for arg in "$@"; do
case $arg in
-b|--build) opts="$opts-b" ;;
all) $0 $opts $repos ;;
*) # Would like to use something like $repos) here but cant
for repo in $repos; do
[ "$arg" = "$repo" ] && pull$arg && break
done || printusage
;;
esac
done
|