aboutsummaryrefslogtreecommitdiffstats
path: root/freedom-maker/source/sbin/copy2dream
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-09-11 01:16:38 +0200
committerficus <ficus@robocracy.org>2012-09-12 01:25:30 +0200
commite55744bb195f0d665332ceb48acb57b4a4e186b5 (patch)
tree70824873c9dad07bf55c9e8101a97321f78fc6f5 /freedom-maker/source/sbin/copy2dream
parente109d94422d0687fc84d8aa1804c2b209785d0aa (diff)
downloadtorouter-e55744bb195f0d665332ceb48acb57b4a4e186b5.tar.gz
torouter-e55744bb195f0d665332ceb48acb57b4a4e186b5.zip
update to FBx public-0.1 freedom-maker
Snapshot commit with no torouter-specific changes re-applied. Updated freedom-maker image to a significantly more recent version, used by the FreedomBox project. This includes a shift from debian "stable" to "testing" (wheezy), which has a Linux 3.2 kernel. date Fri, 24 Aug 2012 03:50:41 +0000 repo git://anonscm.debian.org/freedombox/freedom-maker.git commit de1f66f0651a3a7c306331eeda1db93535b1470a (public-0.1)
Diffstat (limited to 'freedom-maker/source/sbin/copy2dream')
-rw-r--r--freedom-maker/source/sbin/copy2dream47
1 files changed, 47 insertions, 0 deletions
diff --git a/freedom-maker/source/sbin/copy2dream b/freedom-maker/source/sbin/copy2dream
new file mode 100644
index 0000000..267c2b6
--- /dev/null
+++ b/freedom-maker/source/sbin/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"