berryboot_linuxrc
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | berryboot_linuxrc [2012/06/12 12:04] (current) – created max | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | /linuxrc | ||
+ | < | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # BerryBoot, ugly but functional image chooser thingy | ||
+ | # | ||
+ | # Author: Floris Bos | ||
+ | # | ||
+ | |||
+ | # Standard busybox init | ||
+ | /bin/mount -t proc proc /proc | ||
+ | /bin/mount -o remount, | ||
+ | /bin/mount -a | ||
+ | / | ||
+ | |||
+ | # Enumerate images | ||
+ | cd /images | ||
+ | IMAGES=`echo *` | ||
+ | DIALOG_ARGS=" | ||
+ | |||
+ | for image in $IMAGES | ||
+ | do | ||
+ | DIALOG_ARGS=" | ||
+ | done | ||
+ | |||
+ | # Prevent kernel messages being printed through our menu | ||
+ | echo 0 > / | ||
+ | |||
+ | # Show dialog | ||
+ | eval dialog $DIALOG_ARGS 2>/ | ||
+ | |||
+ | if [ $? -eq 0 ]; then | ||
+ | echo 1 > / | ||
+ | IMAGE=`cat / | ||
+ | DATADIR="/ | ||
+ | rm /tmp/answer | ||
+ | mkdir -p / | ||
+ | modprobe aufs | ||
+ | modprobe squashfs | ||
+ | echo Mounting image ${IMAGE}... | ||
+ | mount -o loop $IMAGE / | ||
+ | echo Mounting RW data directory on top | ||
+ | mount -t aufs -o br: | ||
+ | cd /mnt/aufs | ||
+ | mkdir -p -m 700 .berryboot | ||
+ | umount /sys | ||
+ | umount /dev/pts | ||
+ | umount /dev/shm | ||
+ | umount /tmp | ||
+ | umount /proc | ||
+ | pivot_root . .berryboot | ||
+ | exec chroot . /sbin/init </ | ||
+ | fi | ||
+ | |||
+ | # In case the user pressed cancel or something went wrong, show an emergency recovery shell | ||
+ | echo | ||
+ | echo Emergency shell activated | ||
+ | echo | ||
+ | echo To get network connectivity: | ||
+ | echo Squashfs images are in /images | ||
+ | echo User changes to the images are in /data | ||
+ | echo Before shutting down remount readonly: mount -o remount,ro / | ||
+ | echo | ||
+ | |||
+ | /bin/sh | ||
+ | </ |
berryboot_linuxrc.txt · Last modified: 2012/06/12 12:04 by max