diff options
author | Patrick Simianer <p@simianer.de> | 2013-01-22 11:42:48 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2013-01-22 11:42:48 +0100 |
commit | ad228600dba989475744f9a2142ca4d53ee8cdbe (patch) | |
tree | 120f633b91795749c376cdacc60ae80ecba68eae |
init
-rwxr-xr-x | bin/busybox | bin | 0 -> 2057504 bytes | |||
-rwxr-xr-x | bin/ifup | 7 | ||||
-rwxr-xr-x | bin/resume | bin | 0 -> 1317856 bytes | |||
l--------- | bin/sh | 1 | ||||
-rwxr-xr-x | bin/udhcpc.script | 47 | ||||
l--------- | bin/vgchange | 1 | ||||
l--------- | dev/vc/0 | 1 | ||||
-rw-r--r-- | etc/mtab | 1 | ||||
-rw-r--r-- | etc/resolv.conf | 1 | ||||
-rw-r--r-- | etc/suspend.conf | 10 | ||||
-rwxr-xr-x | init | 66 | ||||
-rwxr-xr-x | sbin/cryptsetup | bin | 0 -> 1524840 bytes |
12 files changed, 135 insertions, 0 deletions
diff --git a/bin/busybox b/bin/busybox Binary files differnew file mode 100755 index 0000000..3d56a2d --- /dev/null +++ b/bin/busybox diff --git a/bin/ifup b/bin/ifup new file mode 100755 index 0000000..2b60f1c --- /dev/null +++ b/bin/ifup @@ -0,0 +1,7 @@ +#!/bin/sh + +DEV=$1 + +ifconfig $DEV up +udhcpc -t 5 -q -s /bin/udhcpc.script + diff --git a/bin/resume b/bin/resume Binary files differnew file mode 100755 index 0000000..977924b --- /dev/null +++ b/bin/resume @@ -0,0 +1 @@ +busybox
\ No newline at end of file diff --git a/bin/udhcpc.script b/bin/udhcpc.script new file mode 100755 index 0000000..40ee738 --- /dev/null +++ b/bin/udhcpc.script @@ -0,0 +1,47 @@ +#!/bin/sh +# udhcpc script edited by Tim Riker <Tim@Rikers.org> + +RESOLV_CONF="/etc/resolv.conf" + +[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; } + +NETMASK="" +[ -n "$subnet" ] && NETMASK="netmask $subnet" +BROADCAST="broadcast +" +[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" + +case "$1" in + deconfig) + echo "Setting IP address 0.0.0.0 on $interface" + ifconfig $interface 0.0.0.0 + ;; + + renew|bound) + echo "Setting IP address $ip on $interface" + ifconfig $interface $ip $NETMASK $BROADCAST + + if [ -n "$router" ] ; then + echo "Deleting routers" + while route del default gw 0.0.0.0 dev $interface ; do + : + done + + metric=0 + for i in $router ; do + echo "Adding router $i" + route add default gw $i dev $interface metric $((metric++)) + done + fi + + echo "Recreating $RESOLV_CONF" + echo -n > $RESOLV_CONF-$$ + [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$ + for i in $dns ; do + echo " Adding DNS server $i" + echo "nameserver $i" >> $RESOLV_CONF-$$ + done + mv $RESOLV_CONF-$$ $RESOLV_CONF + ;; +esac + +exit 0 diff --git a/bin/vgchange b/bin/vgchange new file mode 120000 index 0000000..9428656 --- /dev/null +++ b/bin/vgchange @@ -0,0 +1 @@ +lvm
\ No newline at end of file diff --git a/dev/vc/0 b/dev/vc/0 new file mode 120000 index 0000000..bea71cc --- /dev/null +++ b/dev/vc/0 @@ -0,0 +1 @@ +../console
\ No newline at end of file diff --git a/etc/mtab b/etc/mtab new file mode 100644 index 0000000..17d1d6f --- /dev/null +++ b/etc/mtab @@ -0,0 +1 @@ +none /dev devtmpfs 0 0 diff --git a/etc/resolv.conf b/etc/resolv.conf new file mode 100644 index 0000000..cae093a --- /dev/null +++ b/etc/resolv.conf @@ -0,0 +1 @@ +nameserver 8.8.8.8 diff --git a/etc/suspend.conf b/etc/suspend.conf new file mode 100644 index 0000000..bfc117d --- /dev/null +++ b/etc/suspend.conf @@ -0,0 +1,10 @@ +snapshot device = /dev/snapshot +resume device = /dev/disk/by-label/rootfs +resume offset = 1349272 +#image size = 350000000 +#suspend loglevel = 2 +compute checksum = y +compress = y +#encrypt = y +#early writeout = y +#splash = y @@ -0,0 +1,66 @@ +#!/bin/busybox sh + +#set -x + +ROOT=/dev/disk/by-label/rootfs +HOME=/dev/disk/by-uuid/092fdc4a-4356-47d9-9272-9a5f58e33bbf + +prep_dev() +{ + for opt in `cat /proc/cmdline`; do + name=$(echo $opt | cut -d'=' -f 1) + if [ $name == "root" ] || [ $name == "resume" ] || [ $name == "crypt_part" ]; then + type=$(echo $opt | cut -d'=' -f 2) + id=$(echo $opt | cut -d'=' -f 3) + if [ $type == LABEL ]; then + prefix="/dev/disk/by-label"; + elif [ $type == UUID ]; then + prefix="/dev/disk/by-uuid" + fi + mkdir -p $prefix + full="$prefix/$id" + if [ ! -e $full ]; then + ln -s $(findfs "$type=$id") $full + fi + fi + done +} + +rescue_shell() +{ + echo "Something went wrong. Dropping you to a shell." + busybox --install -s + exec /bin/sh +} + +cryptsetup_do() +{ + echo "cryptsetup $1 $2" + cryptsetup -T 3 luksOpen $1 $2 +} + +mount_root() +{ + echo "mount root $1" + mount -o ro $1 /newroot +} + +# Mount the /dev, /proc and /sys filesystems. +mount -t devtmpfs none /dev +mount -t proc none /proc +mount -t sysfs none /sys + +# Do your stuff here. +prep_dev +cryptsetup_do $HOME home +resume +mount_root $ROOT || rescue_shell + +# Clean up. +umount /dev +umount /proc +umount /sys + +# Boot the real thing. +exec switch_root /newroot /sbin/init + diff --git a/sbin/cryptsetup b/sbin/cryptsetup Binary files differnew file mode 100755 index 0000000..aae4b30 --- /dev/null +++ b/sbin/cryptsetup |