Skip to content

Commit

Permalink
Checkin rc.conf / linuxchroot.sh changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Spidey01 committed Feb 9, 2012
1 parent 791cd18 commit a1d6b4c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions etc/init.android/rc.conf
Expand Up @@ -27,6 +27,9 @@ resolv_iface=wlan0
# resolv_iface has an IP of 192.168.2.xxx
#

ipv4_forwarding=
# enables IP(v4) forwarding if set.

enter_services='ssh'
# What services to start on rc.enter
#
Expand All @@ -39,4 +42,9 @@ leave_services=
# Space delimited list of names from /etc/init.d/
#

leave_linux_dirs=yes
# If set: Linux directories like /proc will remain bound when leaving the chroot.
# If unset: they get unbound.
# Unsetting this may cause havoc on daemons left alive when leaving the chroot.


10 changes: 9 additions & 1 deletion linuxchroot.sh
Expand Up @@ -2,8 +2,11 @@
#
# My custom script for chrooting into a linux chroot.
# This is run OUTSIDE the chroot by ANDROID.
# You must be root.
#

# this is stuff for init scripts, login will sanitize the shell session.
export PATH="/usr/bin:/usr/sbin:/bin:/sbin:$PATH"
export TERM=linux
export HOME=/root
export USER=root
Expand All @@ -30,12 +33,17 @@ done
if [ -z "$LINUX_CHROOT" ]; then
export LINUX_CHROOT=/data/local/Linux
fi
export LINUX_CHROOT_RCDIR="${LINUX_CHROOT}/etc/init.android"

if [ ! -d "$LINUX_CHROOT" ]; then
echo "No chroot detected. Aborting."
echo "Export LINUX_CHROOT or link your chroot to /data/local/Linux"
exit 127
fi
if [ ! -d "$LINUX_CHROOT_RCDIR" ]; then
echo "Can't find chroot init scripts. Aborting."
exit 127
fi

echo "Initializing chroot..."
# sequence of busybox scripts and commands to run in a sanitary sub shell.
Expand All @@ -61,7 +69,7 @@ echo "Initializing chroot..."
for rc in \
"/etc/init.android/rc.enter" \
"/usr/local/etc/init.android/rc.enter" \
"chroot $LINUX_CHROOT env PWD= SHELL=/bin/sh /bin/sh -i -l" \
"chroot $LINUX_CHROOT /usr/bin/env PWD= SHELL=/bin/sh /bin/sh -i -l" \
"/etc/init.android/rc.leave" \
"/usr/local/etc/init.android/rc.leave"
do
Expand Down

0 comments on commit a1d6b4c

Please sign in to comment.