aboutsummaryrefslogtreecommitdiffstats
path: root/freedom-maker/bin
diff options
context:
space:
mode:
Diffstat (limited to 'freedom-maker/bin')
-rw-r--r--freedom-maker/bin/copy2dream.sh30
-rwxr-xr-xfreedom-maker/bin/finalize65
-rwxr-xr-xfreedom-maker/bin/partition-stick37
-rwxr-xr-xfreedom-maker/bin/projects33
-rwxr-xr-xfreedom-maker/bin/projects-chroot1
5 files changed, 136 insertions, 30 deletions
diff --git a/freedom-maker/bin/copy2dream.sh b/freedom-maker/bin/copy2dream.sh
deleted file mode 100644
index cc800e9..0000000
--- a/freedom-maker/bin/copy2dream.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-#
-# this script assumes the current root filesystem is the source, and the
-# internal microSD on a DreamPlug is the target .. copy the kernel uImage to
-# the FAT partition on sda1, and the root contents to the ext3 on sda2
-#
-mount /dev/sda1 /media
-mv /media/uImage /media/uImage.old
-cp /boot/uImage /media/uImage
-umount /media
-
-mke2fs -j /dev/sda2
-mount /dev/sda2 /media
-(cd / ; tar cf - `/bin/ls | grep -v proc | grep -v sys | grep -v media | grep -v dev`) | \
- (cd /media ; tar xvf -)
-
-mkdir /media/proc /media/sys /media/media
-
-echo "Creating basic device nodes"
-mkdir /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
-
-umount /dev/sda2
-
-echo "interrupt the next boot and change the root path to /dev/sda2"
-
diff --git a/freedom-maker/bin/finalize b/freedom-maker/bin/finalize
new file mode 100755
index 0000000..9995b77
--- /dev/null
+++ b/freedom-maker/bin/finalize
@@ -0,0 +1,65 @@
+#! /bin/bash
+#
+# Copyright 2011 by Bdale Garbee <bdale@gag.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# based on work by <ivan@sanchezortega.es>, who released his script under
+# the following license terms:
+# ----------------------------------------------------------------------------
+# "THE BEER-WARE LICENSE" (Revision 42):
+# As long as you retain this notice you can do whatever you want with
+# this stuff. If we meet some day, and you think this stuff is worth it,
+# you can buy me a beer in return.
+# ----------------------------------------------------------------------------
+
+# finalize
+#
+# Readies the root filesystem to silently complete package
+# configuration on the first boot-up.
+
+# We don't tolerate errors.
+set -e
+
+# Until udev is configured and run for the first time, dev nodes won't be created, but we need some basic ones for spawning a console (console) and creating RSA keys for SSH (urandom).
+echo "Creating basic device nodes"
+mknod $target/dev/console c 5 1
+mknod $target/dev/random c 1 8
+mknod $target/dev/urandom c 1 9
+mknod $target/dev/null c 1 3
+mknod $target/dev/ptmx c 5 2
+
+# Set up hostname
+echo "Setting up hostname."
+echo $hostname > $target/etc/hostname
+
+# prepare to copy, when we do it later.
+chown root:root $target/sbin/copy2dream
+chmod 744 $target/sbin/copy2dream
+
+# prepare chroot project finalization
+cp bin/projects-chroot $target/
+
+echo "Using qemu-user-static to perform first-boot configuration now."
+chmod 755 $target/install.sh
+cp /usr/bin/qemu-arm-static $target/usr/bin
+echo "Running install script from source/install.sh"
+chroot $target /install.sh
+echo "Running install script from bin/projects-chroot"
+chroot $target /projects-chroot
+
+# clean up.
+rm "${target}/projects-chroot"
+rm "${target}/usr/bin/qemu-arm-static"
diff --git a/freedom-maker/bin/partition-stick b/freedom-maker/bin/partition-stick
new file mode 100755
index 0000000..e54dc9a
--- /dev/null
+++ b/freedom-maker/bin/partition-stick
@@ -0,0 +1,37 @@
+#!/bin/sh
+# create required partitions on a USB stick
+
+# Do not tolerate errors.
+set -e
+
+if [ $# -ne 1 ]; then
+ echo 'Usage: partition-stick <block device>'
+ exit 1
+fi
+
+if [ ! -b $1 ]; then
+ echo "Error: $1 is not a block device."
+ exit 1
+fi
+
+if grep -q $1 /etc/mtab; then
+ echo "Error: $1 is currently mounted."
+ exit 1;
+fi
+
+repeat=1
+while [ $repeat -eq 1 ]; do
+ read -p "Do you really want to format (and lose all data on) device $MOUNTED? [y/n] " CONFIRMATION
+ case "$CONFIRMATION" in
+ y|Y) repeat=0 ;;
+ n|N) exit 0 ;;
+ *) echo "You have to type 'y' or 'n'." ;;
+ esac
+done
+
+sudo parted -s $1 mklabel msdos
+sudo parted -a optimal -s $1 mkpart primary fat16 0 128
+sudo parted -a optimal -s $1 mkpart primary ext2 128 100%
+
+sudo mkdosfs ${1}1
+sudo mkfs.ext3 -j ${1}2
diff --git a/freedom-maker/bin/projects b/freedom-maker/bin/projects
new file mode 100755
index 0000000..2b5ed3c
--- /dev/null
+++ b/freedom-maker/bin/projects
@@ -0,0 +1,33 @@
+#! /bin/bash
+#
+# Copyright 2012 by Nick Daly <nick.m.daly@gmail.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# projects
+#
+# Installs external projects to the system.
+
+# We don't tolerate errors.
+set -e
+
+
+echo "Adding a few FreedomBox projects to the image."
+
+git clone git://github.com/NickDaly/Plinth.git $homedir/plinth
+git clone git://github.com/jvasile/freedombox-privoxy $homedir/freedombox-privoxy
+git clone git://github.com/jvasile/withsqlite.git $homedir/withsqlite
+# hg clone https://hg@bitbucket.org/nickdaly/plugserver $homedir/plugserver
+chown -R 1000:1000 $homedir
diff --git a/freedom-maker/bin/projects-chroot b/freedom-maker/bin/projects-chroot
new file mode 100755
index 0000000..50d4884
--- /dev/null
+++ b/freedom-maker/bin/projects-chroot
@@ -0,0 +1 @@
+#! /bin/sh