-
Notifications
You must be signed in to change notification settings - Fork 209
/
install.sh
executable file
·35 lines (29 loc) · 1.68 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
#!/usr/bin/env bash
set -e
: "${TERMUX_APP_PACKAGE:="com.termux"}"
: "${TERMUX_PREFIX:="/data/data/${TERMUX_APP_PACKAGE}/files/usr"}"
: "${TERMUX_ANDROID_HOME:="/data/data/${TERMUX_APP_PACKAGE}/files/home"}"
echo "Installing $TERMUX_PREFIX/bin/proot-distro"
install -d -m 700 "$TERMUX_PREFIX"/bin
sed -e "s|@TERMUX_APP_PACKAGE@|$TERMUX_APP_PACKAGE|g" \
-e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \
-e "s|@TERMUX_HOME@|$TERMUX_ANDROID_HOME|g" \
./proot-distro.sh > "$TERMUX_PREFIX"/bin/proot-distro
chmod 700 "$TERMUX_PREFIX"/bin/proot-distro
echo "Symlinking $TERMUX_PREFIX/bin/proot-distro --> $TERMUX_PREFIX/bin/pd"
ln -sfr "$TERMUX_PREFIX"/bin/proot-distro "$TERMUX_PREFIX"/bin/pd
install -d -m 700 "$TERMUX_PREFIX"/etc/proot-distro
for script in ./distro-plugins/*.sh*; do
echo "Installing $TERMUX_PREFIX/etc/proot-distro/$(basename "$script")"
install -Dm600 -t "$TERMUX_PREFIX"/etc/proot-distro/ "$script"
done
echo "Installing $TERMUX_PREFIX/share/bash-completion/completions/proot-distro"
install -d -m 700 "$TERMUX_PREFIX"/share/bash-completion/completions
sed -e "s|@TERMUX_APP_PACKAGE@|$TERMUX_APP_PACKAGE|g" \
-e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \
-e "s|@TERMUX_HOME@|$TERMUX_ANDROID_HOME|g" \
./completions/proot-distro.bash > "$TERMUX_PREFIX"/share/bash-completion/completions/proot-distro
echo "Symlinking $TERMUX_PREFIX/share/bash-completion/completions/proot-distro --> $TERMUX_PREFIX/share/bash-completion/completions/pd"
ln -sfr "$TERMUX_PREFIX"/share/bash-completion/completions/proot-distro "$TERMUX_PREFIX"/share/bash-completion/completions/pd
echo "Installing $TERMUX_PREFIX/share/doc/proot-distro/README.md"
install -Dm600 README.md "$TERMUX_PREFIX"/share/doc/proot-distro/README.md