Skip to content

Instantly share code, notes, and snippets.

@bmcgavin
Forked from lrvick/init.sh
Created May 20, 2012 21:24
Show Gist options
  • Save bmcgavin/2759578 to your computer and use it in GitHub Desktop.
Save bmcgavin/2759578 to your computer and use it in GitHub Desktop.
Chrooted Arch Linux environment setup script for Android
USER='lrvick'
cd /data/local/arch
if ! mountpoint -q dev; then
mount -t proc /proc proc
mount -o bind /dev dev
mount -o bind /dev/pts /data/local/arch/dev/pts
fi
if `mount | grep ' /data ' | grep nosuid -q`; then
mount -o remount,suid /data
fi
chroot . /bin/bash -c "source /etc/profile; export HOME=/home/${USER}; export TERM=xterm-256color; clear; su - ${USER}"
@ilikenwf
Copy link

This was a good basis for mine...

!/bin/bash

USER="root"

if ! busybox mountpoint -q dev; then
busybox mount -o bind /dev /data/archlinux/dev
busybox mount -o bind /dev/pts /data/archlinux/dev/pts
busybox mount -o bind /dev/shm /data/archlinux/dev/shm
busybox mount -t proc none /data/archlinux/proc
busybox mount -t sysfs none /data/archlinux/sys
busybox mount -o bind /sdcard /data/archlinux/media/disk
fi

rm /data/archlinux/etc/resolv.conf
cp /etc/resolv.conf /data/archlinux/etc/resolv.conf

chroot /data/archlinux /bin/bash -c "source /etc/profile; export HOME=/home/${USER}; export TERM=xterm-256color; clear; su - ${USER}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment