-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·67 lines (54 loc) · 1.45 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
#!/bin/bash
chknorm(){
if [ "$(id -u)" = "0" ]; then
echo "E: Must run as a normal user not root."
exit 1
fi
}
chkcmd(){
if command -v "$1" >/dev/null 2>&1; then
return 0
else
return 1
fi
}
err_exit(){
printf "E: $*\n" >&2
exit 1
}
clean(){
tmpdir=$1
rm -rf "$tmpdir" &&
echo "Cleaned '$tmpdir'" ||
echo "E: Failed to clean '$tmpdir'"
}
chknorm
tmpdir=$(mktemp -d)
trap "clean '$tmpdir'" EXIT 2
cd "$tmpdir" && echo "Entered into $tmpdir"
if ! chkcmd sudo; then
err_exit "Please install and setup 'sudo' for your user."
fi
if ! chkcmd pacaur; then
echo "*** Installing pacaur ..."
mkdir -p pacaur
cd pacaur
# Install dependencies
sudo pacman -S base-devel expac yajl git --noconfirm || err_exit "Failed to install dependency"
# Install "cower" from AUR
PATH=$PATH:/usr/bin/core_perl
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower
makepkg PKGBUILD --skippgpcheck
sudo pacman -U cower*.tar.xz --noconfirm || err_exit "Failed to install cower"
# Install "pacaur" from AUR
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur
makepkg PKGBUILD
sudo pacman -U pacaur*.tar.xz --noconfirm || err_exit "Failed to install pacaur"
# Clean up...
cd ..
rm -rf pacaur
fi
# Install pacget
git clone https://aur.archlinux.org/pacget.git
cd pacget
makepkg -i || err_exit "Failed to install pacget"