-
Notifications
You must be signed in to change notification settings - Fork 3
/
os-install.sh
executable file
·63 lines (59 loc) · 1.55 KB
/
os-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
#!/bin/bash
findOS(){
if uname | grep -q "Darwin"; then
if command -v brew > /dev/null; then
os="brew install"
else
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
os="brew install"
fi
elif uname | grep -q "Linux"; then
if command -v pacman > /dev/null; then
os="sudo pacman -S --needed"
elif command -v apt > /dev/null; then
os="sudo apt install"
# if [ $2 = "opam" ]; then
# sudo add-apt-repository ppa:avsm/ppa
# sudo apt update
fi
fi
}
customizeArg(){
if [ $2 = "vips" ]; then
if [ "$os" = "sudo pacman -S --needed" ]; then
customarg="libvips"
elif [ "$os" = "sudo apt install" ]; then
customarg="libvips-tools"
else
customarg="vips"
fi
elif [ $2 = "verapdf" ]; then
if [ "$os" != "brew install" ]; then
customarg="NaN"
else
customarg="verapdf"
fi
elif [ $2 = "catdoc" ]; then
if [ "$os" != "sudo pacman -S --needed" ]; then
customarg="NaN"
else
customarg="catdoc"
fi
else
customarg=$2
fi
}
findOS
while [[ $# -gt 0 ]]; do
customizeArg "$os" $1
if [ "$customarg" != "NaN" ]; then
if [ "$os" = "sudo apt install" ]; then
$os $customarg -y
else
$os $customarg
fi
else
$os $customarg
fi
shift
done