Last active
August 29, 2015 14:01
-
-
Save neagix/bbfed4f91f8821bed7e7 to your computer and use it in GitHub Desktop.
my scripts to manage Debian chroot environments on Android 4.2+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd /dev/block/vold/ | |
for D in `ls`; do fdisk -l $D | grep ^`echo $D | awk '{ print substr($1, 1, 3) }'`; done | grep '*' | awk '{ print substr($1, 1, length($1)-2) }' > /data/local/boot-device.txt | |
clear && echo -e "**********************\nThe individuated device of your external SD is: $PWD/`ls | grep -v $(</data/local/boot-device.txt )`\nPlease double check with output of fdisk -l before proceeding!!!\n**********************\n" && rm /data/local/boot-device.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VOLD=$1 | |
DEBROOT=$2 | |
mount -o rw,noatime,nodiratime,user_xattr,acl,barrier=0,data=ordered,noauto_da_alloc -t ext4 $VOLD $DEBROOT/ || exit $? | |
[[ "$(mount | grep $DEBROOT/rootfs/dev/pts)" == "" ]] && mount -t devpts devpts $DEBROOT/rootfs/dev/pts | |
[[ "$(mount | grep $DEBROOT/rootfs/proc)" == "" ]] && mount -t proc proc $DEBROOT/rootfs/proc | |
[[ "$(mount | grep $DEBROOT/rootfs/sys)" == "" ]] && mount -t sysfs sysfs $DEBROOT/rootfs/sys | |
mount | grep $DEBROOT | grep ^/dev/block | awk '$2 { $2 = "/"; print }' > $DEBROOT/rootfs/etc/mtab | |
echo "$DEBROOT mounted successfully" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBROOT=$1 | |
shift | |
PATH=/usr/bin:/usr/sbin:/bin:$PATH TERM=linux HOME=/root USER=root busybox chroot $DEBROOT/rootfs/ $@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://http.debian.net/debian wheezy main | |
deb-src http://http.debian.net/debian wheezy main | |
deb http://http.debian.net/debian wheezy-updates main | |
deb-src http://http.debian.net/debian wheezy-updates main | |
deb http://security.debian.org/ wheezy/updates main | |
deb-src http://security.debian.org/ wheezy/updates main |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBROOT=$1 | |
umount $DEBROOT/rootfs/dev/pts && \ | |
umount $DEBROOT/rootfs/proc && \ | |
umount $DEBROOT/rootfs/sys && \ | |
umount $DEBROOT && \ | |
echo "$DEBROOT unmounted successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment