From e55744bb195f0d665332ceb48acb57b4a4e186b5 Mon Sep 17 00:00:00 2001 From: ficus Date: Tue, 11 Sep 2012 01:16:38 +0200 Subject: 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) --- freedom-maker/bin/copy2dream.sh | 30 ------------------ freedom-maker/bin/finalize | 65 +++++++++++++++++++++++++++++++++++++++ freedom-maker/bin/partition-stick | 37 ++++++++++++++++++++++ freedom-maker/bin/projects | 33 ++++++++++++++++++++ freedom-maker/bin/projects-chroot | 1 + 5 files changed, 136 insertions(+), 30 deletions(-) delete mode 100644 freedom-maker/bin/copy2dream.sh create mode 100755 freedom-maker/bin/finalize create mode 100755 freedom-maker/bin/partition-stick create mode 100755 freedom-maker/bin/projects create mode 100755 freedom-maker/bin/projects-chroot (limited to 'freedom-maker/bin') 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 +# +# 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 . +# + +# based on work by , 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 ' + 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 +# +# 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 . +# + +# 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 -- cgit v1.2.3