forked from willtrnr/capman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·134 lines (114 loc) · 3.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#! /usr/bin/env bash
set -e
ARCH='x86_64'
MIRROR_URL="https://storage.googleapis.com/capman-repo"
SRC_REPO_URL="https://raw.githubusercontent.com/wwwiiilll/capman/master/local"
PKGEXT='.pkg.tar.xz'
FAKEROOT_VER='1.23-1'
GNUPG_VER='2.2.7-1'
GPGME_VER='1.11.1-1'
LIBARCHIVE_VER='3.3.2-1'
LIBASSUAN_VER='2.5.1-1'
LIBGCRYPT_VER='1.8.1-1'
LIBGPGERROR_VER='1.31-1'
LZ4_VER='1.8.0-1'
NPTH_VER='1.5-1'
XZUTILS_VER='5.2.3-2'
PACMAN_VER='5.1.3-1'
MIRRORS_VER='20181205-1'
KEYRING_VER='20190221-1'
SUDO="/usr/bin/sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
PACMAN="$SUDO /usr/local/bin/pacman --noconfirm"
TMPDIR="/usr/local/tmp/capman"
mkdir -p "$TMPDIR"
trap "rm -rf '$TMPDIR'" EXIT
msg() {
local msg="$1"; shift
printf "==> $msg\n" "$@"
}
msg2() {
local msg="$1"; shift
printf " -> $msg\n" "$@"
}
install_pkg() {
local repo="${2:-core}"
msg2 "%s" "$1"
curl -# -Lo "${TMPDIR}/${1}${PKGEXT}" "${MIRROR_URL}/${repo}/os/$ARCH/${1}${PKGEXT}"
(cd /; $SUDO tar --warning=none -xf "${TMPDIR}/${1}${PKGEXT}" usr/local)
}
build_pkg() {
local name="$1"; shift
mkdir -p "$TMPDIR/$name"
curl -# -Lo "$TMPDIR/$name/PKGBUILD" "$SRC_REPO_URL/$name/PKGBUILD"
while [ ! -z "$1" ]; do
curl -# -Lo "$TMPDIR/$name/$1" "$SRC_REPO_URL/$name/$1"
shift
done
(cd "$TMPDIR/$name"; /usr/local/bin/makepkg -d)
$PACMAN -Udd --noconfirm --overwrite '/*' "$TMPDIR/$name/$name-"*"$PKGEXT"
}
echo -e "\e[33m"
echo 'Brought to to you by Henry Zhao.'
echo 'From here on things will mostly be done as `root`, enter'
echo 'your `sudo` password if prompted.'
echo -e "\e[0m"
if [ -e /lib64/libc-2.27.so ]; then
GLIBC_PKG=glibc27
GLIBC_VER='2.27-1'
else
GLIBC_PKG=glibc23
GLIBC_VER='2.23-1'
fi
msg 'Installing dependencies...'
install_pkg "fakeroot-$FAKEROOT_VER-$ARCH"
install_pkg "$GLIBC_PKG-$GLIBC_VER-$ARCH" crew
install_pkg "gnupg-$GNUPG_VER-$ARCH" crew
install_pkg "gpgme-$GPGME_VER-$ARCH" crew
install_pkg "libarchive-$LIBARCHIVE_VER-$ARCH" crew
install_pkg "libassuan-$LIBASSUAN_VER-$ARCH" crew
install_pkg "libgcrypt-$LIBGCRYPT_VER-$ARCH" crew
install_pkg "libgpgerror-$LIBGPGERROR_VER-$ARCH" crew
install_pkg "lz4-$LZ4_VER-$ARCH" crew
install_pkg "npth-$NPTH_VER-$ARCH" crew
install_pkg "xzutils-$XZUTILS_VER-$ARCH" crew
if [ ! -e /usr/local/bin/bash ]; then
$SUDO ln -s /bin/bash /usr/local/bin/bash
fi
msg 'Installing pacman...'
install_pkg "pacman-$PACMAN_VER-$ARCH"
install_pkg "capman-keyring-$KEYRING_VER-any"
install_pkg "pacman-mirrorlist-$MIRRORS_VER-any"
msg 'Initializing the keyring...'
$SUDO /usr/local/bin/pacman-key --init
$SUDO /usr/local/bin/pacman-key --populate capman
msg 'Syncing repositories...'
$PACMAN -Sy
msg 'Building the local bash wrapper package...'
build_pkg "bash"
msg 'Building the local sudo wrapper package...'
build_pkg "sudo" "sudo.sh"
msg 'Re-installing base packages and taking ownership of files...'
$PACMAN -S --noconfirm --overwrite '/*' \
curl \
filesystem \
$GLIBC_PKG \
capman-keyring \
gnupg \
gpgme \
libarchive \
libassuan \
libgcrypt \
libgpgerror \
libiconv \
libpsl \
libssh2 \
linux-api-headers \
lz4 \
npth \
pacman \
pacman-mirrorlist \
xzutils
echo -e "\e[32m"
echo 'All done! Use `sudo pacman -S <name>` to install and `sudo pacman -Syu`'
echo 'to update your packages.'
echo -e "\e[0m"