aboutsummaryrefslogtreecommitdiffstats
path: root/freedom-maker/bin/finalize
diff options
context:
space:
mode:
Diffstat (limited to 'freedom-maker/bin/finalize')
-rwxr-xr-xfreedom-maker/bin/finalize65
1 files changed, 65 insertions, 0 deletions
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"