-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·74 lines (69 loc) · 1.48 KB
/
install.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
74
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
install() {
OS=$(uname)
for dir in */; do
dir="${dir%/*}"
dirname="${dir##*/}"
# skip OS specific stuff
if [[ "${dirname}" =~ ^macos ]] && [[ $OS != "Darwin" ]]; then
echo "Skipping ${dirname}" >&2
continue
fi
if [[ "${dirname}" =~ ^linux ]] && [[ $OS != "Linux" ]]; then
echo "Skipping ${dirname}" >&2
continue
fi
# blacklisting packages by suffixing with .disabled
if [[ "$dirname" =~ \.disabled$ ]]; then
echo "Skipping ${dirname}" >&2
continue
fi
echo "Installing ${dirname}" >&2
stow -R -v --no-folding --target "$HOME" "${dir%*/}"
done
}
add_color() {
awk '
BEGIN{
bold="\033[1m"
underline="\033[4m"
red="\033[31m"
green="\033[32m"
yellow="\033[33m"
blue="\033[34m"
magenta="\033[35m"
clear="\033[0m"
}
/^Installing/{
print green bold underline $0 clear
next
}
/^Skipping/{
print yellow bold underline $0 clear
next
}
/^UNLINK:/{
first=$1
$1=""
print yellow first clear $0
next
}
/^LINK:/{
first=$1
$1=""
print green first clear $0
next
}
/^BUG/{
print red $0 clear
next
}
1'
}
# See https://github.com/aspiers/stow/issues/65#issuecomment-1465060710
strip_bug() {
awk '/^BUG in find_stowed_path\? Absolute\/relative mismatch/{next};1'
}
install 2> >(strip_bug | add_color)