-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·65 lines (48 loc) · 1.05 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
#!/usr/bin/env bash
source package.sh
IS_ROOT=$(id -u)
if [[ "${IS_ROOT}" != "0" ]]; then
echo "Not root!"
exit -1
fi
function pre_package() {
if [ -x /usr/bin/pacman ];then
PM=${PM:=pacman}
PM_INSTALL=-S
OS=arch
PM_UPDATE=-Syu
elif [ -x /usr/bin/apt-get ];then
PM=apt-get
PM_INSTALL=install
PM_UPDATE=upgrade
OS=debian
# yes | apt-get update
elif [ -x /usr/bin/yum ]; then
PM=yum
PM_INSTALL=install
PM_UPDATE=update
OS=redhat
elif [ -x /usr/bin/emerge ]; then
PM=emerge
PM_INSTALL=
PM_UPDATE=world
OS=gentoo
elif which brew; then
PM=brew
PM_INSTALL=install
PM_UPDATE=update
OS="Mac OS X"
fi
echo "OS: $OS"
echo "Package Manager: $PM"
}
function update_package() {
yes | ${PM} ${PM_UPDATE}
}
function init_package() {
pre_package
echo "Installing packages..."
update_package
yes | ${PM} ${PM_INSTALL} ${PACKAGES}
}
init_package