ncmpcpp: Bump revision after patch
[termux-packages] / packages / proot / termux-chroot
CommitLineData
5a979ce6
FF
1#!/bin/sh
2
3if [ $# != 0 ]; then
4 echo "termux-chroot: Setup a chroot to mimic a normal Linux file system"
5 echo ""
6 echo "Execute without arguments to run a chroot with traditional file system"
7 echo "hierarchy (having e.g. the folders /bin, /etc and /usr) within Termux."
8 exit
9fi
10
11# For the /system/bin/linker(64) to be found:
12ARGS="-b /system:/system"
13
14# Bind $PREFIX so Termux programs expecting
15# to find e.g. configurations files there work.
16ARGS="$ARGS -b $PREFIX/..:$PREFIX/.."
17
c491cc49
FF
18# Expose external and internal storage:
19if [ -d /storage ]; then
20 ARGS="$ARGS -b /storage:/storage"
21fi
22
5a979ce6
FF
23# Mimic traditional Linux file system hierarchy - /usr:
24ARGS="$ARGS -b $PREFIX:/usr"
25
26# Mimic traditional Linux file system hierarchy - other Termux dirs:
27for f in bin etc lib share tmp var; do
28 ARGS="$ARGS -b $PREFIX/$f:/$f"
29done
30
31# Mimic traditional Linux file system hierarchy- system dirs:
32for f in dev proc; do
33 ARGS="$ARGS -b /$f:/$f"
34done
35
36# Set /home as current directory:
37ARGS="$ARGS --cwd=/home"
38
39# Root of the file system:
40ARGS="$ARGS -r $PREFIX/.."
41
42# Program to execute:
43PROGRAM=/bin/bash
44if [ -x $HOME/.termux/shell ]; then
45 PROGRAM=`readlink -f $HOME/.termux/shell`
46fi
47ARGS="$ARGS $PROGRAM -l"
48
49export HOME=/home
50$PREFIX/bin/proot $ARGS