From f8d9a63579169bfc7ddb8480c043eb4e4efa99dc Mon Sep 17 00:00:00 2001 From: ficus Date: Mon, 24 Sep 2012 16:22:22 +0200 Subject: inittab in config, not by echoing --- freedom-maker/bin/copy2dream | 47 ++++++++++++++++++++++++++++++++++++++++++++ freedom-maker/bin/install.sh | 4 ---- 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 freedom-maker/bin/copy2dream (limited to 'freedom-maker/bin') diff --git a/freedom-maker/bin/copy2dream b/freedom-maker/bin/copy2dream new file mode 100644 index 0000000..267c2b6 --- /dev/null +++ b/freedom-maker/bin/copy2dream @@ -0,0 +1,47 @@ +#!/bin/sh +# +# this script assumes the current root filesystem is the source, and the +# internal microSD on a DreamPlug is the target .. all existing content on +# the microSD card will be lost. +# + +# partition microSD card inside DreamPlug +echo "=> partition internal microSD card" +parted -s /dev/sda mklabel msdos +parted -s /dev/sda mkpart primary fat16 0 128 +parted -s /dev/sda mkpart primary ext2 128 100% + +# create filesystems on new partitions +echo "=> create filesystems on internal microSD card" +mkdosfs /dev/sda1 +mke2fs -j /dev/sda2 + +echo "=> mount target partitions" +mount /dev/sda2 /media +mkdir -p /media/boot +mount /dev/sda1 /media/boot + +echo "=> copy filesystem content from USB stick to target partitions" +(cd / ; tar cpSf - `/bin/ls | grep -v boot | grep -v proc | grep -v sys | grep -v media | grep -v dev`) | (cd /media ; tar xpf -) +# the following intentionally ignores subdirectories +cp /boot/* /media/boot/ + +echo "=> touch up target root partition" +mkdir /media/proc /media/sys /media/media /media/dev +mknod /media/dev/console c 5 1 +mknod /media/dev/random c 1 8 +mknod /media/dev/urandom c 1 9 +mknod /media/dev/null c 1 3 +mknod /media/dev/ptmx c 5 2 + +# patch up /etc/fstab entry for /boot +sed -e 's/sdc/sda/g' < /etc/fstab > /media/etc/fstab + +# flash the kernel and create the device's keys +chroot /media /etc/init.d/first-run + +echo "unmount target partitions" +umount /dev/sda1 +umount /dev/sda2 + +echo "=> installation complete, see docs to boot from internal microSD" diff --git a/freedom-maker/bin/install.sh b/freedom-maker/bin/install.sh index 2c3385d..7743740 100755 --- a/freedom-maker/bin/install.sh +++ b/freedom-maker/bin/install.sh @@ -75,10 +75,6 @@ echo "Creating $user user, password: $userpassword" useradd $user echo $user:$userpassword | /usr/sbin/chpasswd -# By default, spawn a console on the serial port -echo "Adding a getty on the serial port" -echo "T0:12345:respawn:/sbin/getty -L ttyS0 115200 vt100" >> /etc/inittab - echo "Deleting this very same script" rm -f /install.sh -- cgit v1.2.3