summaryrefslogtreecommitdiffstats
path: root/build_tools/larch8/larch0/buildscripts
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2010-12-02 22:37:23 (GMT)
committerJames Meyer <james.meyer@operamail.com>2010-12-02 22:37:34 (GMT)
commit8b94d7f39c71234712bead363526a0283efeb9fa (patch)
tree23f1dbd6458dc39a2c1b08bcdd4cbf768a60d84d /build_tools/larch8/larch0/buildscripts
parent338af567e74d08cbd357079941208e494463d61e (diff)
downloadlinhes_dev-8b94d7f39c71234712bead363526a0283efeb9fa.zip
larch8: first checkin, still needs some work
Diffstat (limited to 'build_tools/larch8/larch0/buildscripts')
-rwxr-xr-xbuild_tools/larch8/larch0/buildscripts/cleardir15
-rwxr-xr-xbuild_tools/larch8/larch0/buildscripts/larch-grub-install67
-rwxr-xr-xbuild_tools/larch8/larch0/buildscripts/larch-hosts31
-rwxr-xr-xbuild_tools/larch8/larch0/buildscripts/larch-locales45
4 files changed, 158 insertions, 0 deletions
diff --git a/build_tools/larch8/larch0/buildscripts/cleardir b/build_tools/larch8/larch0/buildscripts/cleardir
new file mode 100755
index 0000000..a90f0f7
--- /dev/null
+++ b/build_tools/larch8/larch0/buildscripts/cleardir
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if cat /proc/mounts | grep " $1/sys" &>/dev/null; then
+ umount -l "$1/sys"
+fi
+if cat /proc/mounts | grep " $1/proc" &>/dev/null; then
+ umount -l "$1/proc"
+fi
+
+if ls "$1" &>/dev/null; then
+ rm -rf "$1/*"
+fi
+for x in $( ls -A "$1" ); do
+ rm -rf "$1/$x"
+done
diff --git a/build_tools/larch8/larch0/buildscripts/larch-grub-install b/build_tools/larch8/larch0/buildscripts/larch-grub-install
new file mode 100755
index 0000000..76921a4
--- /dev/null
+++ b/build_tools/larch8/larch0/buildscripts/larch-grub-install
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# larch-grub-install - Set up a grub boot
+#
+#2010.08.09
+
+# $1: path to system to be used as chroot for running grub
+# ("/" if no chroot is to be used)
+# $2: larch partition, e.g. /dev/sdb1
+# $3: 'MBR', if to be installed to MBR
+
+INSTLDIR="$1"
+if [ "${INSTLDIR}" = "/" ]; then
+ INSTLDIR=""
+fi
+DEVICE="$2"
+mbr="$3"
+
+dev=${DEVICE:0:8}
+part=${DEVICE:8}
+
+# Convert the device and partion to grub syntax
+grubdevice ()
+{
+ ## The contents of DEVICE.map look something like this:
+ #(fd0) /dev/fd0
+ #(hd0) /dev/hda
+ #(hd1) /dev/sda
+ gdev="$( cat ${INSTLDIR}${dmap} | grep "${dev}" | cut -f1 | tr -d "()" )"
+ gpart=$(( ${part} - 1 ))
+ gdst="${gdev},${gpart}"
+ [[ ${mbr} != 'MBR' ]] && gdev=${gdst}
+ echo "#Installing GRUB to (${gdev}), root (${gst})"
+}
+
+dmap=/tmp/DEVICE.map
+rm -f ${INSTLDIR}${dmap}
+if [ -n "${INSTLDIR}" ]; then
+ # First try to get a device mapping
+ mount --bind /dev ${INSTLDIR}/dev
+ echo "quit" | chroot ${INSTLDIR} grub --no-floppy --device-map=${dmap} --batch
+ grubdevice
+ # Now actually install grub
+ # As far as I can tell, the extra options to grub are not needed here
+ chroot ${INSTLDIR} grub --batch <<EOT
+root (${gdst})
+setup (${gdev})
+quit
+EOT
+ umount ${INSTLDIR}/dev
+else
+ # First try to get a device mapping
+ echo "quit" | grub --no-floppy --device-map=${dmap} --batch
+ grubdevice
+ # Now actually install grub
+ # As far as I can tell, the extra options to grub are not needed here
+ grub --batch <<EOT
+root (${gdst})
+setup (${gdev})
+quit
+EOT
+fi
+rm -f ${INSTLDIR}${dmap}
+
+
+
+
diff --git a/build_tools/larch8/larch0/buildscripts/larch-hosts b/build_tools/larch8/larch0/buildscripts/larch-hosts
new file mode 100755
index 0000000..01e71a1
--- /dev/null
+++ b/build_tools/larch8/larch0/buildscripts/larch-hosts
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# larch-hosts - Add hostname to /etc/hosts file (in overlay)
+#
+#2010.11.28
+
+
+# $1: path to system to be larchified ("" if running system)
+# $2: path to temporary overlay directory (where the overlay is being built)
+
+INSTLDIR="$1"
+OVERLAYDIR="$2"
+
+# If a link is used for the hosts file, assume no processing is needed
+[ -L ${hosts} ] && exit 0
+
+hosts="${OVERLAYDIR}/etc/hosts"
+if ! [ -f ${hosts} ]; then
+ # If not provided in the profile rootoverlay, get it from the installation
+ cp ${INSTLDIR}/etc/hosts ${OVERLAYDIR}/etc
+fi
+
+HOSTNAME="UNKNOWN"
+if [ -f ${OVERLAYDIR}/etc/rc.conf ]; then
+ . ${OVERLAYDIR}/etc/rc.conf
+else
+ . ${INSTLDIR}/etc/rc.conf
+fi
+
+lh="127.0.0.1 localhost.localdomain localhost "
+sed -i "s|^127\.0\.0\.1.*|${lh}${HOSTNAME}|" ${hosts}
diff --git a/build_tools/larch8/larch0/buildscripts/larch-locales b/build_tools/larch8/larch0/buildscripts/larch-locales
new file mode 100755
index 0000000..254e037
--- /dev/null
+++ b/build_tools/larch8/larch0/buildscripts/larch-locales
@@ -0,0 +1,45 @@
+#!/bin/bash
+#
+# larch-locales - Generate glibc locales to an overlay (a slightly tricky business)
+#
+#2009.08.26
+
+# If there is a 'locale.gen' file in the profile (rootoverlay/etc/locale.gen)
+# it will be used for the generation, otherwise the existing '/etc/locale.gen'
+# (in the system to be larchified!) will be used, which is empty by default.
+
+# $1: path to system to be larchified ("" if running system)
+# $2: path to temporary overlay directory (where the overlay is being built)
+
+INSTLDIR="$1"
+OVERLAYDIR="$2"
+
+mkdir -p ${OVERLAYDIR}/usr/lib
+echo
+echo "********** Generating locales to an overlay **********"
+echo
+rm -f ${INSTLDIR}/etc/locale.gen_new
+rm -rf ${INSTLDIR}/usr/lib/locale.save
+if [ -f ${OVERLAYDIR}/etc/locale.gen ]; then
+ mv -f ${INSTLDIR}/etc/locale.gen ${INSTLDIR}/etc/locale.gen_old
+ cp ${OVERLAYDIR}/etc/locale.gen ${INSTLDIR}/etc
+ cp -a ${INSTLDIR}/usr/lib/locale ${INSTLDIR}/usr/lib/locale.save
+fi
+
+if [ -n "${INSTLDIR}" ]; then
+ chroot ${INSTLDIR} /usr/sbin/locale-gen
+else
+ /usr/sbin/locale-gen
+fi
+
+rm -rf ${OVERLAYDIR}/usr/lib/locale
+cp -a ${INSTLDIR}/usr/lib/locale ${OVERLAYDIR}/usr/lib
+# /usr/lib/locale will be excluded from system.sqf
+
+# Restore old locale files
+if [ -f ${INSTLDIR}/etc/locale.gen_old ]; then
+ mv -f ${INSTLDIR}/etc/locale.gen_old ${INSTLDIR}/etc/locale.gen
+ rm -rf ${INSTLDIR}/usr/lib/locale
+ mv ${INSTLDIR}/usr/lib/locale.save ${INSTLDIR}/usr/lib/locale
+fi
+