summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-08-06 14:12:48 (GMT)
committer Jaromil <jaromil@dyne.org>2011-08-06 14:12:48 (GMT)
commitf631e67103686209fc42cc399c227854a87ac606 (patch)
treed8b535d63a786b3efc816b4fd5d1016300cec1e8
parentd119c1118583ce3f79a81ef897fa61fb68e55102 (diff)
importet live-init-scripts
from live.debian scripts used in pure:dyne
-rw-r--r--dyneIII/live-init-scripts/README5
-rwxr-xr-xdyneIII/live-init-scripts/init260
-rw-r--r--dyneIII/live-init-scripts/scripts/functions368
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-bottom/udev28
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-premount/blacklist25
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/all_generic_ide18
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/compcache26
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/console_setup80
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/framebuffer92
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/keymap27
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/udev29
-rwxr-xr-xdyneIII/live-init-scripts/scripts/init-top/usplash38
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live1740
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/02etc_live_conf51
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/02timezone60
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/05mountpoints36
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/06hostname62
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/08persistence_excludes77
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/10adduser139
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/12fstab102
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/14locales131
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/15autologin89
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/16umountfs38
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/19keyboard103
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/20xconfig92
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/21xdriver56
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/21xvidemode75
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/22gnome_panel_data44
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/22screensaver43
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/22sslcert34
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/23etc_modules36
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/23networking157
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/24preseed68
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/25configure_init114
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/30accessibility196
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/31disable_update_notifier49
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/32disable_hibernation45
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/33enable_apport_crashes39
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/34disable_kde_services41
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/34disable_kpersonalizer51
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/35fix_language_selector44
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/36disable_trackerd38
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/38jockey_disable_check29
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/41apt_cdrom39
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/42disable_apparmor39
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/43disable_updateinitramfs59
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/44pk_allow60
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-bottom/99hook50
-rw-r--r--dyneIII/live-init-scripts/scripts/live-functions113
-rw-r--r--dyneIII/live-init-scripts/scripts/live-helpers459
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-premount/modules32
-rwxr-xr-xdyneIII/live-init-scripts/scripts/live-premount/readonly35
-rw-r--r--dyneIII/live-init-scripts/scripts/local193
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-bottom/cryptopensc30
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-bottom/ntfs_3g13
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-premount/ntfs_3g14
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-premount/resume130
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-top/cryptopensc36
-rwxr-xr-xdyneIII/live-init-scripts/scripts/local-top/cryptroot343
-rw-r--r--dyneIII/live-init-scripts/scripts/nfs83
-rwxr-xr-xdyneIII/live-init-scripts/scripts/nfs-top/udev27
61 files changed, 6630 insertions, 0 deletions
diff --git a/dyneIII/live-init-scripts/README b/dyneIII/live-init-scripts/README
new file mode 100644
index 0000000..1727b7e
--- /dev/null
+++ b/dyneIII/live-init-scripts/README
@@ -0,0 +1,5 @@
+
+Imported from live.debian.org init scripts version used in pure:dyne
+
+later modified by us
+
diff --git a/dyneIII/live-init-scripts/init b/dyneIII/live-init-scripts/init
new file mode 100755
index 0000000..264be56
--- /dev/null
+++ b/dyneIII/live-init-scripts/init
@@ -0,0 +1,260 @@
+#!/bin/sh
+
+[ -d /dev ] || mkdir -m 0755 /dev
+[ -d /root ] || mkdir -m 0700 /root
+[ -d /sys ] || mkdir /sys
+[ -d /proc ] || mkdir /proc
+[ -d /tmp ] || mkdir /tmp
+mkdir -p /var/lock
+mount -t sysfs -o nodev,noexec,nosuid none /sys
+mount -t proc -o nodev,noexec,nosuid none /proc
+
+grep -q '\<quiet\>' /proc/cmdline || echo "Loading, please wait..."
+
+# Note that this only becomes /dev on the real filesystem if udev's scripts
+# are used; which they will be, but it's worth pointing out
+mount -t tmpfs -o mode=0755 udev /dev
+[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
+[ -e /dev/null ] || mknod /dev/null c 1 3
+> /dev/.initramfs-tools
+mkdir /dev/.initramfs
+
+# Export the dpkg architecture
+export DPKG_ARCH=
+. /conf/arch.conf
+
+# Set modprobe env
+export MODPROBE_OPTIONS="-qb"
+
+# Export relevant variables
+export ROOT=
+export ROOTDELAY=
+export ROOTFLAGS=
+export ROOTFSTYPE=
+export IPOPTS=
+export break=
+export init=/sbin/init
+export quiet=n
+export readonly=y
+export rootmnt=/root
+export debug=
+export panic=
+export blacklist=
+export resume_offset=
+
+# Bring in the main config
+. /conf/initramfs.conf
+for conf in conf/conf.d/*; do
+ [ -f ${conf} ] && . ${conf}
+done
+. /scripts/functions
+
+# Parse command line options
+for x in $(cat /proc/cmdline); do
+ case $x in
+ init=*)
+ init=${x#init=}
+ ;;
+ root=*)
+ ROOT=${x#root=}
+ case $ROOT in
+ LABEL=*)
+ ROOT="${ROOT#LABEL=}"
+
+ # support / in LABEL= paths (escape to \x2f)
+ case "${ROOT}" in
+ *[/]*)
+ if [ -x "$(command -v sed)" ]; then
+ ROOT="$(echo ${ROOT} | sed 's,/,\\x2f,g')"
+ else
+ if [ "${ROOT}" != "${ROOT#/}" ]; then
+ ROOT="\x2f${ROOT#/}"
+ fi
+ if [ "${ROOT}" != "${ROOT%/}" ]; then
+ ROOT="${ROOT%/}\x2f"
+ fi
+ IFS='/'
+ newroot=
+ for s in $ROOT; do
+ if [ -z "${newroot}" ]; then
+ newroot="${s}"
+ else
+ newroot="${newroot}\\x2f${s}"
+ fi
+ done
+ unset IFS
+ ROOT="${newroot}"
+ fi
+ esac
+ ROOT="/dev/disk/by-label/${ROOT}"
+ ;;
+ UUID=*)
+ ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
+ ;;
+ /dev/nfs)
+ [ -z "${BOOT}" ] && BOOT=nfs
+ ;;
+ esac
+ ;;
+ rootflags=*)
+ ROOTFLAGS="-o ${x#rootflags=}"
+ ;;
+ rootfstype=*)
+ ROOTFSTYPE="${x#rootfstype=}"
+ ;;
+ rootdelay=*)
+ ROOTDELAY="${x#rootdelay=}"
+ case ${ROOTDELAY} in
+ *[![:digit:].]*)
+ ROOTDELAY=
+ ;;
+ esac
+ ;;
+ resumedelay=*)
+ RESUMEDELAY="${x#resumedelay=}"
+ ;;
+ loop=*)
+ LOOP="${x#loop=}"
+ ;;
+ loopflags=*)
+ LOOPFLAGS="-o ${x#loopflags=}"
+ ;;
+ loopfstype=*)
+ LOOPFSTYPE="${x#loopfstype=}"
+ ;;
+ cryptopts=*)
+ cryptopts="${x#cryptopts=}"
+ ;;
+ nfsroot=*)
+ NFSROOT="${x#nfsroot=}"
+ ;;
+ netboot=*)
+ NETBOOT="${x#netboot=}"
+ ;;
+ ip=*)
+ IPOPTS="${x#ip=}"
+ ;;
+ boot=*)
+ BOOT=${x#boot=}
+ ;;
+ resume=*)
+ RESUME="${x#resume=}"
+ ;;
+ resume_offset=*)
+ resume_offset="${x#resume_offset=}"
+ ;;
+ noresume)
+ noresume=y
+ ;;
+ panic=*)
+ panic="${x#panic=}"
+ case ${panic} in
+ *[![:digit:].]*)
+ panic=
+ ;;
+ esac
+ ;;
+ quiet)
+ quiet=y
+ ;;
+ ro)
+ readonly=y
+ ;;
+ rw)
+ readonly=n
+ ;;
+ debug)
+ debug=y
+ quiet=n
+ exec >/dev/.initramfs/initramfs.debug 2>&1
+ set -x
+ ;;
+ debug=*)
+ debug=y
+ quiet=n
+ set -x
+ ;;
+ break=*)
+ break=${x#break=}
+ ;;
+ break)
+ break=premount
+ ;;
+ blacklist=*)
+ blacklist=${x#blacklist=}
+ ;;
+ esac
+done
+
+if [ -z "${noresume}" ]; then
+ export resume=${RESUME}
+else
+ export noresume
+fi
+
+depmod -a
+maybe_break top
+
+# export BOOT variable value for compcache,
+# so we know if we run from casper
+export BOOT
+
+# Don't do log messages here to avoid confusing usplash
+run_scripts /scripts/init-top
+
+maybe_break modules
+log_begin_msg "Loading essential drivers..."
+load_modules
+log_end_msg
+
+maybe_break premount
+[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
+run_scripts /scripts/init-premount
+[ "$quiet" != "y" ] && log_end_msg
+
+maybe_break mount
+log_begin_msg "Mounting root file system..."
+. /scripts/${BOOT}
+parse_numeric ${ROOT}
+mountroot
+log_end_msg
+
+maybe_break bottom
+[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
+run_scripts /scripts/init-bottom
+[ "$quiet" != "y" ] && log_end_msg
+
+# Move virtual filesystems over to the real filesystem
+mount -n -o move /sys ${rootmnt}/sys
+mount -n -o move /proc ${rootmnt}/proc
+
+# Check init bootarg
+if [ -n "${init}" ] && [ ! -x "${rootmnt}${init}" ]; then
+ echo "Target filesystem doesn't have ${init}."
+ init=
+fi
+
+# Search for valid init
+if [ -z "${init}" ] ; then
+ for init in /sbin/init /etc/init /bin/init /bin/sh; do
+ if [ ! -x "${rootmnt}${init}" ]; then
+ continue
+ fi
+ break
+ done
+fi
+
+# No init on rootmount
+if [ ! -x "${rootmnt}${init}" ]; then
+ panic "No init found. Try passing init= bootarg."
+fi
+
+# Confuses /etc/init.d/rc
+if [ -n ${debug} ]; then
+ unset debug
+fi
+
+# Chain to real filesystem
+maybe_break init
+exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
+panic "Could not execute run-init."
diff --git a/dyneIII/live-init-scripts/scripts/functions b/dyneIII/live-init-scripts/scripts/functions
new file mode 100644
index 0000000..fd2e4bd
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/functions
@@ -0,0 +1,368 @@
+# -*- shell-script -*-
+
+_log_msg()
+{
+ if [ "$quiet" = "y" ]; then return; fi
+ echo "$@"
+}
+
+log_success_msg()
+{
+ _log_msg "Success: $@"
+}
+
+log_failure_msg()
+{
+ _log_msg "Failure: $@"
+}
+
+log_warning_msg()
+{
+ _log_msg "Warning: $@"
+}
+
+log_begin_msg()
+{
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TEXT $@"
+ fi
+ _log_msg "Begin: $@ ..."
+}
+
+log_end_msg()
+{
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "SUCCESS ok"
+ fi
+ _log_msg "Done."
+}
+
+# Add failure hook
+add_mountroot_fail_hook()
+{
+ mkdir -p /tmp/mountroot-fail-hooks.d
+ ln -s "$0" /tmp/mountroot-fail-hooks.d/"$1"
+}
+
+# Run failure hooks.
+# When a failure hook exits "1", it has not done anything to correct the
+# system. Exiting "0" means that something has been attempted to resolve
+# the lack of a root filesystem.
+# Hooks are run in lexigraphical order, and are responsible for removing
+# themselves if they should not re-run in a later cycle. When one exits
+# "0", the stack is stopped, so the caller can return to the main rootfs
+# wait loop.
+try_failure_hooks()
+{
+ local hook
+
+ # Disable usplash so text from hooks can be seen
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "QUIT"
+ fi
+ chvt 1
+
+ for hook in /tmp/mountroot-fail-hooks.d/*; do
+ if [ -x ${hook} ] && ${hook} mountfail; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+panic()
+{
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "QUIT"
+ fi
+ chvt 1
+
+ # Disallow console access
+ if [ -n "${panic}" ]; then
+ sleep ${panic}
+ reboot
+ fi
+
+ modprobe i8042
+ modprobe atkbd
+ echo $@
+ PS1='(initramfs) ' /bin/sh -i </dev/console >/dev/console 2>&1
+}
+
+maybe_break()
+{
+ if [ "${break}" = "$1" ]; then
+ panic "Spawning shell within the initramfs"
+ fi
+}
+
+render()
+{
+ eval "echo -n \${$@}"
+}
+
+set_initlist()
+{
+ unset initlist
+ for si_x in ${initdir}/*; do
+ # skip empty dirs without warning
+ [ "${si_x}" = "${initdir}/*" ] && return
+
+ # only allow variable name chars
+ case ${si_x#${initdir}/} in
+ *[![:alnum:]_]*)
+ [ "${verbose}" = "y" ] \
+ && echo "$si_x ignored: not alphanumeric or '_' file"
+ continue
+ ;;
+ esac
+
+ # skip non executable scripts
+ if [ ! -x ${si_x} ]; then
+ [ "${verbose}" = "y" ] \
+ && echo "$si_x ignored: not executable"
+ continue
+ fi
+
+ # skip directories
+ if [ -d ${si_x} ]; then
+ [ "${verbose}" = "y" ] \
+ && echo "$si_x ignored: a directory"
+ continue
+ fi
+
+ initlist="${initlist} ${si_x#${initdir}/}"
+ done
+}
+
+reduce_satisfied()
+{
+ deplist="$(render array_${1})"
+ unset tmpdeplist
+ for rs_y in ${deplist}; do
+ # check if there are alternatives
+ case ${rs_y} in
+ *\|*)
+ OLD_IFS="$IFS"
+ IFS="|"
+ for rs_z in ${rs_y}; do
+ IFS="$OLD_IFS"
+ # only allow variable name chars
+ case ${rs_z} in
+ *[![:alnum:]_]*)
+ IFS="|"
+ continue
+ ;;
+ esac
+ # skip non executable scripts
+ if [ ! -x ${initdir}/${rs_z} ]; then
+ IFS="|"
+ continue
+ fi
+ # skip directories
+ if [ -d ${initdir}/${rs_z} ]; then
+ IFS="|"
+ continue
+ fi
+ tmpdeplist="${tmpdeplist} ${rs_z}"
+ break
+ done
+ IFS="$OLD_IFS"
+ ;;
+ *)
+ case ${rs_y} in
+ *[![:alnum:]_]*)
+ continue
+ ;;
+ esac
+ if [ ! -x ${initdir}/${rs_y} ]; then
+ continue
+ fi
+ if [ -d ${initdir}/${rs_y} ]; then
+ continue
+ fi
+ tmpdeplist="${tmpdeplist} ${rs_y}"
+ ;;
+ esac
+ done
+ deplist=${tmpdeplist}
+ for rs_x in ${runlist}; do
+ pop_list_item ${rs_x} ${deplist}
+ deplist=${tmppop}
+ done
+ eval array_${1}=\"${deplist}\"
+}
+
+get_prereqs()
+{
+ set_initlist
+ for gp_x in ${initlist}; do
+ tmp=$(${initdir}/${gp_x} prereqs)
+ eval array_${gp_x}=\"${tmp}\"
+ done
+}
+
+count_unsatisfied()
+{
+ set -- ${@}
+ return ${#}
+}
+
+# Removes $1 from initlist
+pop_list_item()
+{
+ item=${1}
+ shift
+ set -- ${@}
+ unset tmppop
+ # Iterate
+ for pop in ${@}; do
+ if [ ${pop} = ${item} ]; then
+ continue
+ fi
+ tmppop="${tmppop} ${pop}"
+ done
+
+}
+
+# This function generates the runlist, so we clear it first.
+reduce_prereqs()
+{
+ unset runlist
+ set -- ${initlist}
+ i=$#
+ # Loop until there's no more in the queue to loop through
+ while [ ${i} -ne 0 ]; do
+ oldi=${i}
+ for rp_x in ${initlist}; do
+ reduce_satisfied ${rp_x}
+ count_unsatisfied $(render array_${rp_x})
+ cnt=${?}
+ if [ ${cnt} -eq 0 ]; then
+ runlist="${runlist} ${rp_x}"
+ pop_list_item ${rp_x} ${initlist}
+ initlist=${tmppop}
+ i=$((${i} - 1))
+ fi
+ done
+ if [ ${i} -eq ${oldi} ]; then
+ panic "PANIC: Circular dependancy. Exiting."
+ fi
+ done
+}
+
+call_scripts()
+{
+ for cs_x in ${runlist}; do
+ if [ x"$1" = "xoptional" ]; then
+ option=$(sed '/^OPTION=/!d;$d;s/^OPTION=//;s/[[:space:]]*$//' "${initdir}/${cs_x}")
+ [ -z "${option}" ] || eval test -n \"\${$option}\" -a \"\${$option}\" != \"n\" || continue
+ fi
+
+ # mkinitramfs verbose output
+ if [ "${verbose}" = "y" ]; then
+ echo "Calling hook ${cs_x}"
+ fi
+ ${initdir}/${cs_x}
+ # allow boot scripts to modify exported boot paramaters
+ if [ -e /conf/param.conf ]; then
+ . /conf/param.conf
+ fi
+ done
+}
+
+run_scripts()
+{
+ initdir=${1}
+ [ ! -d ${initdir} ] && return
+ get_prereqs
+ reduce_prereqs
+ call_scripts $2
+}
+
+# Load custom modules first
+load_modules()
+{
+ if [ -e /conf/modules ]; then
+ cat /conf/modules | while read m; do
+ # Skip empty lines
+ if [ -z "$m" ]; then
+ continue
+ fi
+ # Skip comments - d?ash removes whitespace prefix
+ com=$(printf "%.1s" "${m}")
+ if [ "$com" = "#" ]; then
+ continue
+ fi
+ modprobe $m
+ done
+ fi
+}
+
+# lilo compatibility
+parse_numeric() {
+ case $1 in
+ "")
+ return
+ ;;
+ /*)
+ return
+ ;;
+ *:*)
+ minor=${1#*:}
+ major=${1%:*}
+ ;;
+ *)
+ value=$(( 0x${1} ))
+ minor=$(( ${value} % 256 ))
+ major=$(( ${value} / 256 ))
+ ;;
+ esac
+
+ mknod -m 600 /dev/root b ${major} ${minor}
+ ROOT=/dev/root
+}
+
+configure_networking()
+{
+ # networking already configured thus bail out
+ [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
+
+ # support ip options see linux sources Documentation/nfsroot.txt
+ case ${IPOPTS} in
+ none|off)
+ # Do nothing
+ ;;
+ ""|on|any)
+ # Bring up device
+ ipconfig -t 60 ${DEVICE}
+ ;;
+ dhcp|bootp|rarp|both)
+ ipconfig -t 60 -c ${IPOPTS} -d ${DEVICE}
+ ;;
+ *)
+ ipconfig -t 60 -d $IPOPTS
+
+ # grab device entry from ip option
+ NEW_DEVICE=${IPOPTS#*:*:*:*:*:*}
+ if [ "${NEW_DEVICE}" != "${IPOPTS}" ]; then
+ NEW_DEVICE=${NEW_DEVICE%:*}
+ else
+ # wrong parse, possibly only a partial string
+ NEW_DEVICE=
+ fi
+ if [ -n "${NEW_DEVICE}" ]; then
+ DEVICE="${NEW_DEVICE}"
+ fi
+ ;;
+ esac
+
+ # source ipconfig output
+ if [ -n "${DEVICE}" ]; then
+ # source specific bootdevice
+ . /tmp/net-${DEVICE}.conf
+ else
+ # source any interface as not exaclty specified
+ . /tmp/net-*.conf
+ fi
+}
diff --git a/dyneIII/live-init-scripts/scripts/init-bottom/udev b/dyneIII/live-init-scripts/scripts/init-bottom/udev
new file mode 100755
index 0000000..39d8135
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-bottom/udev
@@ -0,0 +1,28 @@
+#!/bin/sh -e
+# initramfs init-bottom script for udev
+
+PREREQ=""
+
+# Output pre-requisites
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case "$1" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+# Stop udevd, we'll miss a few events while we run init, but we catch up
+pkill udevd
+
+# udevd might have been in the middle of something when we killed it,
+# but it doesn't matter because we'll do everything again in userspace
+rm -rf /dev/.udev/queue
+
+# Move /dev to the real filesystem
+mount -n -o move /dev ${rootmnt}/dev
diff --git a/dyneIII/live-init-scripts/scripts/init-premount/blacklist b/dyneIII/live-init-scripts/scripts/init-premount/blacklist
new file mode 100755
index 0000000..1dd9dbc
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-premount/blacklist
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# sanity check
+[ -z "${blacklist}" ] && exit 0
+
+# write blacklist to modprobe.d
+IFS=','
+for b in ${blacklist}; do
+ echo "blacklist $b" >> /etc/modprobe.d/initramfs
+done
diff --git a/dyneIII/live-init-scripts/scripts/init-top/all_generic_ide b/dyneIII/live-init-scripts/scripts/init-top/all_generic_ide
new file mode 100755
index 0000000..d3ac76d
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/all_generic_ide
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+if grep all_generic_ide /proc/cmdline 2>/dev/null; then
+ modprobe ata_generic all_generic_ide=1
+fi
diff --git a/dyneIII/live-init-scripts/scripts/init-top/compcache b/dyneIII/live-init-scripts/scripts/init-top/compcache
new file mode 100755
index 0000000..a9c04d4
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/compcache
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# find total amount of available ram
+TOTAL_RAM=$( grep MemTotal /proc/meminfo |tr -d ': [A-Z][a-z]')
+
+# Do not use compcache on the liveCD if we have more than 512M
+if [ "${BOOT}" = "casper" ]; then
+ if [ "${TOTAL_RAM}" -gt 524288 ]; then
+ exit 0
+ fi
+fi
+
+modprobe -q --ignore-install ramzswap disksize_kb="$(($(sed -nre 's/^MemTotal:\s*([0-9]+) kB$/\1/p' /proc/meminfo) * 25 / 100))"
diff --git a/dyneIII/live-init-scripts/scripts/init-top/console_setup b/dyneIII/live-init-scripts/scripts/init-top/console_setup
new file mode 100755
index 0000000..7045d4f
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/console_setup
@@ -0,0 +1,80 @@
+#! /bin/sh
+# A crude much-simplified clone of setupcon for use in the initramfs.
+
+PREREQ="framebuffer"
+
+prereqs () {
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /etc/default/console-setup
+
+[ "$ACTIVE_CONSOLES" ] || exit 0
+
+if [ "$VERBOSE_OUTPUT" = yes ]; then
+ verbose=
+else
+ verbose='>/dev/null 2>&1'
+fi
+
+for i in 1 2 3 4 5 6; do
+ [ -c /dev/tty$i ] || mknod /dev/tty$i c 4 $i
+done
+
+for console in $ACTIVE_CONSOLES; do
+ [ -w $console ] || continue
+
+ if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM$CHARMAP" ]; then
+ printf '\033%%G' >$console
+ else
+ printf '\033%%@' >$console
+ fi
+
+ if [ -f "$FONT" ]; then
+ FONT="/etc/console-setup/${FONT##*/}"
+ else
+ FONT="/etc/console-setup/$CODESET-$FONTFACE$FONTSIZE.psf.gz"
+ fi
+ if [ -f "$FONT" ]; then
+ if type consolechars >/dev/null 2>&1; then
+ eval consolechars -v --tty=$console -f "$FONT" $verbose
+ elif type setfont >/dev/null 2>&1; then
+ eval setfont -v -C $console "$FONT" $verbose
+ fi
+ fi
+
+ if [ -f "$ACM" ]; then
+ ACM="/etc/console-setup/${ACM##*/}"
+ else
+ ACM="/etc/console-setup/$CHARMAP.acm.gz"
+ fi
+ if [ -f "$ACM" ]; then
+ if type consolechars >/dev/null 2>&1; then
+ eval consolechars -v --tty=$console --acm "$ACM" \
+ $verbose
+ elif type setfont >/dev/null 2>&1; then
+ eval setfont -v -C "$console" -m "$ACM" $verbose
+ fi
+ fi
+
+ if type kbd_mode >/dev/null 2>&1; then
+ if [ "$CHARMAP" = UTF-8 ] || [ -z "$ACM" ]; then
+ kbd_mode -u <$console
+ else
+ kbd_mode -a <$console
+ fi
+ fi
+done
+
+if [ -f /etc/console-setup/cached.kmap.gz ] && type loadkeys >/dev/null; then
+ eval loadkeys /etc/console-setup/cached.kmap.gz $verbose
+fi
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/init-top/framebuffer b/dyneIII/live-init-scripts/scripts/init-top/framebuffer
new file mode 100755
index 0000000..9ffd000
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/framebuffer
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+OPTION=USPLASH
+PREREQ="udev"
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+# The options part of the kernel "video=" argument (i.e. everyting
+# after "video=<fbdriver>:") has very inconsistent rules.
+#
+# Generally the following applies:
+# 1) options are comma-separated
+# 2) options can be in either of these three forms:
+# <arg>=<value>, <arg>:<value>, <boolean-arg>.
+# 3) the "mode" option has the form <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m]
+# and may or may not start with "mode="
+#
+# When the options are used with modules, they need to be space-separated
+# and the following conversions are needed:
+# <arg>:<value> -> <arg>=<value>
+# <boolean-arg> -> <boolean-arg>=1
+# <modevalue> -> mode=<modevalue>
+parse_video_opts()
+{
+ local OPTS="$1"
+ local IFS=","
+
+ # Must be a line like video=<fbdriver>:<opt1>,[opt2]...
+ if [ "${OPTS}" = "${OPTS%%:*}" ]; then
+ return
+ fi
+ OPTS="${OPTS#*:}"
+ for opt in ${OPTS}; do
+ # Already in the "<arg>=<value>" form
+ if [ "${opt}" != "${opt#*=}" ]; then
+ echo -n "$opt "
+ # In the "<arg>:<value>" form
+ elif [ "${opt}" != "${opt#*:}" ]; then
+ echo -n "${opt%:*}=${opt#*:} "
+ # Presumably a modevalue without the "mode=" prefix
+ elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then
+ echo -n "mode=$opt "
+ # Presumably a boolean
+ else
+ echo -n "${opt}=1 "
+ fi
+ done
+}
+
+FB=""
+OPTS=""
+
+for x in $(cat /proc/cmdline); do
+ case ${x} in
+ vga=*)
+ FB="vesafb";
+ OPTS="";
+ ;;
+ video=*)
+ FB=${x#*=}
+ FB="${FB%%:*}"
+ OPTS="$(parse_video_opts "${x}")"
+ esac
+done
+
+# Map command line name to module name
+case ${FB} in
+matroxfb)
+ FB=matroxfb_base
+ ;;
+esac
+
+if [ -n "${FB}" ]; then
+ # Some framebuffer devices need character devices :-/
+ udevadm settle
+ MODPROBE_OPTIONS=-q modprobe ${FB} ${OPTS}
+ # Wait for the framebuffer devices to be ready
+ udevadm settle
+else
+ # If we have no graphics devices yet, wait for udev to settle
+ [ -d /sys/class/graphics/fb0 ] || udevadm settle
+fi
diff --git a/dyneIII/live-init-scripts/scripts/init-top/keymap b/dyneIII/live-init-scripts/scripts/init-top/keymap
new file mode 100755
index 0000000..f011abf
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/keymap
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+OPTS="-q"
+
+# Should terminal be in UTF8 mode?
+if [ -x /bin/kbd_mode ]; then
+ /bin/kbd_mode -u
+ OPTS="${OPTS} -u"
+fi
+
+# Load custom keymap
+if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]; then
+ loadkeys ${OPTS} /etc/boottime.kmap.gz
+fi
diff --git a/dyneIII/live-init-scripts/scripts/init-top/udev b/dyneIII/live-init-scripts/scripts/init-top/udev
new file mode 100755
index 0000000..8fe57c9
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/udev
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+# initramfs init-top script for udev
+
+PREREQ="all_generic_ide"
+
+# Output pre-requisites
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case "$1" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+# It's all over netlink now
+echo "" > /proc/sys/kernel/hotplug
+
+# Start the udev daemon to process events
+/sbin/udevd --daemon --resolve-names=never
+
+# Iterate sysfs and fire off everything; if we include a rule for it then
+# it'll get handled; otherwise it'll get handled later when we do this again
+# in the main boot sequence.
+/sbin/udevadm trigger
diff --git a/dyneIII/live-init-scripts/scripts/init-top/usplash b/dyneIII/live-init-scripts/scripts/init-top/usplash
new file mode 100755
index 0000000..b256b2c
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/init-top/usplash
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+OPTION=USPLASH
+PREREQ="framebuffer console_setup brltty"
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+SPLASH=false
+VERBOSE=true
+
+for x in $(cat /proc/cmdline); do
+ case $x in
+ splash*)
+ SPLASH=true
+ ;;
+ nosplash*)
+ SPLASH=false
+ ;;
+ esac
+done
+
+if [ $SPLASH = "true" ]; then
+ # Tell Upstart about usplash, so that it can synthesise a job.
+ # Relative paths are resolved relative to /dev/.initramfs; if we use
+ # an absolute path here, then we'll have trouble unlinking it later
+ # because our filesystem namespace will have gone away.
+ /sbin/usplash -p -c -t 60 --background --pidfile usplash.pid
+fi
diff --git a/dyneIII/live-init-scripts/scripts/live b/dyneIII/live-init-scripts/scripts/live
new file mode 100755
index 0000000..f412d41
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live
@@ -0,0 +1,1740 @@
+#!/bin/sh
+
+# set -e
+
+export PATH="/root/usr/bin:/root/usr/sbin:/root/bin:/root/sbin:/usr/bin:/usr/sbin:/bin:/sbin"
+
+echo "/root/lib" >> /etc/ld.so.conf
+echo "/root/usr/lib" >> /etc/ld.so.conf
+
+mountpoint="/live/image"
+LIVE_MEDIA_PATH="live"
+
+root_persistence="live-rw"
+home_persistence="home-rw"
+root_snapshot_label="live-sn"
+home_snapshot_label="home-sn"
+
+USERNAME="user"
+USERFULLNAME="Live user"
+HOSTNAME="host"
+
+mkdir -p "${mountpoint}"
+
+# Create /etc/mtab for debug purpose and future syncs
+if [ ! -d /etc ]
+then
+ mkdir /etc/
+fi
+
+if [ ! -f /etc/mtab ]
+then
+ touch /etc/mtab
+fi
+
+[ -f /etc/live.conf ] && . /etc/live.conf
+export USERNAME USERFULLNAME HOSTNAME
+
+. /scripts/live-helpers
+
+if [ ! -f /live.vars ]
+then
+ touch /live.vars
+fi
+
+Arguments ()
+{
+ PRESEEDS=""
+
+ for ARGUMENT in $(cat /proc/cmdline)
+ do
+ case "${ARGUMENT}" in
+ skipconfig)
+ NOACCESSIBILITY="Yes"
+ NOAPPARMOR="Yes"
+ NOAPTCDROM="Yes"
+ NOAUTOLOGIN="Yes"
+ NOCONSOLEKEYBOARD="Yes"
+ NOFASTBOOT="Yes"
+ NOFSTAB="Yes"
+ NOGNOMEPANEL="Yes"
+ NOHOSTS="Yes"
+ NOJOCKEY="Yes"
+ NOKPERSONALIZER="Yes"
+ NOLANGUAGESELECTOR="Yes"
+ NOLOCALES="Yes"
+ NONETWORKING="Yes"
+ NOPOLKITCONF="Yes"
+ NOPOWERMANAGEMENT="Yes"
+ NOPROGRAMCRASHES="Yes"
+ NOSUDO="Yes"
+ NOTIMEZONE="Yes"
+ NOUPDATENOTIFIER="Yes"
+ NOUSER="Yes"
+ NOXAUTOCONFIG="Yes"
+ NOXAUTOLOGIN="Yes"
+ NOXSCREENSAVER="Yes"
+
+ export NOACCESSIBILITY NOAPPARMOR NOAPTCDROM NOAUTOLOGIN NOCONSOLEKEYBOARD NOFASTBOOT NOFSTAB NOGNOMEPANEL NOHOSTS NOJOCKEY NOKPERSONALIZER NOLANGUAGESELECTOR NOLOCALES NONETWORKING NOPOLKITCONF NOPOWERMANAGEMENT NOPROGRAMCRASHES NOSUDO NOTIMEZONE NOUPDATENOTIFIER NOUSER NOXAUTOCONFIG NOXAUTOLOGIN NOXSCREENSAVER
+ ;;
+
+ access=*)
+ ACCESS="${ARGUMENT#access=}"
+ export ACCESS
+ ;;
+
+ console=*)
+ DEFCONSOLE="${ARGUMENT#*=}"
+ export DEFCONSOLE
+ ;;
+
+ debug)
+ DEBUG="Yes"
+ export DEBUG
+
+ set -x
+ ;;
+
+ ethdevice=*)
+ DEVICE="${ARGUMENT#ethdevice=}"
+ export DEVICE
+ ;;
+
+ fetch=*)
+ FETCH="${ARGUMENT#fetch=}"
+ export FETCH
+ ;;
+
+ forcepersistentfsck)
+ FORCEPERSISTENTFSCK="Yes"
+ export FORCEPERSISTENTFSCK
+ ;;
+
+ hook=*)
+ HOOK="${ARGUMENT#hook=}"
+ export HOOK
+ ;;
+
+ ftpfs=*)
+ FTPFS="${ARGUMENT#ftpfs=}"
+ export FTPFS
+ ;;
+
+ httpfs=*)
+ HTTPFS="${ARGUMENT#httpfs=}"
+ export HTTPFS
+ ;;
+
+ hostname=*)
+ HOSTNAME="${ARGUMENT#hostname=}"
+ LIVECONF="changed"
+ export HOSTNAME LIVECONF
+ ;;
+
+ isofrom=*|fromiso=*)
+ FROMISO="${ARGUMENT#*=}"
+ export FROMISO
+ ;;
+
+ username=*)
+ USERNAME="${ARGUMENT#username=}"
+ LIVECONF="changed"
+ export USERNAME LIVECONF
+ ;;
+
+ userfullname=*)
+ USERFULLNAME="${ARGUMENT#userfullname=}"
+ LIVECONF="changed"
+ export USERFULLNAME LIVECONF
+ ;;
+
+ ignore_uuid)
+ IGNORE_UUID="Yes"
+ export IGNORE_UUID
+ ;;
+
+ integrity-check)
+ INTEGRITY_CHECK="Yes"
+ export INTEGRITY_CHECK
+ ;;
+
+ ip=*)
+ STATICIP="${ARGUMENT#ip=}"
+
+ if [ -z "${STATICIP}" ]
+ then
+ STATICIP="frommedia"
+ fi
+
+ export STATICIP
+ ;;
+
+ keyb=*|kbd-chooser/method=*)
+ KBD="${ARGUMENT#*=}"
+ export KBD
+ ;;
+
+ klayout=*|console-setup/layoutcode=*)
+ KLAYOUT="${ARGUMENT#*=}"
+ export KLAYOUT
+ ;;
+
+ kvariant=*|console-setup/variantcode=*)
+ KVARIANT="${ARGUMENT#*=}"
+ export KVARIANT
+ ;;
+
+ kmodel=*|console-setup/modelcode=*)
+ KMODEL="${ARGUMENT#*=}"
+ export KMODEL
+ ;;
+
+ koptions=*)
+ KOPTIONS="${ARGUMENT#koptions=}"
+ export KOPTIONS
+ ;;
+
+ live-getty)
+ LIVE_GETTY="1"
+ export LIVE_GETTY
+ ;;
+
+ live-media=*|bootfrom=*)
+ LIVE_MEDIA="${ARGUMENT#*=}"
+ export LIVE_MEDIA
+ ;;
+
+ live-media-encryption=*|encryption=*)
+ LIVE_MEDIA_ENCRYPTION="${ARGUMENT#*=}"
+ export LIVE_MEDIA_ENCRYPTION
+ ;;
+
+ live-media-offset=*)
+ LIVE_MEDIA_OFFSET="${ARGUMENT#live-media-offset=}"
+ export LIVE_MEDIA_OFFSET
+ ;;
+
+ live-media-path=*)
+ LIVE_MEDIA_PATH="${ARGUMENT#live-media-path=}"
+ export LIVE_MEDIA_PATH
+ ;;
+
+ live-media-timeout=*)
+ LIVE_MEDIA_TIMEOUT="${ARGUMENT#live-media-timeout=}"
+ export LIVE_MEDIA_TIMEOUT
+ ;;
+
+ language=*|debian-installer/language=*)
+ language=${x#debian-installer/language=}
+ locale="$(lang2locale "$language")"
+ set_locale="true"
+ ;;
+
+ locale=*|debian-installer/locale=*)
+ LOCALE="${ARGUMENT#*=}"
+ export LOCALE
+ ;;
+
+ module=*)
+ MODULE="${ARGUMENT#module=}"
+ export MODULE
+ ;;
+
+ netboot=*)
+ NETBOOT="${ARGUMENT#netboot=}"
+ export NETBOOT
+ ;;
+
+ nfsopts=*)
+ NFSOPTS="${ARGUMENT#nfsopts=}"
+ export NFSOPTS
+ ;;
+
+ nfscow=*)
+ NFS_COW="${ARGUMENT#nfscow=}"
+ export NFS_COW
+ ;;
+
+ noaccessibility)
+ NOACCESSIBILITY="Yes"
+ export NOACCESSIBILITY
+ ;;
+
+ noapparmor)
+ NOAPPARMOR="Yes"
+ export NOAPPARMOR
+ ;;
+
+ noaptcdrom)
+ NOAPTCDROM="Yes"
+ export NOAPTCDROM
+ ;;
+
+ noautologin)
+ NOAUTOLOGIN="Yes"
+ export NOAUTOLOGIN
+ ;;
+
+ noxautologin)
+ NOXAUTOLOGIN="Yes"
+ export NOXAUTOLOGIN
+ ;;
+
+ noconsolekeyboard)
+ NOCONSOLEKEYBOARD="Yes"
+ export NOCONSOLEKEYBOARD
+ ;;
+
+ nofastboot)
+ NOFASTBOOT="Yes"
+ export NOFASTBOOT
+ ;;
+
+ nofstab)
+ NOFSTAB="Yes"
+ export NOFSTAB
+ ;;
+
+ nognomepanel)
+ NOGNOMEPANEL="Yes"
+ export NOGNOMEPANEL
+ ;;
+
+ nohosts)
+ NOHOSTS="Yes"
+ export NOHOSTS
+ ;;
+
+ nokpersonalizer)
+ NOKPERSONALIZER="Yes"
+ export NOKPERSONALIZER
+ ;;
+
+ nolanguageselector)
+ NOLANGUAGESELECTOR="Yes"
+ export NOLANGUAGESELECTOR
+ ;;
+
+ nolocales)
+ NOLOCALES="Yes"
+ export NOLOCALES
+ ;;
+
+ nonetworking)
+ NONETWORKING="Yes"
+ export NONETWORKING
+ ;;
+
+ nopowermanagement)
+ NOPOWERMANAGEMENT="Yes"
+ export NOPOWERMANAGEMENT
+ ;;
+
+ noprogramcrashes)
+ NOPROGRAMCRASHES="Yes"
+ export NOPROGRAMCRASHES
+ ;;
+
+ nojockey)
+ NOJOCKEY="Yes"
+ export NOJOCKEY
+ ;;
+
+ nosudo)
+ NOSUDO="Yes"
+ export NOSUDO
+ ;;
+
+ swapon)
+ SWAPON="Yes"
+ export SWAPON
+ ;;
+
+ noupdatenotifier)
+ NOUPDATENOTIFIER="Yes"
+ export NOUPDATENOTIFIER
+ ;;
+
+ nouser)
+ NOUSER="Yes"
+ export NOUSER
+ ;;
+
+ noxautoconfig)
+ NOXAUTOCONFIG="Yes"
+ export NOXAUTOCONFIG
+ ;;
+
+ noxscreensaver)
+ NOXSCREENSAVER="Yes"
+ export NOXSCREENSAVER
+ ;;
+
+ persistent)
+ PERSISTENT="Yes"
+ export PERSISTENT
+ ;;
+
+ persistent=*)
+ PERSISTENT="${ARGUMENT#persistent=}"
+ if [ -z "${PERSISTENT}" ]
+ then
+ PERSISTENT="Yes"
+ fi
+ export PERSISTENT
+ ;;
+
+ persistent-path=*)
+ PERSISTENT_PATH="${ARGUMENT#persistent-path=}"
+ export PERSISTENT_PATH
+ ;;
+
+ persistent-subtext=*)
+ root_persistence="${root_persistence}-${ARGUMENT#persistent-subtext=}"
+ home_persistence="${home_persistence}-${ARGUMENT#persistent-subtext=}"
+ root_snapshot_label="${root_snapshot_label}-${ARGUMENT#persistent-subtext=}"
+ home_snapshot_label="${home_snapshot_label}-${ARGUMENT#persistent-subtext=}"
+ ;;
+
+ nopersistent)
+ NOPERSISTENT="Yes"
+ export NOPERSISTENT
+ ;;
+
+ preseed/file=*|file=*)
+ LOCATION="${ARGUMENT#*=}"
+ export LOCATION
+ ;;
+
+ nopreseed)
+ NOPRESEED="Yes"
+ export NOPRESEED
+ ;;
+
+ url=*)
+ location="${ARGUMENT#url=}"
+
+ mount -o bind /sys /root/sys
+ mount -o bind /proc /root/proc
+ mount -o bind /dev /root/dev
+
+ mkdir -p /root/var/run/network
+ [ "${NETBOOT}" ] || chroot /root dhclient eth0
+ chroot /root wget -P /tmp "${location}"
+ [ "${NETBOOT}" ] || chroot /root ifconfig eth0 down
+
+ umount /root/sys
+ umount /root/proc
+ umount /root/dev
+
+ LOCATION="/tmp/$(basename "${location}")"
+ ;;
+
+ */*=*)
+ question="${ARGUMENT%%=*}"
+ value="${ARGUMENT#*=}"
+ PRESEEDS="${PRESEEDS}\"${question}=${value}\" "
+ export PRESEEDS
+ ;;
+
+ showmounts)
+ SHOWMOUNTS="Yes"
+ export SHOWMOUNTS
+ ;;
+
+ silent)
+ SILENT="Yes"
+ export SILENT
+ ;;
+
+ textonly)
+ TEXTONLY="Yes"
+ export TEXTONLY
+ ;;
+
+ timezone=*)
+ TIMEZONE="${ARGUMENT#timezone=}"
+ export TIMEZONE
+ ;;
+
+ notimezone)
+ NOTIMEZONE="Yes"
+ export NOTIMEZONE
+ ;;
+
+ todisk=*)
+ TODISK="${ARGUMENT#todisk=}"
+ export TODISK
+ ;;
+
+ toram)
+ TORAM="Yes"
+ export TORAM
+ ;;
+
+ toram=*)
+ TORAM="Yes"
+ MODULETORAM="${ARGUMENT#toram=}"
+ export TORAM MODULETORAM
+ ;;
+
+ exposedroot)
+ EXPOSED_ROOT="Yes"
+ export EXPOSED_ROOT
+ ;;
+
+ plainroot)
+ PLAIN_ROOT="Yes"
+ export PLAIN_ROOT
+ ;;
+
+ skipunion)
+ SKIP_UNION_MOUNTS="Yes"
+ export SKIP_UNION_MOUNTS
+ ;;
+
+ root=*)
+ ROOT="${ARGUMENT#root=}"
+ export ROOT
+ ;;
+
+ union=*)
+ UNIONTYPE="${ARGUMENT#union=}"
+ export UNIONTYPE
+ ;;
+
+ utc=*)
+ UTC="${ARGUMENT#utc=}"
+ export UTC
+ ;;
+
+ xdebconf)
+ XDEBCONF="Yes"
+ export XDEBCONF
+ ;;
+
+ xdriver=*)
+ XDRIVER="${ARGUMENT#xdriver=}"
+ export XDRIVER
+ ;;
+
+ xvideomode=*)
+ XVIDEOMODE="${ARGUMENT#xvideomode=}"
+ export XVIDEOMODE
+ ;;
+ esac
+ done
+
+ # sort of compatibility with netboot.h from linux docs
+ if [ -z "${NETBOOT}" ]
+ then
+ if [ "${ROOT}" = "/dev/nfs" ]
+ then
+ NETBOOT="nfs"
+ export NETBOOT
+ elif [ "${ROOT}" = "/dev/cifs" ]
+ then
+ NETBOOT="cifs"
+ export NETBOOT
+ fi
+ fi
+
+ if [ -z "${MODULE}" ]
+ then
+ MODULE="filesystem"
+ export MODULE
+ fi
+
+ if [ -z "${UNIONTYPE}" ]
+ then
+ UNIONTYPE="aufs"
+ export UNIONTYPE
+ fi
+}
+
+is_live_path ()
+{
+ DIRECTORY="${1}"
+
+ if [ -d "${DIRECTORY}"/"${LIVE_MEDIA_PATH}" ]
+ then
+ for FILESYSTEM in squashfs ext2 ext3 ext4 xfs dir jffs2
+ do
+ if [ "$(echo ${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM})" != "${DIRECTORY}/${LIVE_MEDIA_PATH}/*.${FILESYSTEM}" ]
+ then
+ return 0
+ fi
+ done
+ fi
+
+ return 1
+}
+
+matches_uuid ()
+{
+ if [ "${IGNORE_UUID}" ] || [ ! -e /conf/uuid.conf ]
+ then
+ return 0
+ fi
+
+ path="${1}"
+ uuid="$(cat /conf/uuid.conf)"
+
+ for try_uuid_file in "${path}/.disk/live-uuid"*
+ do
+ [ -e "${try_uuid_file}" ] || continue
+
+ try_uuid="$(cat "${try_uuid_file}")"
+
+ if [ "${uuid}" = "${try_uuid}" ]
+ then
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+get_backing_device ()
+{
+ case "${1}" in
+ *.squashfs|*.ext2|*.ext3|*.ext4|*.jffs2)
+ echo $(setup_loop "${1}" "loop" "/sys/block/loop*" '0' "${LIVE_MEDIA_ENCRYPTION}" "${2}")
+ ;;
+
+ *.dir)
+ echo "directory"
+ ;;
+
+ *)
+ panic "Unrecognized live filesystem: ${1}"
+ ;;
+ esac
+}
+
+match_files_in_dir ()
+{
+ # Does any files match pattern ${1} ?
+ local pattern="${1}"
+
+ if [ "$(echo ${pattern})" != "${pattern}" ]
+ then
+ return 0
+ fi
+
+ return 1
+}
+
+mount_images_in_directory ()
+{
+ directory="${1}"
+ rootmnt="${2}"
+ mac="${3}"
+
+
+ if match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.squashfs" ||
+ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext2" ||
+ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext3" ||
+ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.ext4" ||
+ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.jffs2" ||
+ match_files_in_dir "${directory}/${LIVE_MEDIA_PATH}/*.dir"
+ then
+ [ -n "${mac}" ] && adddirectory="${directory}/${LIVE_MEDIA_PATH}/${mac}"
+ setup_unionfs "${directory}/${LIVE_MEDIA_PATH}" "${rootmnt}" "${adddirectory}"
+ else
+ panic "No supported filesystem images found at /${LIVE_MEDIA_PATH}."
+ fi
+}
+
+is_nice_device ()
+{
+ sysfs_path="${1#/sys}"
+
+ if /lib/udev/path_id "${sysfs_path}" | grep -E -q "ID_PATH=(usb|pci-[^-]*-(ide|scsi|usb)|platform-mmc)"
+ then
+ return 0
+ elif echo "${sysfs_path}" | grep -q '^/block/vd[a-z]$'
+ then
+ return 0
+ fi
+
+ return 1
+}
+
+copy_live_to ()
+{
+ copyfrom="${1}"
+ copytodev="${2}"
+ copyto="${copyfrom}_swap"
+
+ if [ -z "${MODULETORAM}" ]
+ then
+ size=$(fs_size "" ${copyfrom}/${LIVE_MEDIA_PATH} "used")
+ else
+ MODULETORAMFILE="${copyfrom}/${LIVE_MEDIA_PATH}/${MODULETORAM}"
+
+ if [ -f "${MODULETORAMFILE}" ]
+ then
+ size=$( expr $(ls -la ${MODULETORAMFILE} | awk '{print $5}') / 1024 + 5000 )
+ else
+ log_warning_msg "Error: toram-module ${MODULETORAM} (${MODULETORAMFILE}) could not be read."
+ return 1
+ fi
+ fi
+
+ if [ "${copytodev}" = "ram" ]
+ then
+ # copying to ram:
+ freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\<Cached/{print $2}' /proc/meminfo ) )
+ mount_options="-o size=${size}k"
+ free_string="memory"
+ fstype="tmpfs"
+ dev="/dev/shm"
+ else
+ # it should be a writable block device
+ if [ -b "${copytodev}" ]
+ then
+ dev="${copytodev}"
+ free_string="space"
+ fstype=$(get_fstype "${dev}")
+ freespace=$(fs_size "${dev}")
+ else
+ log_warning_msg "${copytodev} is not a block device."
+ return 1
+ fi
+ fi
+
+ if [ "${freespace}" -lt "${size}" ]
+ then
+ log_warning_msg "Not enough free ${free_string} (${freespace}k free, ${size}k needed) to copy live media in ${copytodev}."
+ return 1
+ fi
+
+ # begin copying (or uncompressing)
+ mkdir "${copyto}"
+ log_begin_msg "mount -t ${fstype} ${mount_options} ${dev} ${copyto}"
+ mount -t "${fstype}" ${mount_options} "${dev}" "${copyto}"
+
+ if [ "${extension}" = "tgz" ]
+ then
+ cd "${copyto}"
+ tar zxf "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
+ rm -f "${copyfrom}/${LIVE_MEDIA_PATH}/$(basename ${FETCH})"
+ mount -r -o move "${copyto}" "${rootmnt}"
+ cd "${OLDPWD}"
+ else
+ if [ -n "${MODULETORAMFILE}" ]
+ then
+ if [ -x /bin/rsync ]
+ then
+ echo " * Copying $MODULETORAMFILE to RAM" 1>/dev/console
+ rsync -a --progress ${MODULETORAMFILE} ${copyto} 1>/dev/console # copy only the filesystem module
+ else
+ cp ${MODULETORAMFILE} ${copyto} # copy only the filesystem module
+ fi
+ else
+ if [ -x /bin/rsync ]
+ then
+ echo " * Copying whole medium to RAM" 1>/dev/console
+ rsync -a --progress ${copyfrom}/* ${copyto} 1>/dev/console # "cp -a" from busybox also copies hidden files
+ else
+ mkdir -p ${copyto}/${LIVE_MEDIA_PATH}
+ cp -a ${copyfrom}/${LIVE_MEDIA_PATH}/* ${copyto}/${LIVE_MEDIA_PATH} # "cp -a" from busybox also copies hidden files
+ fi
+ fi
+
+ umount ${copyfrom}
+ mount -r -o move ${copyto} ${copyfrom}
+ fi
+
+ rmdir ${copyto}
+ return 0
+}
+
+do_netmount ()
+{
+ rc=1
+
+ modprobe -q af_packet # For DHCP
+
+ if [ -x /sbin/udevadm ]
+ then
+ # lenny
+ udevadm trigger
+ udevadm settle
+ else
+ # etch
+ udevtrigger
+ udevsettle
+ fi
+
+ ipconfig ${DEVICE} | tee /netboot.config
+
+ # source relevant ipconfig output
+ OLDHOSTNAME=${HOSTNAME}
+ . /tmp/net-${DEVICE}.conf
+ [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
+ export HOSTNAME
+
+ # Check if we have a network device at all
+ if ! ls /sys/class/net/eth0 > /dev/null 2>&1 && \
+ ! ls /sys/class/net/wlan0 > /dev/null 2>&1 && \
+ ! ls /sys/class/net/ath0 > /dev/null 2>&1 && \
+ ! ls /sys/class/net/ra0 > /dev/null 2>&1
+ then
+ panic "No supported network device found, maybe a non-mainline driver is required."
+ fi
+
+ if [ "${NFSROOT}" = "auto" ]
+ then
+ NFSROOT=${ROOTSERVER}:${ROOTPATH}
+ fi
+
+ if ( [ -n "${FETCH}" ] || [ -n "${HTTPFS}" ] || [ -n "${FTPFS}" ] ) && do_httpmount
+ then
+ rc=0
+ return ${rc}
+ fi
+
+ if [ "${NFSROOT#*:}" = "${NFSROOT}" ] && [ "$NETBOOT" != "cifs" ]
+ then
+ NFSROOT=${ROOTSERVER}:${NFSROOT}
+ fi
+
+ log_begin_msg "Trying netboot from ${NFSROOT}"
+
+ if [ "${NETBOOT}" != "nfs" ] && do_cifsmount
+ then
+ rc=0
+ elif do_nfsmount
+ then
+ NETBOOT="nfs"
+ export NETBOOT
+ rc=0
+ fi
+
+ log_end_msg
+ return ${rc}
+}
+
+do_httpmount ()
+{
+ rc=1
+ dest="${mountpoint}/${LIVE_MEDIA_PATH}"
+ mount -t ramfs ram "${mountpoint}"
+ mkdir -p "${dest}"
+
+ for webfile in HTTPFS FTPFS FETCH
+ do
+ url="$(eval echo \"\$\{${webfile}\}\")"
+ extension="$(echo "${url}" | sed 's/\(.*\)\.\(.*\)/\2/')"
+
+ if [ -n "$url" ]
+ then
+ case "${extension}" in
+ squashfs|tgz|tar)
+ if [ "${webfile}" = "FETCH" ]
+ then
+ case "$url" in
+ tftp*)
+ ip="$(dirname $url | sed -e 's|tftp://||g' -e 's|/.*$||g')"
+ rfile="$(echo $url | sed -e "s|tftp://$ip||g")"
+ lfile="$(basename $url)"
+ log_begin_msg "Trying tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip"
+ tftp -g -b 10240 -r $rfile -l ${dest}/$lfile $ip
+ ;;
+
+ *)
+ log_begin_msg "Trying wget ${url} -O ${dest}/$(basename ${url})"
+ wget "${url}" -O "${dest}/$(basename ${url})"
+ ;;
+ esac
+ else
+ log_begin_msg "Trying to mount ${url} on ${dest}/$(basename ${url})"
+ if [ "${webfile}" = "FTPFS" ]
+ then
+ FUSE_MOUNT="curlftpfs"
+ url="$(dirname ${url})"
+ else
+ FUSE_MOUNT="httpfs"
+ fi
+ modprobe fuse
+ $FUSE_MOUNT "${url}" "${dest}"
+ fi
+ [ ${?} -eq 0 ] && rc=0
+ [ "${extension}" = "tgz" ] && live_dest="ram"
+ break
+ ;;
+
+ *)
+ log_begin_msg "Unrecognized archive extension for ${url}"
+ ;;
+ esac
+ fi
+ done
+
+ if [ ${rc} != 0 ]
+ then
+ umount "${mountpoint}"
+ fi
+
+ return ${rc}
+}
+
+do_nfsmount ()
+{
+ rc=1
+
+ modprobe -q nfs
+
+ if [ -z "${NFSOPTS}" ]
+ then
+ NFSOPTS=""
+ fi
+
+ log_begin_msg "Trying nfsmount -o nolock -o ro ${NFSOPTS} ${NFSROOT} ${mountpoint}"
+
+ # FIXME: This while loop is an ugly HACK round an nfs bug
+ i=0
+ while [ "$i" -lt 60 ]
+ do
+ nfsmount -o nolock -o ro ${NFSOPTS} "${NFSROOT}" "${mountpoint}" && rc=0 && break
+ sleep 1
+ i="$(($i + 1))"
+ done
+
+ return ${rc}
+}
+
+do_cifsmount ()
+{
+ rc=1
+
+ if [ -x "/sbin/mount.cifs" ]
+ then
+ if [ -z "${NFSOPTS}" ]
+ then
+ CIFSOPTS="-ouser=root,password="
+ else
+ CIFSOPTS="${NFSOPTS}"
+ fi
+
+ log_begin_msg "Trying mount.cifs ${NFSROOT} ${mountpoint} ${CIFSOPTS}"
+ modprobe -q cifs
+
+ if mount.cifs "${NFSROOT}" "${mountpoint}" "${CIFSOPTS}"
+ then
+ rc=0
+ fi
+ fi
+
+ return ${rc}
+}
+
+do_snap_copy ()
+{
+ fromdev="${1}"
+ todir="${2}"
+ snap_type="${3}"
+ size=$(fs_size "${fromdev}" "" "used")
+
+ if [ -b "${fromdev}" ]
+ then
+ # look for free mem
+ if [ -n "${HOMEMOUNTED}" -a "${snap_type}" = "HOME" ]
+ then
+ todev=$(awk -v pat="$(base_path ${todir})" '$2 == pat { print $1 }' /proc/mounts)
+ freespace=$(df -k | awk '/'${todev}'/{print $4}')
+ else
+ freespace=$( expr $(awk '/MemFree/{print $2}' /proc/meminfo) + $( awk '/\<Cached/{print $2}' /proc/meminfo))
+ fi
+
+ tomount="/mnt/tmpsnap"
+
+ if [ ! -d "${tomount}" ]
+ then
+ mkdir -p "${tomount}"
+ fi
+
+ fstype=$(get_fstype "${fromdev}")
+
+ if [ -n "${fstype}" ]
+ then
+ # Copying stuff...
+ mount -o ro -t "${fstype}" "${fromdev}" "${tomount}" || log_warning_msg "Error in mount -t ${fstype} -o ro ${fromdev} ${tomount}"
+ cp -a "${tomount}"/* ${todir}
+ umount "${tomount}"
+ else
+ log_warning_msg "Unrecognized fstype: ${fstype} on ${fromdev}:${snap_type}"
+ fi
+
+ rmdir "${tomount}"
+
+ if echo ${fromdev} | grep -qs loop
+ then
+ losetup -d "${fromdev}"
+ fi
+
+ return 0
+ else
+ return 1
+
+ log_warning_msg "Unable to find the snapshot ${snap_type} medium"
+ fi
+}
+
+find_snap ()
+{
+ # Look for ${snap_label}.* in block devices
+ snap_label="${1}"
+
+ if [ "${PERSISTENT}" != "nofiles" ]
+ then
+ # search for image files
+ snapdata=$(find_files "${snap_label}.squashfs ${snap_label}.cpio.gz ${snap_label}.ext2 ${snap_label}.ext3 ${snap_label}.ext4 ${snap_label}.jffs2")
+ fi
+
+ if [ -z "${snapdata}" ]
+ then
+ snapdata=$(find_cow_device "${snap_label}")
+ fi
+ echo "${snapdata}"
+}
+
+try_snap ()
+{
+ # copy the contents of previously found snapshot to ${snap_mount}
+ # and remember the device and filename for resync on exit in live-initramfs.init
+
+ snapdata="${1}"
+ snap_mount="${2}"
+ snap_type="${3}"
+
+ if [ -n "${snapdata}" ] && [ ! -b "${snapdata}" ]
+ then
+ log_success_msg "found snapshot: ${snapdata}"
+ snapdev="$(echo ${snapdata} | cut -f1 -d ' ')"
+ snapback="$(echo ${snapdata} | cut -f2 -d ' ')"
+ snapfile="$(echo ${snapdata} | cut -f3 -d ' ')"
+
+ RES=""
+ if ! try_mount "${snapdev}" "${snapback}" "ro"
+ then
+ break
+ fi
+
+ if echo "${snapfile}" | grep -qs '\(squashfs\|ext2\|ext3\|ext4\|jffs2\)'
+ then
+ # squashfs, jffs2 or ext2/ext3/ext4 snapshot
+ dev=$(get_backing_device "${snapback}/${snapfile}")
+
+ do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
+ RES=$?
+ else
+ # cpio.gz snapshot
+ cd "${snap_mount}"
+ zcat "${snapback}/${snapfile}" | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories > /dev/null 2>&1
+ RES=$?
+ if [ "${RES}" != "0" ]
+ then
+ log_warning_msg "failure to \"zcat ${snapback}/${snapfile} | /bin/cpio --extract --preserve-modification-time --no-absolute-filenames --sparse --unconditional --make-directories\""
+ fi
+ cd "${OLDPWD}"
+ fi
+
+ umount "${snapback}" || log_warning_msg "failure to \"umount ${snapback}\""
+
+ if [ "${RES}" != "0" ]
+ then
+ log_warning_msg "Impossible to include the ${snapfile} Snapshot file"
+ fi
+
+ elif [ -b "${snapdata}" ]
+ then
+ # Try to find if it could be a snapshot partition
+ dev="${snapdata}"
+ log_success_msg "found snapshot ${snap_type} device on ${dev}"
+ if echo "${dev}" | grep -qs loop
+ then
+ # strange things happens, user confused?
+ snaploop=$( losetup ${dev} | awk '{print $3}' | tr -d '()' )
+ snapfile=$(basename ${snaploop})
+ snapdev=$(awk -v pat="$( dirname ${snaploop})" '$2 == pat { print $1 }' /proc/mounts)
+ else
+ snapdev="${dev}"
+ fi
+
+ if ! do_snap_copy "${dev}" "${snap_mount}" "${snap_type}"
+ then
+ log_warning_msg "Impossible to include the ${snap_type} Snapshot"
+ return 1
+ else
+ if [ -n "${snapfile}" ]
+ then
+ # it was a loop device, user confused
+ umount ${snapdev}
+ fi
+ fi
+ else
+ log_warning_msg "Impossible to include the ${snap_type} Snapshot"
+ return 1
+ fi
+
+ echo "export ${snap_type}SNAP="${snap_mount}":${snapdev}:${snapfile}" >> /etc/live.conf # for resync on reboot/halt
+ return 0
+}
+
+setup_unionfs ()
+{
+ image_directory="${1}"
+ rootmnt="${2}"
+ addimage_directory="${3}"
+ modprobe -q -b ${UNIONTYPE}
+
+ # run-init can't deal with images in a subdir, but we're going to
+ # move all of these away before it runs anyway. No, we're not,
+ # put them in / since move-mounting them into / breaks mono and
+ # some other apps.
+
+ croot="/"
+
+ # Let's just mount the read-only file systems first
+ rofsstring=""
+ rofslist=""
+ minor_kernel_version=$(uname -r|cut -c 5-|sed 's/[^0-9].*//')
+
+ if [ "${NETBOOT}" = "nfs" ] && [ "${minor_kernel_version}" -lt 22 ]
+ then
+ # go aroung a bug in nfs-unionfs locking for unionfs <= 1.4
+ roopt="nfsro"
+ elif [ "${UNIONTYPE}" = "aufs" ]
+ then
+ roopt="rr"
+ else
+ roopt="ro"
+ fi
+
+ if [ -z "${PLAIN_ROOT}" ]
+ then
+ # Read image names from ${MODULE}.module if it exists
+ if [ -e "${image_directory}/filesystem.${MODULE}.module" ]
+ then
+ for IMAGE in $(cat ${image_directory}/filesystem.${MODULE}.module)
+ do
+ image_string="${image_string} ${image_directory}/${IMAGE}"
+ done
+ elif [ -e "${image_directory}/${MODULE}.module" ]
+ then
+ for IMAGE in $(cat ${image_directory}/${MODULE}.module)
+ do
+ image_string="${image_string} ${image_directory}/${IMAGE}"
+ done
+ else
+ # ${MODULE}.module does not exist, create a list of images
+ for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
+ do
+ for IMAGE in "${image_directory}"/*."${FILESYSTEM}"
+ do
+ if [ -e "${IMAGE}" ]
+ then
+ image_string="${image_string} ${IMAGE}"
+ fi
+ done
+ done
+
+ if [ -n "${addimage_directory}" ] && [ -d "${addimage_directory}" ]
+ then
+ for FILESYSTEM in squashfs ext2 ext3 ext4 xfs jffs2 dir
+ do
+ for IMAGE in "${addimage_directory}"/*."${FILESYSTEM}"
+ do
+ if [ -e "${IMAGE}" ]
+ then
+ image_string="${image_string} ${IMAGE}"
+ fi
+ done
+ done
+ fi
+
+ # Now sort the list
+ image_string="$(echo ${image_string} | sed -e 's/ /\n/g' | sort )"
+ fi
+
+ [ -n "${MODULETORAMFILE}" ] && image_string="${image_directory}/$(basename ${MODULETORAMFILE})"
+
+ mkdir -p "${croot}"
+
+ for image in ${image_string}
+ do
+ imagename=$(basename "${image}")
+
+ export image devname
+ maybe_break live-realpremount
+ log_begin_msg "Running /scripts/live-realpremount"
+ run_scripts /scripts/live-realpremount
+ log_end_msg
+
+ if [ -d "${image}" ]
+ then
+ # it is a plain directory: do nothing
+ rofsstring="${image}=${roopt}:${rofsstring}"
+ rofslist="${image} ${rofslist}"
+ elif [ -f "${image}" ]
+ then
+ if losetup --help 2>&1 | grep -q -- "-r\b"
+ then
+ backdev=$(get_backing_device "${image}" "-r")
+ else
+ backdev=$(get_backing_device "${image}")
+ fi
+ fstype=$(get_fstype "${backdev}")
+
+ if [ "${fstype}" = "unknown" ]
+ then
+ panic "Unknown file system type on ${backdev} (${image})"
+ fi
+
+ if [ -z "${fstype}" ]
+ then
+ fstype="${imagename##*.}"
+ log_warning_msg "Unknown file system type on ${backdev} (${image}), assuming ${fstype}."
+ fi
+
+ mkdir -p "${croot}/${imagename}"
+ log_begin_msg "Mounting \"${image}\" on \"${croot}${imagename}\" via \"${backdev}\""
+ mount -t "${fstype}" -o ro,noatime "${backdev}" "${croot}/${imagename}" || panic "Can not mount ${backdev} (${image}) on ${croot}/${imagename}" && rofsstring="${croot}/${imagename}=${roopt}:${rofsstring}" && rofslist="${croot}/${imagename} ${rofslist}"
+ log_end_msg
+ fi
+ done
+ else
+ # we have a plain root system
+ mkdir -p "${croot}/filesystem"
+ log_begin_msg "Mounting \"${image_directory}\" on \"${croot}/filesystem\""
+ mount -t $(get_fstype "${image_directory}") -o ro,noatime "${image_directory}" "${croot}/filesystem" || panic "Can not mount ${image_directory} on ${croot}/filesystem" && rofsstring="${croot}/filesystem=${roopt}:${rofsstring}" && rofslist="${croot}/filesystem ${rofslist}"
+ # probably broken:
+ mount -o bind ${croot}/filesystem $mountpoint
+ log_end_msg
+ fi
+
+ rofsstring=${rofsstring%:}
+
+ mkdir -p /cow
+
+ # Looking for "${root_persistence}" device or file
+ if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
+ then
+ # Load USB modules
+ num_block=$(ls -l /sys/block | wc -l)
+ for module in sd_mod uhci-hcd ehci-hcd ohci-hcd usb-storage
+ do
+ modprobe -q -b ${module}
+ done
+
+ if [ -x /sbin/udevadm ]
+ then
+ # lenny
+ udevadm trigger
+ udevadm settle
+ else
+ # etch
+ udevtrigger
+ udevsettle
+ fi
+
+ # For some reason, udevsettle does not block in this scenario,
+ # so we sleep for a little while.
+ #
+ # See https://bugs.launchpad.net/ubuntu/+source/casper/+bug/84591
+ for timeout in 5 4 3 2 1
+ do
+ sleep 1
+
+ if [ $(ls -l /sys/block | wc -l) -gt ${num_block} ]
+ then
+ break
+ fi
+ done
+
+ # search for label and files (this could be hugely optimized)
+ cowprobe=$(find_cow_device "${root_persistence}")
+ if [ -b "${cowprobe}" ]
+ then
+ # Blacklist /cow device, to avoid inconsistent setups for overlapping snapshots
+ # makes sense to have both persistence for /cow and /home mounted, maybe also with
+ # snapshots to be sure to really store some e.g key config files,
+ # but not on the same media
+ blacklistdev="${cowprobe}"
+ PERSISTENCE_IS_ON="1"
+ export PERSISTENCE_IS_ON
+ fi
+ # homecow just mount something on /home, this should be generalized some way
+ homecow=$(find_cow_device "${home_persistence}" "${blacklistdev}")
+ if [ -b "${homecow}" ]
+ then
+ PERSISTENCE_IS_ON="1"
+ export PERSISTENCE_IS_ON
+ fi
+ root_snapdata=$(find_snap "${root_snapshot_label}" "${blacklistdev}")
+ # This second type should be removed when snapshot will get smarter,
+ # hence when "/etc/live-snapshot*list" will be supported also by
+ # ext2|ext3|ext4|jffs2 snapshot types.
+ home_snapdata=$(find_snap "${home_snapshot_label}" "${blacklistdev}")
+
+ if [ -b "${cowprobe}" ]
+ then
+ cowdevice=${cowprobe}
+ cow_fstype=$(get_fstype "${cowprobe}")
+ cow_mountopt="rw,noatime"
+
+ if [ "${FORCEPERSISTENTFSCK}" = "Yes" ]
+ then
+ fsck -y ${cowdevice}
+ fi
+ else
+ log_warning_msg "Unable to find the persistent medium"
+ cowdevice="tmpfs"
+ cow_fstype="tmpfs"
+ cow_mountopt="rw,noatime,mode=755"
+ fi
+ elif [ -n "${NFS_COW}" ] && [ -z "${NOPERSISTENT}" ]
+ then
+ # check if there are any nfs options
+ if echo ${NFS_COW}|grep -q ','
+ then
+ nfs_cow_opts="-o nolock,$(echo ${NFS_COW}|cut -d, -f2-)"
+ nfs_cow=$(echo ${NFS_COW}|cut -d, -f1)
+ else
+ nfs_cow_opts="-o nolock"
+ nfs_cow=${NFS_COW}
+ fi
+ mac="$(get_mac)"
+ if [ -n "${mac}" ]
+ then
+ cowdevice=$(echo ${nfs_cow}|sed "s/client_mac_address/${mac}/")
+ cow_fstype="nfs"
+ else
+ panic "unable to determine mac address"
+ fi
+ else
+ cowdevice="tmpfs"
+ cow_fstype="tmpfs"
+ cow_mountopt="rw,noatime,mode=755"
+ fi
+
+ if [ "${cow_fstype}" = "nfs" ]
+ then
+ log_begin_msg \
+ "Trying nfsmount ${nfs_cow_opts} ${cowdevice} /cow"
+ nfsmount ${nfs_cow_opts} ${cowdevice} /cow || \
+ panic "Can not mount ${cowdevice} (n: ${cow_fstype}) on /cow"
+ else
+ mount -t ${cow_fstype} -o ${cow_mountopt} ${cowdevice} /cow || \
+ panic "Can not mount ${cowdevice} (o: ${cow_fstype}) on /cow"
+ fi
+
+ rofscount=$(echo ${rofslist} |wc -w)
+
+ if [ -n "${EXPOSED_ROOT}" ]
+ then
+ if [ ${rofscount} -ne 1 ]
+ then
+ panic "only one RO file system supported with exposedroot: ${rofslist}"
+ fi
+ exposedrootfs=${rofslist%% }
+
+ mount --bind ${exposedrootfs} ${rootmnt} || \
+ panic "bind mount of ${exposedrootfs} failed"
+
+ if [ -z "${SKIP_UNION_MOUNTS}" ]
+ then
+ cow_dirs='/var/tmp /var/lock /var/run /var/log /var/spool /home /var/lib/live'
+ else
+ cow_dirs=''
+ fi
+
+ for dir in ${cow_dirs}; do
+ mkdir -p /cow${dir}
+ mount -t ${UNIONTYPE} \
+ -o rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro \
+ ${UNIONTYPE} "${rootmnt}${dir}" || \
+ panic "mount ${UNIONTYPE} on ${rootmnt}${dir} failed with option \
+ rw,noatime,dirs=/cow${dir}=rw:${exposedrootfs}${dir}=ro"
+ done
+ else
+ mount -t ${UNIONTYPE} -o noatime,dirs=/cow=rw:${rofsstring} \
+ ${UNIONTYPE} "${rootmnt}" || panic "mount ${UNIONTYPE} on \
+ ${rootmnt} failed with option noatime,dirs=/cow=rw:${rofsstring}"
+ fi
+
+ # Correct the permissions of /:
+ chmod 0755 "${rootmnt}"
+
+ # tmpfs file systems
+ touch /etc/fstab
+ mkdir -p "${rootmnt}/live"
+ mount -t tmpfs tmpfs ${rootmnt}/live
+
+ # Adding other custom mounts
+ if [ -n "${PERSISTENT}" ] && [ -z "${NOPERSISTENT}" ]
+ then
+ # directly mount /home
+ # FIXME: add a custom mounts configurable system
+
+ if [ -b "${homecow}" ]
+ then
+ mount -t $(get_fstype "${homecow}") -o rw,noatime "${homecow}" "${rootmnt}/home"
+ export HOMEMOUNTED=1 # used to proper calculate free space in do_snap_copy()
+ else
+ log_warning_msg "Unable to find the persistent home medium"
+ fi
+
+ # Look for other snapshots to copy in
+ try_snap "${root_snapdata}" "${rootmnt}" "ROOT"
+ # This second type should be removed when snapshot grow smarter
+ try_snap "${home_snapdata}" "${rootmnt}/home" "HOME"
+ fi
+
+ if [ -n "${SHOWMOUNTS}" ]
+ then
+ for d in ${rofslist}
+ do
+ mkdir -p "${rootmnt}/live/${d##*/}"
+
+ case d in
+ *.dir)
+ # do nothing # mount -o bind "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+
+ *)
+ mount -o move "${d}" "${rootmnt}/live/${d##*/}"
+ ;;
+ esac
+ done
+ fi
+
+ # shows cow fs on /cow for use by live-snapshot
+ mkdir -p "${rootmnt}/live/cow"
+ mount -o move /cow "${rootmnt}/live/cow" >/dev/null 2>&1 || mount -o bind /cow "${rootmnt}/live/cow" || log_warning_msg "Unable to move or bind /cow to ${rootmnt}/live/cow"
+}
+
+check_dev ()
+{
+ sysdev="${1}"
+ devname="${2}"
+ skip_uuid_check="${3}"
+
+ # support for fromiso=.../isofrom=....
+ if [ -n "$FROMISO" ]
+ then
+ # fixes by Jaromil to support FAT usb partitions
+ is_supported_fs vfat
+ mkdir -p /isofrom
+ ISO_DEVICE="$(echo $FROMISO | sed 's|\(/dev/[a-z]*[0-9]*\).*|\1|')"
+ mount "$ISO_DEVICE" /isofrom
+ ISO_NAME="$(echo $FROMISO | sed 's|/dev/[a-z]*[0-9]*/||')"
+ loopdevname=$(setup_loop "/isofrom/${ISO_NAME}" "loop" "/sys/block/loop*" "" '')
+ devname="${loopdevname}"
+ fi
+
+ if [ -z "${devname}" ]
+ then
+ devname=$(sys2dev "${sysdev}")
+ fi
+
+ if [ -d "${devname}" ]
+ then
+ mount -o bind "${devname}" $mountpoint || continue
+
+ if is_live_path $mountpoint
+ then
+ echo $mountpoint
+ return 0
+ else
+ umount $mountpoint
+ fi
+ fi
+
+ if [ -n "${LIVE_MEDIA_OFFSET}" ]
+ then
+ loopdevname=$(setup_loop "${devname}" "loop" "/sys/block/loop*" "${LIVE_MEDIA_OFFSET}" '')
+ devname="${loopdevname}"
+ fi
+
+ fstype=$(get_fstype "${devname}")
+
+ if is_supported_fs ${fstype}
+ then
+ mount -t ${fstype} -o ro,noatime "${devname}" ${mountpoint} || continue
+
+ if is_live_path ${mountpoint} && \
+ ([ "${skip_uuid_check}" ] || matches_uuid ${mountpoint})
+ then
+ echo ${mountpoint}
+ return 0
+ else
+ umount ${mountpoint}
+ fi
+ fi
+
+ if [ -n "${LIVE_MEDIA_OFFSET}" ]
+ then
+ losetup -d "${loopdevname}"
+ fi
+
+ return 1
+}
+
+find_livefs ()
+{
+ timeout="${1}"
+
+ # don't start autodetection before timeout has expired
+ if [ -n "${LIVE_MEDIA_TIMEOUT}" ]
+ then
+ if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ]
+ then
+ return 1
+ fi
+ fi
+
+ # first look at the one specified in the command line
+ case "${LIVE_MEDIA}" in
+ removable-usb)
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ if [ "$(cat ${sysblock}/removable)" = "1" ]
+ then
+ if readlink ${sysblock} | grep -q usb ||
+ readlink ${sysblock}/device | grep -q usb # linux < 2.6.29
+ then
+ for dev in $(subdevices "${sysblock}")
+ do
+ if check_dev "${dev}"
+ then
+ return 0
+ fi
+ done
+ fi
+ fi
+ done
+ ;;
+
+ removable)
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ if [ "$(cat ${sysblock}/removable)" = "1" ]
+ then
+ for dev in $(subdevices "${sysblock}")
+ do
+ if check_dev "${dev}"
+ then
+ return 0
+ fi
+ done
+ fi
+ done
+ ;;
+
+ *)
+ if [ ! -z "${LIVE_MEDIA}" ]
+ then
+ if check_dev "null" "${LIVE_MEDIA}" "skip_uuid_check"
+ then
+ return 0
+ fi
+ fi
+ ;;
+ esac
+
+ # or do the scan of block devices
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+ do
+ devname=$(sys2dev "${sysblock}")
+ fstype=$(get_fstype "${devname}")
+
+ if /lib/udev/cdrom_id ${devname} > /dev/null
+ then
+ if check_dev "null" "${devname}"
+ then
+ return 0
+ fi
+ elif is_nice_device "${sysblock}"
+ then
+ for dev in $(subdevices "${sysblock}")
+ do
+ if check_dev "${dev}"
+ then
+ return 0
+ fi
+ done
+ elif [ "${fstype}" = "squashfs" -o \
+ "${fstype}" = "ext2" -o \
+ "${fstype}" = "ext3" -o \
+ "${fstype}" = "ext4" -o \
+ "${fstype}" = "jffs2" ]
+ then
+ # This is an ugly hack situation, the block device has
+ # an image directly on it. It's hopefully
+ # live-initramfs, so take it and run with it.
+ ln -s "${devname}" "${devname}.${fstype}"
+ echo "${devname}.${fstype}"
+ return 0
+ fi
+ done
+
+ return 1
+}
+
+set_usplash_timeout ()
+{
+ if [ -x /sbin/usplash_write ]
+ then
+ /sbin/usplash_write "TIMEOUT 120"
+ else if [ -x /sbin/splashy_update ] ; then
+ /sbin/splashy_update "TIMEOUT 120"
+ fi ; fi
+}
+
+integrity_check ()
+{
+ media_mountpoint="${1}"
+
+ log_begin_msg "Checking media integrity"
+
+ cd ${media_mountpoint}
+ /bin/md5sum -c md5sum.txt < /dev/tty8 > /dev/tty8
+ RC="${?}"
+
+ log_end_msg
+
+ if [ "${RC}" -eq 0 ]
+ then
+ log_success_msg "Everything ok, will reboot in 10 seconds."
+ sleep 10
+ cd /
+ umount ${media_mountpoint}
+ sync
+ echo u > /proc/sysrq-trigger
+ echo b > /proc/sysrq-trigger
+ else
+ panic "Not ok, a media defect is likely, switch to VT8 for details."
+ fi
+}
+
+mountroot ()
+{
+ if [ -x /scripts/local-top/cryptroot ]; then
+ /scripts/local-top/cryptroot
+ fi
+
+ exec 6>&1
+ exec 7>&2
+ exec > live.log
+ exec 2>&1
+ tail -f live.log >&7 &
+ tailpid="${!}"
+
+ # Ensure 'panic' function is overridden
+ . /scripts/live-functions
+
+ Arguments
+
+ set_usplash_timeout
+
+ maybe_break live-premount
+ log_begin_msg "Running /scripts/live-premount"
+ run_scripts /scripts/live-premount
+ log_end_msg
+
+ # Needed here too because some things (*cough* udev *cough*)
+ # changes the timeout
+
+ set_usplash_timeout
+
+ if [ ! -z "${NETBOOT}" ] || [ ! -z "${FETCH}" ] || [ ! -z "${HTTPFS}" ] || [ ! -z "${FTPFS}" ]
+ then
+ if do_netmount
+ then
+ livefs_root="${mountpoint}"
+ else
+ panic "Unable to find a live file system on the network"
+ fi
+ else
+ if [ -n "${PLAIN_ROOT}" ] && [ -n "${ROOT}" ]
+ then
+ # Do a local boot from hd
+ livefs_root=${ROOT}
+ else
+ # Scan local devices for the image
+ i=0
+ while [ "$i" -lt 60 ]
+ do
+ livefs_root=$(find_livefs ${i})
+
+ if [ -n "${livefs_root}" ]
+ then
+ break
+ fi
+
+ sleep 1
+ i="$(($i + 1))"
+ done
+ fi
+ fi
+
+ if [ -z "${livefs_root}" ]
+ then
+ panic "Unable to find a medium containing a live file system"
+ fi
+
+ if [ "${INTEGRITY_CHECK}" ]
+ then
+ integrity_check "${livefs_root}"
+ fi
+
+ if [ "${TORAM}" ]
+ then
+ live_dest="ram"
+ elif [ "${TODISK}" ]
+ then
+ live_dest="${TODISK}"
+ fi
+
+ if [ "${live_dest}" ]
+ then
+ log_begin_msg "Copying live media to ${live_dest}"
+ copy_live_to "${livefs_root}" "${live_dest}"
+ log_end_msg
+ fi
+
+ # if we do not unmount the ISO we can't run "fsck /dev/ice" later on
+ # because the mountpoint is left behind in /proc/mounts, so let's get
+ # rid of it when running from RAM
+ if [ -n "$FROMISO" ] && [ "${TORAM}" ]
+ then
+ losetup -d /dev/loop0
+ grep -q /isofrom /proc/mounts && umount /isofrom
+ fi
+
+ if [ -n "${MODULETORAMFILE}" ] || [ -n "${PLAIN_ROOT}" ]
+ then
+ setup_unionfs "${livefs_root}" "${rootmnt}"
+ else
+ mac="$(get_mac)"
+ mac="$(echo ${mac} | sed 's/-//g')"
+ mount_images_in_directory "${livefs_root}" "${rootmnt}" "${mac}"
+ fi
+
+ log_end_msg
+
+ maybe_break live-bottom
+ log_begin_msg "Running /scripts/live-bottom\n"
+
+ run_scripts /scripts/live-bottom
+ log_end_msg
+
+ exec 1>&6 6>&-
+ exec 2>&7 7>&-
+ kill ${tailpid}
+ [ -w "${rootmnt}/var/log/" ] && cp live.log "${rootmnt}/var/log/" 2>/dev/null
+}
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/02etc_live_conf b/dyneIII/live-init-scripts/scripts/live-bottom/02etc_live_conf
new file mode 100755
index 0000000..815e379
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/02etc_live_conf
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Copying config on real root fs"
+
+# live-initramfs script
+
+if [ -f /etc/live.conf ]
+then
+ if [ ! -z "${LIVECONF}" ]
+ then
+ # Updating live.conf
+ sed -i -e 's/\(USERNAME="\).*"/\1'"${USERNAME}"'"/g' \
+ -e 's/\(USERFULLNAME="\).*"/\1'"${USERFULLNAME}"'"/g' \
+ -e 's/\(HOSTNAME="\).*"/\1'"${HOSTNAME}"'"/g' \
+ /etc/live.conf
+ fi
+
+ cp -p /etc/live.conf /root/etc/live.conf
+else
+
+cat > /root/etc/live.conf << EOF
+export USERNAME="${USERNAME}"
+export USERFULLNAME="${USERFULLNAME}"
+export HOSTNAME="${HOSTNAME}"
+EOF
+
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/02timezone b/dyneIII/live-init-scripts/scripts/live-bottom/02timezone
new file mode 100755
index 0000000..64faf3b
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/02timezone
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOTIMEZONE}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Setting timezone"
+
+# live-initramfs script
+
+if [ -n "${TIMEZONE}" ]
+then
+ area="$(echo ${TIMEZONE} | cut -f1 -d '/')"
+ zone="$(echo ${TIMEZONE} | cut -f2 -d '/')"
+
+chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+set tzdata/Areas ${area}
+set tzdata/Zones/${area} ${zone}
+EOF
+
+ cp -f /root/usr/share/zoneinfo/${area}/${zone} /root/etc/localtime
+else
+
+chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+set tzdata/Areas Etc
+set tzdata/Zones/Etc UTC
+EOF
+
+ cp -f /root/usr/share/zoneinfo/UTC /root/etc/localtime
+fi
+
+if [ -n "${UTC}" ]
+then
+ sed -i -e "s/UTC=.*/UTC=${UTC}/" /root/etc/default/rcS
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/05mountpoints b/dyneIII/live-init-scripts/scripts/live-bottom/05mountpoints
new file mode 100755
index 0000000..ce151e1
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/05mountpoints
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Moving mount points"
+
+# live-initramfs script
+
+# Move to the new root filesystem so that programs there can get at it.
+if [ ! -d /root/live/image ]
+then
+ mkdir -p /root/live/image
+ mount --move /live/image /root/live/image
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/06hostname b/dyneIII/live-init-scripts/scripts/live-bottom/06hostname
new file mode 100755
index 0000000..b14703a
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/06hostname
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOHOSTS}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Setting hostname"
+
+# live-initramfs script
+
+# Change hostname only if it is not set
+if [ ! -f /root/etc/hostname ] || grep -qs localhost\.localdomain /root/etc/hostname
+then
+ echo "${HOSTNAME}" > /root/etc/hostname
+else
+ HOSTNAME="$(cat /root/etc/hostname)"
+ really_export HOSTNAME
+fi
+
+# Create /etc/hosts only if it is not present or empty
+if [ ! -s /root/etc/hosts ]
+then
+ cat > /root/etc/hosts << EOF
+127.0.0.1 localhost
+127.0.1.1 ${HOSTNAME}
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
+ff02::3 ip6-allhosts
+EOF
+fi
+
+hostname "${HOSTNAME}"
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/08persistence_excludes b/dyneIII/live-init-scripts/scripts/live-bottom/08persistence_excludes
new file mode 100755
index 0000000..b7aac92
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/08persistence_excludes
@@ -0,0 +1,77 @@
+#!/bin/sh
+
+# Persistence enhancer script
+# This script saves precious time on slow persistence devices/image files
+# and writes on flash based device.
+# a tmpfs on $PERSTMP is mounted and directories listed in
+# /etc/live-persistence.binds will be copied there and then bind mounted back.
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -z "${PERSISTENT}" ] || [ -n "${NOPERSISTENT}" ] || [ -z "${PERSISTENCE_IS_ON}" ] || [ ! -f /root/etc/live-persistence.binds ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+# live-initramfs script
+
+dirs="$(sed -e '/^ *$/d' -e '/^#.*$/d' /root/etc/live-persistence.binds | tr '\n' '\0')"
+if [ -z "${dirs}" ]
+then
+ exit 0
+fi
+
+log_begin_msg "Moving persistence bind mounts"
+
+PERSTMP="/root/live/persistence-binds"
+CPIO="/bin/cpio"
+
+if [ ! -d "${PERSTMP}" ]
+then
+ mkdir -p "${PERSTMP}"
+fi
+
+mount -t tmpfs tmpfs "${PERSTMP}"
+
+for dir in $(echo "${dirs}" | tr '\0' '\n')
+do
+ if [ ! -e "/root/${dir}" ] && [ ! -L "/root/${dir}" ]
+ then
+ # directory do not exists, create it
+ mkdir -p "/root/${dir}"
+ elif [ ! -d "/root/${dir}" ]
+ then
+ # it is not a directory, skip it
+ break
+ fi
+
+ # Copy previous content if any
+ cd "/root/${dir}"
+ find . -print0 | ${CPIO} -pumd0 "${PERSTMP}/${dir}"
+ cd "${OLDPWD}"
+
+ # Bind mount it to origin
+ mount -o bind "${PERSTMP}/${dir}" "/root/${dir}"
+done
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/10adduser b/dyneIII/live-init-scripts/scripts/live-bottom/10adduser
new file mode 100755
index 0000000..8b15ebd
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/10adduser
@@ -0,0 +1,139 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOUSER}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Live session user already created, no need to create at every boot!"
+USERNAME="luther"
+really_export USERNAME
+
+######################################################################
+# creating the same user at every boot is STUPID. -asbesto
+######################################################################
+#
+#log_begin_msg "Adding live session user"
+
+# live-initramfs script
+
+#user_crypted="gknUSBr3TMNOs" # as in $(echo "luther" | mkpasswd -s)
+
+# U6aMy0wojraho is just a blank password
+#chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+#set passwd/make-user true
+#set passwd/root-password-crypted *
+#set passwd/user-password-crypted ${user_crypted}
+#set passwd/user-fullname ${USERFULLNAME}
+#set passwd/username ${USERNAME}
+#set passwd/user-uid 1000
+#EOF
+
+#chroot /root /usr/bin/env -i HOME="/root" \
+# TERM="${TERM}" PATH="/usr/sbin:/usr/bin:/sbin:/bin" \
+# /usr/lib/user-setup/user-setup-apply 2>&1 \
+# | grep -v "Shadow passwords are now on"
+
+# Clear out debconf database again to avoid confusing ubiquity later.
+#chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+#set passwd/make-user
+#set passwd/root-password-crypted
+#set passwd/user-password-crypted
+#set passwd/user-fullname
+#set passwd/username
+#set passwd/user-uid
+#EOF
+
+#if ! grep -qs "${USERNAME}" /root/etc/passwd
+#then
+# echo "The default user (${USERNAME}) is not present,"
+# first_user=$(grep '^[^:]*:[^:]*:[12]\?[0-9][0-9][0-9][0-9]:' /root/etc/passwd | head -1 | cut -f1 -d ':')
+# if [ -n "${first_user}" ];
+# then
+# echo "setting default user to: ${first_user}."
+# USERNAME="${first_user}"
+# really_export USERNAME
+# else
+# echo "no other valid users found, disabling autologin."
+# NOAUTOLOGIN="Yes"
+# NOXAUTOLOGIN="Yes"
+# USERNAME=""
+# really_export NOAUTOLOGIN
+# really_export NOXAUTOLOGIN
+# really_export USERNAME
+# log_end_msg
+# exit 0
+# fi
+#fi
+######################################################################
+
+if [ -z "${NOSUDO}" ]
+then
+ if ! grep -q "${USERNAME}" /root/etc/sudoers
+ then
+ echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" >> /root/etc/sudoers
+
+ chroot /root sudo -u "${USERNAME}" sh -c "echo 'SU_TO_ROOT_SU=sudo' >> /home/${USERNAME}/.su-to-rootrc"
+
+ if [ -x /root/usr/bin/gconftool-2 ]
+ then
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/sudo-mode true
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gksu/display-no-pass-info false
+ fi
+
+chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/config && cat > /home/${USERNAME}/.kde/share/config/kdesurc" << EOF
+[super-user-command]
+super-user-command=sudo
+EOF
+
+ if [ -f /root/usr/share/apps/konsole/sumc.desktop ]
+ then
+ chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo mc -c/' /usr/share/apps/konsole/sumc.desktop > /home/${USERNAME}/.kde/share/apps/konsole/sumc.desktop"
+ fi
+
+ if [ -f /root/usr/share/apps/konsole/su.desktop ]
+ then
+ chroot /root sudo -u "${USERNAME}" sh -c "umask 0077 && mkdir -p /home/${USERNAME}/.kde/share/apps/konsole && sed -e's/Exec=su.*$/Exec=sudo -i/' /usr/share/apps/konsole/su.desktop > /home/${USERNAME}/.kde/share/apps/konsole/su.desktop"
+ fi
+ fi
+fi
+
+if [ -L /root/home/${USERNAME}/Examples ]
+then
+ chroot /root install -o ${USERNAME} -g ${USERNAME} -d /home/${USERNAME}/Desktop/
+ mv /root/home/${USERNAME}/Examples /root/home/${USERNAME}/Desktop/
+fi
+
+if [ -f /root/home/$USERNAME/examples.desktop ]; then
+ chroot /root install -o $USERNAME -g $USERNAME -d /home/$USERNAME/Desktop/
+ mv /root/home/$USERNAME/examples.desktop /root/home/$USERNAME/Desktop/
+fi
+
+if [ -e /root/usr/share/applications/live-installer-launcher.desktop ]
+then
+ chroot /root install -D -o ${USERNAME} -g ${USERNAME} /usr/share/applications/live-installer-launcher.desktop /home/${USERNAME}/Desktop/live-installer-launcher.desktop
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/12fstab b/dyneIII/live-init-scripts/scripts/live-bottom/12fstab
new file mode 100755
index 0000000..cbc180b
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/12fstab
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+FSTAB=/root/etc/fstab
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+if [ -n "${NOFSTAB}" ]
+then
+ exit 0
+fi
+
+log_begin_msg "Configuring fstab"
+
+# live-initramfs script
+
+# Create a fake fstab only if it doesn't exist or if its the debootstrap template
+if [ ! -f "${FSTAB}" ] || grep -qs 'UNCONFIGURED FSTAB FOR BASE SYSTEM' "${FSTAB}"
+then
+
+cat > ${FSTAB} << EOF
+# /etc/fstab: static file system information.
+#
+# <file system> <mount point> <type> <options> <dump> <pass>
+
+EOF
+
+fi
+
+if ! grep -qs "^${UNIONTYPE}" "${FSTAB}"
+then
+ echo "${UNIONTYPE} / ${UNIONTYPE} rw 0 0" >> "${FSTAB}"
+fi
+
+if ! grep -qs "^tmpfs /tmp" "${FSTAB}"
+then
+ echo "tmpfs /tmp tmpfs nosuid,nodev 0 0" >> "${FSTAB}"
+fi
+
+if [ -n "${SWAPON}" ]
+then
+ devices=""
+
+ for device in /dev/[hs]d[a-z][0-9]*
+ do
+ if ! [ -b "${device}" ]
+ then
+ continue
+ fi
+
+ /lib/udev/blkid -o udev ${device%%[0-9]*} 2>/dev/null | grep -q "^ID_FS_USAGE=raid" && continue
+
+ magic=$(/bin/dd if="${device}" bs=4086 skip=1 count=1 2>/dev/null | /bin/dd bs=10 count=1 2>/dev/null) || continue
+
+ if [ "${magic}" = "SWAPSPACE2" -o "${magic}" = "SWAP-SPACE" ]
+ then
+ #log "Found ${device}"
+ devices="${devices} ${device}"
+ fi
+ done
+
+ # Remove all auto swap entries
+ if grep -qs "swap swap" "${FSTAB}"
+ then
+ grep -v "swap swap" "${FSTAB}" > "${FSTAB}".tmp
+ mv "${FSTAB}".tmp "${FSTAB}"
+ fi
+
+ # Add new swap entries
+ for device in ${devices}
+ do
+ echo "${device} swap swap defaults 0 0" >> "${FSTAB}"
+ done
+fi
+
+# disabled for now
+#rm -f /root/etc/rcS.d/S*checkroot.sh
+
+if [ "${NOFASTBOOT}" != "Yes" ]
+then
+ touch root/fastboot
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/14locales b/dyneIII/live-init-scripts/scripts/live-bottom/14locales
new file mode 100755
index 0000000..022a605
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/14locales
@@ -0,0 +1,131 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOLOCALES}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Setting up locales"
+
+# Cosmetic line wrapping for output of local-gen
+echo
+
+# live-initramfs script
+
+if [ -e /root/etc/default/locale ]
+then
+ grep_file=/root/etc/default/locale
+elif [ -e /root/etc/environment ]
+then
+ # Old locales policy
+ grep_file=/root/etc/environment
+fi
+
+if [ -n "${grep_file}" ]
+then
+ # use rootfs configured locale
+ locale=$(grep -s 'LANG=' ${grep_file} | sed s/'LANG='// | tr -d '"' )
+fi
+
+if [ -n "${LOCALE}" ]
+then
+ locale="${LOCALE}"
+ set_locale="true"
+fi
+
+if [ -z "${locale}" ]
+then
+ # Set a default one
+ locale=en_US.UTF-8
+ set_locale="true"
+fi
+
+if [ "${set_locale}" ]
+then
+ if echo "${locale}" | grep -sqE '^[[:lower:]]{2}$'
+ then
+ # input is like "locale=it", so we will convert and setup also the keyboard if not already set
+ if [ -z "${KBD}" ]
+ then
+ # FIXME: look if this keyb is supported
+ KBD="${locale}"
+ really_export KBD
+ fi
+
+ uploc=$(echo "${locale}" | tr '[a-z]' '[A-Z]')
+ locale="${locale}_${uploc}.UTF-8"
+ fi
+
+ LANG=
+ language="$(echo ${locale} | cut -d. -f1)"
+ eval $(awk '/^'"${locale}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /root/usr/share/i18n/SUPPORTED)
+
+ if [ -z "${LANG}" ]
+ then
+ # Try and fallback to another codepage for this language.
+ eval $(awk '/^'"${language}"'/ { print "LANG=" $1 " codepage=" $2; exit; }' /root/usr/share/i18n/SUPPORTED)
+
+ if [ -n "${LANG}" ]
+ then
+ log_warning_msg "Choosing locale '${LANG}' as '${locale}' is unsupported."
+ fi
+ fi
+
+ if [ -z "${LANG}" ]
+ then
+ log_warning_msg "Locale '${locale}' is unsupported."
+ codepage="UTF-8"
+ language="en_US"
+ locale="${language}.${codepage}"
+ LANG="${language}.${codepage}"
+ fi
+
+ if [ -d /root/etc/default/kdm.d/ ]
+ then
+ if ! grep -qs "^LANGUAGE" "${LANG}"
+ then
+ printf 'LANGUAGE=%s\n' "${LANG}" >> /root/etc/default/kdm.d/live-autologin
+ fi
+ elif [ -f /root/etc/kde3/kdm/kdmrc ]
+ then
+ sed -i -r -e "s/#Language=.*/Language=${language}/" \
+ /root/etc/kde3/kdm/kdmrc
+ fi
+
+ really_export LANG
+
+ printf 'LANG="%s"\n' "${LANG}" > /root/etc/default/locale
+ printf 'LANG="%s"\n' "${LANG}" > /root/etc/environment
+ printf '%s %s\n' "${LANG}" "${codepage}" > /root/etc/locale.gen
+
+ if [ -z "${SILENT}" ]
+ then
+ chroot /root /usr/sbin/locale-gen
+ else
+ chroot /root /usr/sbin/locale-gen > /dev/null 2>&1
+ fi
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/15autologin b/dyneIII/live-init-scripts/scripts/live-bottom/15autologin
new file mode 100755
index 0000000..38c3a8f
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/15autologin
@@ -0,0 +1,89 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /live.vars
+
+if [ -n "${NOXAUTOLOGIN}" ] || [ -z "${USERNAME}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Setting up automatic login"
+
+# live-initramfs script
+
+# chroot needed to handle symlinks correctly
+if chroot /root [ -f /etc/gdm/gdm-cdd.conf ]
+then
+ GDMCONF=/etc/gdm/gdm-cdd.conf
+else
+ GDMCONF=/etc/gdm/gdm.conf
+fi
+
+# chroot needed to handle symlinks correctly
+if chroot /root [ -f ${GDMCONF} ]
+then
+ # true hack ! -- nohar
+ chroot /root cp /usr/share/gdm/defaults.conf /etc/gdm/gdm.conf
+
+ # Configure GDM autologin
+ chroot /root \
+ sed -i -e "s/^AutomaticLoginEnable=.*\$/AutomaticLoginEnable=true/" \
+ -e "s/^AutomaticLogin=.*\$/AutomaticLogin=${USERNAME}/" \
+ -e "s/^TimedLoginEnable=.*\$/TimedLoginEnable=true/" \
+ -e "s/^TimedLogin=.*\$/TimedLogin=${USERNAME}/" \
+ -e "s/^TimedLoginDelay=.*\$/TimedLoginDelay=10/" \
+ ${GDMCONF}
+fi
+
+if [ -d /root/etc/default/kdm.d/ ]
+then
+ if ! grep -qs "^AUTOLOGIN" /root/etc/default/kdm.d/live-autologin
+ then
+
+cat >> /root/etc/default/kdm.d/live-autologin << EOF
+AUTOLOGINUSER=${USERNAME}
+AUTOLOGINAGAIN=true
+AUTOLOGINDELAY=0
+EOF
+
+ fi
+
+elif [ -f /root/etc/kde3/kdm/kdmrc ]
+then
+ # Configure KDM autologin
+ sed -i -r -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
+ -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=${USERNAME}/" \
+ -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
+ /root/etc/kde3/kdm/kdmrc
+elif [ -f /root/etc/kde4/kdm/kdmrc ]
+then
+ # Configure KDM-KDE4 autologin
+ sed -i -r -e "s/^#?AutoLoginEnable=.*\$/AutoLoginEnable=true/" \
+ -e "s/^#?AutoLoginUser=.*\$/AutoLoginUser=$USERNAME/" \
+ -e "s/^#?AutoReLogin=.*\$/AutoReLogin=true/" \
+ /root/etc/kde4/kdm/kdmrc
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/16umountfs b/dyneIII/live-init-scripts/scripts/live-bottom/16umountfs
new file mode 100755
index 0000000..64ad99d
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/16umountfs
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /live.vars
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling umountfs for live specific filesystems"
+
+# live-initramfs script
+
+if [ -e /root/etc/init.d/umountfs ]
+then
+ sed -i -e 's#pioodl $TMPFS_MTPTS)#pioodl $TMPFS_MTPTS | sed -e "s@\\ @\\n@" | grep -v ^/live)#' \
+ -e 's#pioodl $REG_MTPTS)#pioodl $REG_MTPTS | sed -e "s@\\ @\\n@" | grep -v ^/live | grep -v ^/filesystem) /#' \
+ /root/etc/init.d/umountfs
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/19keyboard b/dyneIII/live-init-scripts/scripts/live-bottom/19keyboard
new file mode 100755
index 0000000..d465698
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/19keyboard
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOCONSOLEKEYBOARD}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Setting up console keyboard"
+
+# live-initramfs script
+
+kbd=
+cslayout=
+csvariant=
+csmodel=
+
+# commandline
+if [ -n "${KBD}" ]
+then
+ kbd="${KBD}"
+else
+ kbd=us
+fi
+
+really_export kbd
+
+if [ -n "${KLAYOUT}" ]
+then
+ cslayout="${KLAYOUT}"
+fi
+
+if [ -n "${KVARIANT}" ]
+then
+ csvariant="${KVARIANT}"
+fi
+
+if [ -n "${KMODEL}" ]
+then
+ csmodel="${KMODEL}"
+fi
+
+if [ -x /root/bin/setupcon ] && [ -f /root/etc/default/console-setup ]
+then
+ if [ "${cslayout}" ]
+ then
+ chroot /root sed -i "s/^XKBLAYOUT=.*/XKBLAYOUT=\"${cslayout}\"/" \
+ /etc/default/console-setup
+
+ if [ "${csvariant}" ]
+ then
+ chroot /root sed -i "s/^XKBVARIANT=.*/XKBVARIANT=\"${csvariant}\"/" \
+ /etc/default/console-setup
+ else
+ live-preseed /root console-setup/variantcode '' false
+ fi
+
+ if [ "${csmodel}" ]
+ then
+ chroot /root sed -i "s/^XKBMODEL=.*/XKBMODEL=\"${csmodel}\"/" \
+ /etc/default/console-setup
+ else
+ live-preseed /root console-setup/modelcode '' false
+ fi
+ else
+ live-preseed /root console-setup/layoutcode '' false
+ live-preseed /root console-setup/variantcode '' false
+ live-preseed /root console-setup/modelcode '' false
+ fi
+
+ live-preseed /root console-setup/optionscode '' false
+ live-preseed /root console-setup/codesetcode '' false
+
+ sed -i 's/CONSOLE_SCREEN=$/CONSOLE_SCREEN=setupcon/; t END; b; : END; n; b END' /root/etc/init.d/usplash
+elif [ -e /root/usr/sbin/install-keymap ]
+then
+ chroot /root /usr/sbin/install-keymap ${kbd}
+ live-preseed /root debian-installer/keymap "${kbd}"
+ live-preseed /root kbd-chooser/method "${kbd}"
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/20xconfig b/dyneIII/live-init-scripts/scripts/live-bottom/20xconfig
new file mode 100755
index 0000000..f6a3f8d
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/20xconfig
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOXAUTOCONFIG}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+# live-initramfs script
+
+if [ "${TERM_TYPE}" = "serial" ]
+then
+ # Don't bother trying to configure or start X on a serial console
+ rm -f /root/etc/rc?.d/S??[gkx]dm
+ exit 0
+fi
+
+if [ -n "${TEXTONLY}" ]
+then
+ exit 0
+fi
+
+if [ ! -x /root/usr/bin/X ]
+then
+ exit 0
+fi
+
+log_begin_msg "Configuring X"
+
+locale=en_US.UTF-8
+
+mount -o bind /sys /root/sys
+mount -o bind /proc /root/proc
+mount -o bind /dev /root/dev
+
+if [ -n "${XDEBCONF}" -a -x /root/usr/sbin/xdebconfigurator ]
+then
+ # xdebconfigurator
+ chroot /root /usr/sbin/xdebconfigurator
+fi
+
+if [ -n "${KOPTIONS}" ]
+then
+ setoptions="set xserver-xorg/config/inputdevice/keyboard/options ${KOPTIONS}"
+fi
+
+if [ -n "${KVARIANT}" ]
+then
+ setvariant="set xserver-xorg/config/inputdevice/keyboard/variant ${KVARIANT}"
+fi
+
+if [ -n "${KMODEL}" ]
+then
+ setmodel="set xserver-xorg/config/inputdevice/keyboard/model ${KMODEL}"
+fi
+
+chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+set xserver-xorg/config/inputdevice/keyboard/layout ${kbd}
+${setvariant}
+${setmodel}
+${setoptions}
+EOF
+
+live-reconfigure /root xserver-xorg 2>&1 \
+ | grep -v "overwriting possibly-customised configuration" \
+ | grep -v "file; backup in /etc/X11/xorg.conf"
+umount /root/sys
+umount /root/proc
+umount /root/dev
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/21xdriver b/dyneIII/live-init-scripts/scripts/live-bottom/21xdriver
new file mode 100755
index 0000000..e86c310
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/21xdriver
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOXAUTOCONFIG}" ] || [ ! -x /root/usr/bin/X ] || [ -z "${XDRIVER}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Configuring X video driver"
+
+# live-initramfs script
+
+. /live.vars
+
+mount -o bind /sys /root/sys
+mount -o bind /proc /root/proc
+mount -o bind /dev /root/dev
+
+if [ "${XDRIVER}" != "dexconf" ]
+then
+
+chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+set xserver-xorg/autodetect_video_card false
+set xserver-xorg/config/device/driver ${XDRIVER}
+EOF
+
+fi
+
+chroot /root dexconf
+
+umount /root/sys
+umount /root/proc
+umount /root/dev
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/21xvidemode b/dyneIII/live-init-scripts/scripts/live-bottom/21xvidemode
new file mode 100755
index 0000000..1312530
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/21xvidemode
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOXAUTOCONFIG}" ]
+then
+ exit 0
+fi
+
+if [ ! -x /root/usr/bin/X ]
+then
+ exit 0
+fi
+
+[ -n "$XVIDEOMODE" ] || exit
+
+. /scripts/live-functions
+
+log_begin_msg "Configuring X video modes"
+
+# live-initramfs script
+
+. /live.vars
+
+if [ "${XVIDEOMODE}" = "auto" ]
+then
+ rm -f /root/etc/X11/Xsession.d/21xvidemode
+
+ exit 0
+fi
+
+if [ $(cat /root/etc/debian_version | sed 's|\..*$||') -ge 4 ]
+then
+ # lenny or newer
+ if [ -x "$(which xrandr 2>/dev/null)" ]
+ then
+ echo "xrandr -s ${XVIDEOMODE} || /bin/true" >> /root/etc/X11/Xsession.d/21xvidemode
+ fi
+else
+ # etch
+ mount -o bind /sys /root/sys
+ mount -o bind /proc /root/proc
+ mount -o bind /dev /root/dev
+
+chroot /root debconf-communicate -fnoninteractive live-initramfs > /dev/null << EOF
+set xserver-xorg/config/monitor/mode-list ${XVIDEOMODE}
+set xserver-xorg/config/display/modes ${XVIDEOMODE}
+EOF
+
+ chroot /root dexconf
+
+ umount /root/sys
+ umount /root/proc
+ umount /root/dev
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/22gnome_panel_data b/dyneIII/live-init-scripts/scripts/live-bottom/22gnome_panel_data
new file mode 100755
index 0000000..8f24bf4
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/22gnome_panel_data
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ ! -e /root/var/lib/dpkg/info/gnome-panel-data.list ] || [ -n "${NOGNOMEPANEL}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Configuring gnome-panel-data"
+
+# live-initramfs script
+
+if chroot /root laptop-detect > /dev/null 2>&1
+then
+ live-reconfigure /root gnome-panel-data
+fi
+
+if [ -n "${USERNAME}" ]
+then
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/panel/global/disable_lock_screen true
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/22screensaver b/dyneIII/live-init-scripts/scripts/live-bottom/22screensaver
new file mode 100755
index 0000000..584d234
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/22screensaver
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOXSCREENSAVER}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Configuring screensaver"
+
+# live-initramfs script
+
+gnome_screensaver_version=$(chroot /root dpkg-query -W --showformat='${Version}' gnome-screensaver 2>/dev/null) || gnome_screensaver_version=""
+
+if [ -n "${gnome_screensaver_version}" ]
+then
+ # Support legacy gconf value
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -t bool -s /apps/gnome-screensaver/lock false
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -t bool -s /apps/gnome-screensaver/lock_enabled false
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/22sslcert b/dyneIII/live-init-scripts/scripts/live-bottom/22sslcert
new file mode 100755
index 0000000..1950eef
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/22sslcert
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Regenerating SSL certificate..."
+
+# live-initramfs script
+
+if [ -x /root/usr/sbin/make-ssl-cert ]
+then
+ chroot /root /usr/sbin/make-ssl-cert generate-default-snakeoil --force-overwrite
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/23etc_modules b/dyneIII/live-init-scripts/scripts/live-bottom/23etc_modules
new file mode 100755
index 0000000..2240a1b
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/23etc_modules
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Preconfiguring /etc/modules"
+
+# live-initramfs script
+
+# load the right modules
+case "${DPKG_ARCH}" in
+ powerpc|ppc64)
+ echo snd_powermac >> /root/etc/modules
+ ;;
+esac
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/23networking b/dyneIII/live-init-scripts/scripts/live-bottom/23networking
new file mode 100755
index 0000000..72aaf12
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/23networking
@@ -0,0 +1,157 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NONETWORKING}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Preconfiguring networking"
+
+# live-initramfs script
+
+IFFILE="/root/etc/network/interfaces"
+
+if [ "${STATICIP}" = "frommedia" -a -e "${IFFILE}" ]
+then
+ # will use existent /etc/network/interfaces
+ log_end_msg
+ exit 0
+fi
+
+cat > "${IFFILE}" << EOF
+auto lo
+iface lo inet loopback
+
+EOF
+
+if [ -x /sbin/udevadm ]
+then
+ # lenny
+ udevadm trigger
+ udevadm settle
+else
+ # etch
+ udevtrigger
+ udevsettle
+fi
+
+if [ -z "${NETBOOT}" -a -n "${STATICIP}" -a "${STATICIP}" != "frommedia" ]
+then
+ parsed=$(echo "${STATICIP}" | sed -e 's/:/ /g')
+
+ for ifline in ${parsed}
+ do
+ ifname="$(echo ${ifline} | cut -f1 -d ',')"
+ ifaddress="$(echo ${ifline} | cut -f2 -d ',')"
+ ifnetmask="$(echo ${ifline} | cut -f3 -d ',')"
+ ifgateway="$(echo ${ifline} | cut -f4 -d ',')"
+
+cat >> "${IFFILE}" << EOF
+auto ${ifname}
+iface ${ifname} inet static
+ address ${ifaddress}
+ netmask ${ifnetmask}
+ gateway ${ifgateway}
+
+EOF
+
+ done
+else
+ if [ -z "${NETBOOT}" ]
+ then
+ # default, dhcp assigned
+ method="dhcp"
+ else
+ # make sure that the preconfigured interface would not get reassigned by dhcp
+ # on startup by ifup script - otherwise our root fs might be disconnected!
+ method="manual"
+ fi
+
+ # iterate the physical interfaces and add them to the interfaces list
+ if [ "${method}" != dhcp ] || ([ ! -x /root/usr/sbin/NetworkManager ] && [ ! -x /root/usr/sbin/wicd ])
+ then
+ for interface in /sys/class/net/eth* /sys/class/net/ath* /sys/class/net/wlan*
+ do
+ [ -e ${interface} ] || continue
+ i="$(basename ${interface})"
+
+cat >> "${IFFILE}" << EOF
+auto ${i}
+iface ${i} inet ${method}
+
+EOF
+
+ done
+ fi
+
+ if [ ! -f /root/etc/resolv.conf ] || [ -z "$(cat /root/etc/resolv.conf)" ]
+ then
+ if [ -f /netboot.config ]
+ then
+ # create a resolv.conf if it is not present or empty
+ cp /netboot.config /root/var/log/netboot.config
+
+ rc_search=$(cat netboot.config | awk '/domain/{print $3}')
+ rc_server0=$(cat netboot.config | awk '/dns0/{print $5}')
+ rc_server1=$(cat netboot.config | awk '/dns0/{print $8}')
+ rc_server0="nameserver ${rc_server0}"
+
+ if [ "${rc_server1}" = "0.0.0.0" ]
+ then
+ rc_server1=""
+ else
+ rc_server1="nameserver ${rc_server1}"
+ fi
+
+cat > /root/etc/resolv.conf << EOF
+# /etc/resolv.conf
+# Autogenerated by live-initramfs
+search ${rc_search}
+domain ${rc_search}
+${rc_server0}
+${rc_server1}
+EOF
+
+ cat /root/etc/resolv.conf >> /root/var/log/netboot.config
+ fi
+ fi
+fi
+
+#if [ ! -x /root/usr/sbin/NetworkManager ]
+#then
+# for i in eth0 eth1 eth2 ath0 wlan0
+# do
+# grep -q "iface ${i}" ${IFFILE} && continue
+#
+#cat >> "${IFFILE}" << EOF
+#auto ${i}
+#iface ${i} inet dhcp
+#
+#EOF
+#
+# done
+#fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/24preseed b/dyneIII/live-init-scripts/scripts/live-bottom/24preseed
new file mode 100755
index 0000000..2536bd0
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/24preseed
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOPRESEED}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Loading preseed file"
+
+# live-initramfs script
+
+if [ -e /preseed.cfg ]
+then
+ chroot /root debconf-set-selections < /preseed.cfg
+fi
+
+if [ -f "/root/${LOCATION}" ]
+then
+ chroot /root debconf-set-selections < "/root/${LOCATION}"
+fi
+
+if [ -n "${PRESEEDS}" ]
+then
+ for preseed in ${PRESEEDS}
+ do
+ question="${preseed%%=*}"
+ value="${preseed#*=}"
+
+ live-preseed /root "${question}" "${value}"
+ done
+fi
+
+reply="$(echo "GET preseed/early_command" | chroot /root debconf-communicate -fnoninteractive live-initramfs)"
+
+if [ "${reply#0 }" != "${reply}" ]
+then
+ reply="${reply#0 }"
+ sh -c "${reply}"
+fi
+
+# Clear out debconf database backup files to save memory.
+rm -f /root/var/cache/debconf/*.dat-old
+
+log_end_msg
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/25configure_init b/dyneIII/live-init-scripts/scripts/live-bottom/25configure_init
new file mode 100755
index 0000000..f55dd0e
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/25configure_init
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Setting up init"
+
+# live-initramfs script
+
+# Arrange for shells on virtual consoles, rather than login prompts
+
+if [ -z "${NOAUTOLOGIN}" ] && [ -n "${USERNAME}" ]
+then
+ if [ ! -z "${LIVE_GETTY}" ]
+ then
+ if echo "${DEFCONSOLE}" | grep -qs ttyS
+ then
+ # AUTOMATIC SERIAL CONSOLE #
+ PORT=$(echo "${DEFCONSOLE}" | \
+ sed -e 's%,.*%%')
+ SPEED=$(echo "${DEFCONSOLE}" | \
+ sed -e 's%ttyS[0-9]\+,%%' \
+ -e's%\([0-9]\+\).*%\1%')
+
+ if ! ( sed -n -e'/^[^#]/p' /root/etc/inittab | grep -qs ":respawn:/sbin/getty.*${PORT}" )
+ then
+ IDs="A B C D E F G H I J K L M N O P Q R S T Q U V V X Y Z 0 1 2 3 4 5 6 7 8 9"
+
+ for ID1 in ${IDs}
+ do
+ for ID2 in ${IDs}
+ do
+ ID="${ID1}${ID2}"
+
+ if ! grep "^${ID}:" /etc/inittab
+ then
+ #make sure it is not already in use
+ break 2
+ fi
+ done
+ done
+
+ echo "${ID}:2345:respawn:/sbin/live-getty -L ${PORT} ${SPEED} vt100" >> /root/etc/inittab
+ fi
+ fi
+
+ if [ -f /root/etc/inittab ]
+ then
+ sed -i -e'/^[^#]/s%respawn:/sbin/getty%respawn:/sbin/live-getty%' /root/etc/inittab
+ fi
+ else
+ if [ -f /root/etc/inittab ]
+ then
+ sed -i -e "s|^\([^:]*:[^:]*:[^:]*\):.*getty.*\<\(tty[0-9]*\).*$|\1:/bin/login -f ${USERNAME} </dev/\2 >/dev/\2 2>\&1|" /root/etc/inittab
+ fi
+
+ if [ "/root/etc/event.d/tty*" != "$(echo /root/etc/event.d/tty*)" ]
+ then
+ for f in /root/etc/event.d/tty*
+ do
+ sed -i -e "/^respawn$/!s|^respawn.*|respawn /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+ sed -i -e "s|^exec.*|exec /bin/login -f ${USERNAME} </dev/$(basename ${f}) > /dev/$(basename ${f}) 2>\&1|" ${f}
+ done
+ fi
+ fi
+
+ # Since we use autologin, lastlog doesn't make sense on the console.
+ sed -i '/^[^#].*pam_lastlog\.so/s/^/# /' /root/etc/pam.d/login
+fi
+
+# do not try to remove files if using file-rc
+if [ -d /root/etc/rc0.d ]
+then
+ # This has the nice side effect of the cron.{daily,weekly,monthly} jobs in
+ # /etc/crontab remaining disabled, yet also not run by anacron
+ if [ -x /root/usr/sbin/anacron ]
+ then
+ chroot /root dpkg-divert --add --rename --quiet /usr/sbin/anacron
+ ln -s /bin/true /root/usr/sbin/anacron
+ fi
+
+ # Avoid clobbering the user's clock
+ rm -f /root/etc/rc?.d/K??hwclock.sh
+fi
+
+# Disable readahead since it doesn't play well with squashfs + unionfs
+# use chmod instead of mv to not trigger unionfs bugs.
+if [ -e /root/sbin/readahead-list ]
+then
+ chmod -x /root/sbin/readahead-list
+fi
+
+log_end_msg
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/30accessibility b/dyneIII/live-init-scripts/scripts/live-bottom/30accessibility
new file mode 100755
index 0000000..3c51fa0
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/30accessibility
@@ -0,0 +1,196 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOACCESSIBILITY}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+if [ -z "${USERNAME}" ]
+then
+ echo "No default user for accessibility options."
+ exit 0
+fi
+
+log_begin_msg "Configuring accessibility options"
+
+# live-initramfs script
+
+gconf_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gconf2 2>/dev/null) || gconf_version=""
+
+gct ()
+{
+ if [ "${gconf_version}" ]
+ then
+ chroot /root sudo -u "${USERNAME}" gconftool-2 "${@}"
+ fi
+}
+
+remove_applet ()
+{
+ # Code to remove an applet from the default panel setup
+ # This is rather hacky, but I can't think of a one or two line regular
+ # expression to do this any more efficiently. Patches welcome. In
+ # addition, setting these via gconf also doesn't work for some reason.
+
+ local line_no prior_line next_line
+
+ line_no="$(grep -n "<string>$1</string>" /root/usr/share/gconf/defaults/05_panel-default-setup.entries | cut -f 1 -d :)"
+ prior_line="$((line_no-1))"
+ next_line="$((line_no+1))"
+
+ sed -i -n "${prior_line},${next_line}!p" /root/usr/share/gconf/defaults/05_panel-default-setup.entries
+
+ chroot /root update-gconf-defaults
+}
+
+case ${ACCESS} in
+ access=v1)
+ # Lesser Visual Impairment
+ gct -s -t string /desktop/gnome/interface/gtk_theme HighContrastLargePrint
+ gct -s -t string /desktop/gnome/interface/icon_theme HighContrast
+ gct -s -t string /desktop/gnome/interface/monospace_font_name "monospace 18"
+ gct -s -t string /desktop/gnome/interface/font_name "sans 18"
+ gct -s -t string /apps/metacity/general/theme Atlanta
+ gct -s -t string /desktop/gnome/background/picture_filename ""
+ gct -s -t string /desktop/gnome/background/picture_options none
+ gct -s -t string /desktop/gnome/background/primary_color \#666666
+ gct -s -t string /desktop/gnome/background/secondary_color \#7F7F7F
+ gct -s -t string /desktop/gnome/background/color_shading_type solid
+ gct -s -t int /desktop/gnome/peripherals/mouse/cursor_size 48
+ gct -s -t string /desktop/gnome/peripherals/mouse/cursor_theme whiteglass
+ ;;
+
+ access=v2)
+ # Moderate Visual Impairment
+ gct -s -t bool /desktop/gnome/interface/accessibility true
+ gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+ gct -s -t string /desktop/gnome/applications/at/visual/exec orca
+ gct -s -t bool /apps/gksu/disable-grab true
+ gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
+ sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
+
+ if [ -x /root/usr/bin/orca ]
+ then
+ mkdir -p /root/home/${USERNAME}/.orca
+ echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
+ echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
+ echo "orca.settings.enableMagnifier = True" >> /root/home/${USERNAME}/.orca/user-settings.py
+ chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
+ fi
+ ;;
+
+ access=v3)
+ # Blindness
+ # Disabled for now, until we know eSpeak works.
+ #gct -s -t bool /desktop/gnome/sound/enable_esd false
+ gct -s -t bool /desktop/gnome/interface/accessibility true
+ gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+ gct -s -t string /desktop/gnome/applications/at/visual/exec orca
+ gct -s -t bool /apps/gksu/disable-grab true
+ gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
+ sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
+
+ remove_applet fast_user_switch
+ if [ -x /root/usr/bin/pulse-session ]
+ then
+ touch /root/home/$USERNAME/.pulse_a11y_nostart
+ chroot /root chown $USERNAME.$USERNAME /home/$USERNAME/.pulse_a11y_nostart
+ mkdir -p /root/home/$USERNAME/.pulse
+ echo "autospawn = no" > /root/home/$USERNAME/.pulse/client.conf
+ chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.pulse
+ fi
+ if [ -x /root/usr/bin/orca ]
+ then
+ mkdir -p /root/home/$USERNAME/.orca
+ chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.orca
+ fi
+ ;;
+
+ braille=ask)
+ # Braille
+ gct -s -t bool /desktop/gnome/interface/accessibility true
+ gct -s -t bool /desktop/gnome/applications/at/visual/startup true
+ gct -s -t string /desktop/gnome/applications/at/visual/exec orca
+ gct -s -t bool /apps/gksu/disable-grab true
+ gct -s -t string /desktop/gnome/applications/window_manager/default /usr/bin/metacity
+ sed -i -e 's/# Host alias specification/Defaults\tenv_keep = "ORBIT_SOCKETDIR XDG_SESSION_COOKIE GTK_MODULES"\n\n# Host alias specification/g' /root/etc/sudoers
+
+ if [ -x /root/usr/bin/orca ]
+ then
+ mkdir -p /root/home/${USERNAME}/.orca
+ echo "import orca.settings" >> /root/home/${USERNAME}/.orca/user-settings.py
+ echo "orca.settings.enableSpeech = False" >> /root/home/${USERNAME}/.orca/user-settings.py
+ echo "orca.settings.enableBraille = True" >> /root/home/${USERNAME}/.orca/user-settings.py
+ laptop_detect
+ chroot /root chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}/.orca
+ fi
+
+ if [ -x /root/usr/bin/pulse-session ]
+ then
+ touch /root/home/$USERNAME/.pulse_a11y_nostart
+ chroot /root chown $USERNAME.$USERNAME /home/$USERNAME/.pulse_a11y_nostart
+ mkdir -p /root/home/$USERNAME/.pulse
+ echo "autospawn = no" > /root/home/$USERNAME/.pulse/client.conf
+ chroot /root chown -R $USERNAME.$USERNAME /home/$USERNAME/.pulse
+ fi
+
+ remove_applet fast_user_switch
+ ;;
+
+ access=m1)
+ # Minor Motor Difficulties
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/mousekeys_enable true
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep true
+ gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
+ gct -s -t bool /desktop/gnome/peripherals/keyboard/repeat true
+ gct -s -t int /desktop/gnome/peripherals/keyboard/delay 700
+ gct -s -t int /desktop/gnome/peripherals/keyboard/rate 10
+ gct -s -t bool /apps/gksu/disable-grab true
+
+ if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
+ then
+ sed -i 's/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
+ fi
+ ;;
+
+ access=m2)
+ # Motor Difficulties - pointing devices
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/enable true
+ gct -s -t bool /desktop/gnome/interface/accessibility true
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_enable true
+ gct -s -t bool /desktop/gnome/accessibility/keyboard/stickykeys_modifier_beep false
+ gct -s -t bool /desktop/accessibility/gnome/keyboard/stickykeys_two_key_off false
+ gct -s -t list --list-type=string /desktop/gnome/accessibility/startup/exec_ats [onboard]
+
+ if [ -e /root/etc/xdg/xfce4/mcs_settings/keyboard.xml ]
+ then
+ sed -i '/Sticky/ s/0/1/' /root/etc/xdg/xfce4/mcs_settings/keyboard.xml
+ fi
+ ;;
+esac
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/31disable_update_notifier b/dyneIII/live-init-scripts/scripts/live-bottom/31disable_update_notifier
new file mode 100755
index 0000000..e363049
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/31disable_update_notifier
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOUPDATENOTIFIER}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling update-notifier"
+
+# live-initramfs script
+
+# For GNOME, we divert away apt-check to avoid a regular 'apt-get update'
+# equivalent in the live session. We want to run update-notifier for crash
+# report handling.
+chroot /root dpkg-divert --add --rename --quiet \
+ /usr/lib/update-notifier/apt-check
+
+if [ -e /root/usr/lib/update-notifier/apt-check ]
+then
+ ln -s /bin/true /root/usr/lib/update-notifier/apt-check
+fi
+
+# For KDE, adept_notifier's only useful function at the moment is an
+# 'apt-get update' equivalent, so we disable it entirely.
+rm -f /root/usr/share/autostart/adept_notifier_auto.desktop
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/32disable_hibernation b/dyneIII/live-init-scripts/scripts/live-bottom/32disable_hibernation
new file mode 100755
index 0000000..f4960e6
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/32disable_hibernation
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOPOWERMANAGEMENT}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Configuring power management"
+
+# live-initramfs script
+
+gpm_version=$(chroot /root /usr/bin/dpkg-query -W --showformat='${Version}' gnome-power-manager 2>/dev/null) || panel_version=""
+
+if [ -n "${gpm_version}" ] && [ -n "${USERNAME}" ]
+then
+ #live-reconfigure /root gnome-power-manager
+ # Gnome < 2.20
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gnome-power-manager/can_hibernate false
+ # Gnome >= 2.20
+ chroot /root sudo -u "${USERNAME}" gconftool-2 -s -t bool /apps/gnome-power-manager/general/can_hibernate false
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/33enable_apport_crashes b/dyneIII/live-init-scripts/scripts/live-bottom/33enable_apport_crashes
new file mode 100755
index 0000000..47e650d
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/33enable_apport_crashes
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOPROGRAMCRASHES}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Enabling detection of crashes"
+
+# live-initramfs script
+
+if [ -e /root/etc/default/apport ]
+then
+ sed -i 's/enabled=0/enabled=1/' /root/etc/default/apport
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kde_services b/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kde_services
new file mode 100755
index 0000000..3350d61
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kde_services
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling unnecessary KDE services..."
+
+# live-initramfs script
+
+rm -f /root/usr/share/services/kded/kwalletd.desktop
+rm -f /root/usr/share/kde4/services/kwalletd.desktop
+rm -f /root/usr/share/autostart/kab2kabc.desktop
+rm -f /root/usr/share/autostart/kabcdistlistupdater.desktop
+rm -f /root/usr/share/autostart/korgac.desktop
+rm -f /root/usr/share/autostart/printer-applet.desktop
+rm -f /root/usr/share/autostart/nepomukserver.desktop
+rm -f /root/usr/share/kde4/services/kded/kpackagekitd.desktop
+rm -f /root/usr/share/kde4/services/kded/susefreespacenotifier.desktop
+rm -f /root/usr/share/kde4/services/plasma-runner-contacts.desktop # starts akonadi
+rm -f /root/etc/xdg/autostart/update-notifier-kde.desktop
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kpersonalizer b/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kpersonalizer
new file mode 100755
index 0000000..d61c879
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/34disable_kpersonalizer
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOKPERSONALIZER}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling kpersonalizer"
+
+# live-initramfs script
+
+if chroot /root /usr/bin/which kpersonalizer >/dev/null
+then
+ # Disable first-login wizard for KDE
+ if [ ! -f /root/etc/kde3/kpersonalizerrc ]
+ then
+
+cat > /root/etc/kde3/kpersonalizerrc << EOF
+[General]
+FirstLogin=false
+EOF
+
+ else
+ echo "I'm not smart enough to disable kpersonalizer startup" >&2
+ echo "Because kpersonalizerrc already exists" >&2
+ fi
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/35fix_language_selector b/dyneIII/live-init-scripts/scripts/live-bottom/35fix_language_selector
new file mode 100755
index 0000000..8452d12
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/35fix_language_selector
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOLANGUAGESELECTOR}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Fixing language selector"
+
+# live-initramfs script
+
+if [ -e /root/usr/share/applications/language-selector.desktop ]
+then
+ sed -i '/^Exec/ s|/usr/bin/gnome-language-selector|& -n|' /root/usr/share/applications/language-selector.desktop
+fi
+
+if [ -x /root/usr/bin/fontconfig-voodoo ]
+then
+ chroot /root fontconfig-voodoo --auto --quiet || true
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/36disable_trackerd b/dyneIII/live-init-scripts/scripts/live-bottom/36disable_trackerd
new file mode 100755
index 0000000..667131d
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/36disable_trackerd
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOTIMEZONE}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling trackerd"
+
+# live-initramfs script
+
+rm -f /root/etc/xdg/autostart/tracker-applet.desktop \
+ /root/etc/xdg/autostart/trackerd.desktop \
+ /root/usr/share/autostart/trackerd.desktop
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/38jockey_disable_check b/dyneIII/live-init-scripts/scripts/live-bottom/38jockey_disable_check
new file mode 100755
index 0000000..1a642e1
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/38jockey_disable_check
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+if [ -n "${NOJOCKEY}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling jockey driver check"
+
+rm -f /root/etc/xdg/autostart/jockey*.desktop
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/41apt_cdrom b/dyneIII/live-init-scripts/scripts/live-bottom/41apt_cdrom
new file mode 100755
index 0000000..00606d5
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/41apt_cdrom
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOAPTCDROM}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Adding APT-CDROM source"
+
+# live-initramfs script
+
+if [ -d /root/cdrom ]
+then
+ chroot /root apt-cdrom -m add
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/42disable_apparmor b/dyneIII/live-init-scripts/scripts/live-bottom/42disable_apparmor
new file mode 100755
index 0000000..f87cab4
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/42disable_apparmor
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -n "${NOAPPARMOR}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Disabling AppArmor (does not work with stacked file systems)"
+
+# live-initramfs script
+
+if [ -x /root/etc/init.d/apparmor ]
+then
+ chroot /root update-rc.d -f apparmor remove
+fi
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/43disable_updateinitramfs b/dyneIII/live-init-scripts/scripts/live-bottom/43disable_updateinitramfs
new file mode 100755
index 0000000..6ceeacf
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/43disable_updateinitramfs
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Possibly disabling update-initramfs (useless on a live CD)..."
+
+# live-initramfs script
+
+chroot /root dpkg-divert --add --rename --quiet \
+ /usr/sbin/update-initramfs
+
+# Running off a USB disk or other writable media.
+if [ -w /root/cdrom ] && \
+ ! grep -q '^[^ ]* /root/cdrom [^ ]* [^ ]*\<ro\>' /proc/mounts
+then
+
+cat > /root/usr/sbin/update-initramfs << 'EOF'
+#!/bin/sh
+
+update-initramfs.distrib "$@"
+cp /initrd.img /cdrom/live/initrd.gz
+cp /vmlinuz /cdrom/live/vmlinuz
+exit 0
+EOF
+
+else
+
+cat > /root/usr/sbin/update-initramfs << EOF
+#!/bin/sh
+
+echo "update-initramfs is disabled since running on read-only media"
+exit 0
+EOF
+
+fi
+
+chmod 0755 /root/usr/sbin/update-initramfs
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/44pk_allow b/dyneIII/live-init-scripts/scripts/live-bottom/44pk_allow
new file mode 100755
index 0000000..fec6401
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/44pk_allow
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+. /scripts/live-functions
+
+log_begin_msg "Grant administrative PolicyKit pivilieges to default user"
+
+# live-initramfs script
+
+# configure PolicyKit in live session
+mkdir -p /root/etc/PolicyKit
+cat << EOF > /root/etc/PolicyKit/PolicyKit.conf
+<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->
+
+<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
+"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">
+
+<!-- See the manual page PolicyKit.conf(5) for file format -->
+
+<config version="0.1">
+ <match user="root">
+ <return result="yes"/>
+ </match>
+EOF
+
+if [ -n "${USERNAME}" ]
+then
+ cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
+ <!-- don't ask password for user in live session -->
+ <match user="$USERNAME">
+ <return result="yes"/>
+ </match>
+EOF
+fi
+
+cat << EOF >> /root/etc/PolicyKit/PolicyKit.conf
+ <define_admin_auth group="admin"/>
+</config>
+EOF
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-bottom/99hook b/dyneIII/live-init-scripts/scripts/live-bottom/99hook
new file mode 100755
index 0000000..8809800
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-bottom/99hook
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ=""
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs header
+
+if [ -z "${HOOK}" ]
+then
+ exit 0
+fi
+
+. /scripts/live-functions
+
+log_begin_msg "Executing custom hook script"
+
+# live-initramfs script
+
+cd /root
+
+if [ $(echo "${HOOK}" | grep file:\/\/) ]
+then
+ LOCALFILE=$(echo ${HOOK} | sed "s/file\:\/\///")
+ cp ${LOCALFILE} /root
+else
+ chroot /root wget "${HOOK}"
+fi
+
+FILE="$(basename ${HOOK})"
+
+chmod 0755 "${FILE}"
+./"${FILE}"
+rm -f "${FILE}"
+
+log_end_msg
diff --git a/dyneIII/live-init-scripts/scripts/live-functions b/dyneIII/live-init-scripts/scripts/live-functions
new file mode 100644
index 0000000..4a23e69
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-functions
@@ -0,0 +1,113 @@
+
+. /scripts/functions
+. /live.vars
+
+log_wait_msg ()
+{
+ # Print a message and wait for enter
+ if [ -x /sbin/usplash_write ]
+ then
+ /sbin/usplash_write "INPUTENTER ${@}"
+ read nunya < /dev/.initramfs/usplash_outfifo
+ else if [ -x /sbin/splashy_update ] ; then
+ /sbin/splashy_update "getstring ${@}" | read nunya
+ fi ; fi
+
+ _log_msg "Waiting: ${@} ... \n"
+}
+
+really_export ()
+{
+ STRING="${1}"
+ VALUE="$(eval echo -n \${$STRING})"
+
+ if [ -f /live.vars ] && grep -sq "export ${STRING}" /live.vars
+ then
+ sed -i -e 's/\('${STRING}'=\).*$/\1'${VALUE}'/' /live.vars
+ else
+ echo "export ${STRING}=\"${VALUE}\"" >> /live.vars
+ fi
+
+ eval export "${STRING}"="${VALUE}"
+}
+
+lang2locale() {
+ langpart="${1%%_*}"
+ if [ "$1" != "C" ]; then
+ # Match the language code with 3rd field in languagelist
+ line=$(grep -v "^#" /usr/share/live-initramfs/languagelist | cut -f1,3,6 -d\; | grep -v ';C$' | grep "^$langpart;")
+ if [ -n "$line" ]; then
+ if [ "$(echo "$line" | grep -c '')" -gt 1 ]; then
+ # More than one match; try matching the
+ # country as well.
+ countrypart="${1#*_}"
+ if [ "$countrypart" = "$1" ]; then
+ countryline="$(echo "$line" | head -n1)"
+ echo "${countryline##*;}"
+ return
+ fi
+ countrypart="${countrypart%%[@.]*}"
+ countryline="$(echo "$line" | grep ";$countrypart;" | head -n1 || true)"
+ if [ "$countryline" ]; then
+ echo "${countryline##*;}"
+ return
+ fi
+ fi
+ echo "${line##*;}"
+ fi
+ else
+ echo "C"
+ fi
+}
+
+# Override maybe_break from scripts/functions
+maybe_break()
+{
+ if [ "${break}" = "$1" ]; then
+ # Call original panic
+ . /scripts/functions
+ panic "Spawning shell within the initramfs"
+ fi
+}
+
+# Override panic from scripts/functions
+panic() {
+
+ DEB_1="\033[1;31m .''\`. \033[0m"
+ DEB_2="\033[1;31m: :' : \033[0m"
+ DEB_3="\033[1;31m\`. \`'\` \033[0m"
+ DEB_4="\033[1;31m \`- \033[0m"
+
+ LIVELOG="\033[1;37m/live.log\033[0m"
+ DEBUG="\033[1;37mdebug\033[0m"
+
+ # Reset redirections to avoid buffering
+ exec 1>&6 6>&-
+ exec 2>&7 7>&-
+ kill ${tailpid}
+
+ printf "\n\n"
+ printf " ${DEB_1}\n"
+ printf " ${DEB_2} \033[1;37mBOOT FAILED!\033[0m\n"
+ printf " ${DEB_3}\n"
+ printf " ${DEB_4} This Debian Live image failed to boot.\n\n"
+
+ printf " Please file a bug against the 'live-initramfs' package or email the Debian\n"
+ printf " Live mailing list at <debian-live@lists.debian.org>, making sure to note the\n"
+ printf " exact version, name and distribution of the image you were attempting to boot.\n\n"
+
+ printf " The file ${LIVELOG} contains some debugging information but booting with the\n"
+ printf " ${DEBUG} command-line parameter will greatly increase its verbosity which is\n"
+ printf " extremely useful when diagnosing issues.\n\n"
+
+ if [ -n "${panic}" ]; then
+ printf " live-initramfs will now restart your system. "
+ else
+ printf " live-initramfs will now start a shell. "
+ fi
+ printf "The error message was:\n\n "
+
+ # Call original panic
+ . /scripts/functions
+ panic "$@"
+}
diff --git a/dyneIII/live-init-scripts/scripts/live-helpers b/dyneIII/live-init-scripts/scripts/live-helpers
new file mode 100644
index 0000000..d667376
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-helpers
@@ -0,0 +1,459 @@
+# live-initramfs helper functions, used by live-initramfs on boot and by live-snapshot
+
+if [ ! -x "/bin/fstype" ]
+then
+ # klibc not in path -> not in initramfs
+ export PATH="${PATH}:/usr/lib/klibc/bin"
+fi
+
+# handle upgrade path from old udev (using udevinfo) to
+# recent versions of udev (using udevadm info)
+if [ -x /sbin/udevadm ]
+then
+ udevinfo='/sbin/udevadm info'
+else
+ udevinfo='udevinfo'
+fi
+
+sys2dev ()
+{
+ sysdev=${1#/sys}
+ echo "/dev/$($udevinfo -q name -p ${sysdev} 2>/dev/null|| echo ${sysdev##*/})"
+}
+
+subdevices ()
+{
+ sysblock=${1}
+ r=""
+
+ for dev in "${sysblock}" "${sysblock}"/*
+ do
+ if [ -e "${dev}/dev" ]
+ then
+ r="${r} ${dev}"
+ fi
+ done
+
+ echo ${r}
+}
+
+is_supported_fs ()
+{
+ fstype="${1}"
+
+ # Validate input first
+ if [ -z "${fstype}" ]
+ then
+ return 1
+ fi
+
+ # Try to look if it is already supported by the kernel
+ if grep -q ${fstype} /proc/filesystems
+ then
+ return 0
+ else
+ # Then try to add support for it the gentle way using the initramfs capabilities
+ modprobe ${fstype}
+ if grep -q ${fstype} /proc/filesystems
+ then
+ return 0
+ # Then try the hard way if /root is already reachable
+ else
+ kmodule="/root/lib/modules/`uname -r`/${fstype}/${fstype}.ko"
+ if [ -e "${kmodule}" ]
+ then
+ insmod "${kmodule}"
+ if grep -q ${fstype} /proc/filesystems
+ then
+ return 0
+ fi
+ fi
+ fi
+ fi
+
+ return 1
+}
+
+get_fstype ()
+{
+ if [ -x /lib/udev/vol_id ]
+ then
+ /lib/udev/vol_id -t ${1} 2>/dev/null
+ else
+ /lib/udev/blkid -o value -s TYPE ${1} 2>/dev/null
+ fi
+}
+
+where_is_mounted ()
+{
+ device=${1}
+
+ if grep -q "^${device} " /proc/mounts
+ then
+ # return the first found
+ grep -m1 "^${device} " /proc/mounts | cut -f2 -d ' '
+ fi
+}
+
+lastline ()
+{
+ while read lines
+ do
+ line=${lines}
+ done
+
+ echo "${line}"
+}
+
+base_path ()
+{
+ testpath="${1}"
+ mounts="$(awk '{print $2}' /proc/mounts)"
+ testpath="$(busybox realpath ${testpath})"
+
+ while true
+ do
+ if echo "${mounts}" | grep -qs "^${testpath}"
+ then
+ set -- $(echo "${mounts}" | grep "^${testpath}" | lastline)
+ echo ${1}
+ break
+ else
+ testpath=$(dirname $testpath)
+ fi
+ done
+}
+
+fs_size ()
+{
+ # Returns used/free fs kbytes + 5% more
+ # You could pass a block device as ${1} or the mount point as ${2}
+
+ dev="${1}"
+ mountp="${2}"
+ used="${3}"
+
+ if [ -z "${mountp}" ]
+ then
+ mountp="$(where_is_mounted ${dev})"
+
+ if [ -z "${mountp}" ]
+ then
+ mountp="/mnt/tmp_fs_size"
+
+ mkdir -p "${mountp}"
+ mount -t $(get_fstype "${dev}") -o ro "${dev}" "${mountp}" || log_warning_msg "cannot mount -t $(get_fstype ${dev}) -o ro ${dev} ${mountp}"
+
+ doumount=1
+ fi
+ fi
+
+ if [ "${used}" = "used" ]
+ then
+ size=$(du -ks ${mountp} | cut -f1)
+ size=$(expr ${size} + ${size} / 20 ) # FIXME: 5% more to be sure
+ else
+ # free space
+ size="$(df -k | grep -s ${mountp} | awk '{print $4}')"
+ fi
+
+ if [ -n "${doumount}" ]
+ then
+ umount "${mountp}" || log_warning_msg "cannot umount ${mountp}"
+ rmdir "${mountp}"
+ fi
+
+ echo "${size}"
+}
+
+load_keymap ()
+{
+ # Load custom keymap
+ if [ -x /bin/loadkeys -a -r /etc/boottime.kmap.gz ]
+ then
+ loadkeys /etc/boottime.kmap.gz
+ fi
+}
+
+setup_loop ()
+{
+ local fspath=${1}
+ local module=${2}
+ local pattern=${3}
+ local offset=${4}
+ local encryption=${5}
+ local readonly=${6}
+
+ modprobe -q -b "${module}"
+
+ if [ -x /sbin/udevadm ]
+ then
+ # lenny
+ udevadm settle
+ else
+ # etch
+ udevsettle
+ fi
+
+ for loopdev in ${pattern}
+ do
+ if [ "$(cat ${loopdev}/size)" -eq 0 ]
+ then
+ dev=$(sys2dev "${loopdev}")
+ options=''
+
+ if [ -n "${readonly}" ]
+ then
+ if losetup --help 2>&1 | grep -q -- "-r\b"
+ then
+ options="${options} -r"
+ fi
+ fi
+
+ if [ 0 -lt "${offset}" ]
+ then
+ options="${options} -o ${offset}"
+ fi
+
+ if [ -z "${encryption}" ]
+ then
+ losetup ${options} "${dev}" "${fspath}"
+ else
+ # Loop AES encryption
+ while true
+ do
+ load_keymap
+
+ echo -n "Enter passphrase for root filesystem: " >&6
+ read -s passphrase
+ echo "${passphrase}" > /tmp/passphrase
+ unset passphrase
+ exec 9</tmp/passphrase
+ /sbin/losetup ${options} -e "${encryption}" -p 9 "${dev}" "${fspath}"
+ error=${?}
+ exec 9<&-
+ rm -f /tmp/passphrase
+
+ if [ 0 -eq ${error} ]
+ then
+ unset error
+ break
+ fi
+
+ echo
+ echo -n "There was an error decrypting the root filesystem ... Retry? [Y/n] " >&6
+ read answer
+
+ if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
+ then
+ unset answer
+ break
+ fi
+ done
+ fi
+
+ echo "${dev}"
+ return 0
+ fi
+ done
+
+ panic "No loop devices available"
+}
+
+try_mount ()
+{
+ dev="${1}"
+ mountp="${2}"
+ opts="${3}"
+ fstype="${4}"
+
+ old_mountp="$(where_is_mounted ${dev})"
+
+ if [ -n "${old_mountp}" ]
+ then
+ if [ "${opts}" != "ro" ]
+ then
+ mount -o remount,"${opts}" "${dev}" "${old_mountp}" || panic "Remounting ${dev} ${opts} on ${old_mountp} failed"
+ fi
+
+ mount -o bind "${old_mountp}" "${mountp}" || panic "Cannot bind-mount ${old_mountp} on ${mountp}"
+ else
+ if [ -z "${fstype}" ]
+ then
+ fstype=$(get_fstype "${dev}")
+ fi
+ mount -t "${fstype}" -o "${opts}" "${dev}" "${mountp}" || panic "Cannot mount ${dev} on ${mountp}, fstype=${fstype}, options=${opts}"
+ fi
+}
+
+find_cow_device ()
+{
+ # Returns a device containing a partition labeled "${pers_label}" or containing a file named the same way
+ # in the latter case the partition containing the file is left mounted
+ # if is not in black_listed_devices
+ pers_label="${1}"
+ cow_backing="/${pers_label}-backing"
+ black_listed_devices="${2}"
+
+ if [ -z "${PERSISTENT_PATH}" ]
+ then
+ pers_fpath=${cow_backing}/${pers_label}
+ else
+ pers_fpath=${cow_backing}/${PERSISTENT_PATH}/${pers_label}
+ fi
+
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
+ do
+ for dev in $(subdevices "${sysblock}")
+ do
+ devname=$(sys2dev "${dev}")
+
+ if echo "${black_listed_devices}" | grep -q "${devname}"
+ then
+ # skip this device enterely
+ break
+ fi
+
+ # Checking for a luks device
+ if [ "${PERSISTENT}" = "cryptsetup" ] && [ -e /sbin/cryptsetup ] && /sbin/cryptsetup isLuks ${devname}
+ then
+ while true
+ do
+ load_keymap
+
+ /lib/cryptsetup/askpass "Enter passphrase for ${pers_label} on ${devname}: " | /sbin/cryptsetup -T 1 luksOpen ${devname} $(basename ${devname}) --key-file=-
+ error=${?}
+
+ devname="/dev/mapper/$(basename ${devname})"
+
+ if [ 0 -eq ${error} ]
+ then
+ unset error
+ break
+ fi
+
+ echo
+ echo -n "There was an error decrypting ${devname} ... Retry? [Y/n] " >&6
+ read answer
+
+ if [ "$(echo "${answer}" | cut -b1 | tr A-Z a-z)" = "n" ]
+ then
+ unset answer
+ break
+ fi
+ done
+ fi
+
+ #if [ "$(/lib/udev/vol_id -l ${devname} 2>/dev/null)" = "${pers_label}" ]
+ if [ "$(/lib/udev/blkid -o value -s LABEL ${devname} 2>/dev/null)" = "${pers_label}" ]
+ then
+ echo "${devname}"
+ return 0
+ fi
+
+ if [ "${PERSISTENT}" = "nofiles" ]
+ then
+ # do not mount the device to find for image files
+ # just skip this
+ continue
+ fi
+
+ case "$(get_fstype ${devname})" in
+ vfat|ext2|ext3|ext4|jffs2)
+ mkdir -p "${cow_backing}"
+ if ! try_mount "${devname}" "${cow_backing}" "rw"
+ then
+ break
+ fi
+
+ if [ -f "${pers_fpath}" ]
+ then
+ echo $(setup_loop "${pers_fpath}" "loop" "/sys/block/loop*")
+ return 0
+ else
+ umount ${cow_backing}
+ fi
+ ;;
+ *)
+ ;;
+ esac
+ done
+ done
+ return 1
+}
+
+find_files ()
+{
+ # return the a string composed by device name, mountpoint an the first of ${filenames} found on a supported partition
+ # FIXME: merge with above function
+
+ filenames="${1}"
+ snap_backing="/snap-backing"
+ black_listed_devices="${2}"
+
+ for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -v loop | grep -v ram | grep -v fd)
+ do
+ for dev in $(subdevices "${sysblock}")
+ do
+ devname=$(sys2dev "${dev}")
+ devfstype="$(get_fstype ${devname})"
+
+ if echo "${black_listed_devices}" | grep -q "${devname}"
+ then
+ # skip this device enterely
+ break
+ fi
+
+ if is_supported_fs ${devfstype}
+ then
+ mkdir -p "${snap_backing}"
+
+ if try_mount "${devname}" "${snap_backing}" "ro" "${devfstype}"
+ then
+ for filename in ${filenames}
+ do
+ if [ -f "${snap_backing}/${filename}" ]
+ then
+ echo "${devname} ${snap_backing} ${filename}"
+ umount ${snap_backing}
+ return 0
+ fi
+ done
+ fi
+
+ umount ${snap_backing}
+ fi
+ done
+ done
+}
+
+get_mac ()
+{
+ mac=""
+
+ for adaptor in /sys/class/net/*
+ do
+ status="$(cat ${adaptor}/iflink)"
+
+ if [ "${status}" -eq 2 ]
+ then
+ mac="$(cat ${adaptor}/address)"
+ mac="$(echo ${mac} | sed 's/:/-/g' | tr '[a-z]' '[A-Z]')"
+ fi
+ done
+
+ echo ${mac}
+}
+
+is_luks()
+{
+ devname="${1}"
+ if [ -x /sbin/cryptsetup ]
+ then
+ /sbin/cryptsetup isLuks "${devname}" 2>/dev/null || ret=${?}
+ return ${ret}
+ else
+ return 1
+ fi
+
+}
diff --git a/dyneIII/live-init-scripts/scripts/live-premount/modules b/dyneIII/live-init-scripts/scripts/live-premount/modules
new file mode 100755
index 0000000..408e873
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-premount/modules
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ="udev"
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs script
+
+# The following modprobe entry is a workaround to live-initramfs not
+# finding the root filesytem.
+#
+# See also:
+# * http://lists.alioth.debian.org/pipermail/debian-live-devel/2007-May/001459.html
+# * http://lists.alioth.debian.org/pipermail/debian-live-devel/2007-June/001517.html
+# * http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363047
+
+modprobe -q ide-generic
+modprobe -q esp
diff --git a/dyneIII/live-init-scripts/scripts/live-premount/readonly b/dyneIII/live-init-scripts/scripts/live-premount/readonly
new file mode 100755
index 0000000..8bed733
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/live-premount/readonly
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+#set -e
+
+# initramfs-tools header
+
+PREREQ="udev"
+
+prereqs()
+{
+ echo "${PREREQ}"
+}
+
+case "${1}" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# live-initramfs script
+
+# make sure all harddisk devices are read-only
+# this is important for forensic investigations
+if grep -qe forensic -qe readonly /proc/cmdline
+then
+ for device in /dev/hd* /dev/sd* /dev/vd*
+ do
+ if [ -b "$device" ]
+ then
+ printf " * Setting device %-9s to read-only mode: " $device >/dev/console
+ blockdev --setro $device && printf "done [ execute \"blockdev --setrw %-9s\" to unlock]\n" $device >/dev/console || printf "failed\n" >/dev/console
+ fi
+ done
+fi
diff --git a/dyneIII/live-init-scripts/scripts/local b/dyneIII/live-init-scripts/scripts/local
new file mode 100644
index 0000000..ec3b313
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local
@@ -0,0 +1,193 @@
+# Local filesystem mounting -*- shell-script -*-
+
+# Parameter: device node to check
+# Echos fstype to stdout
+# Return value: indicates if an fs could be recognized
+get_fstype ()
+{
+ local FS FSTYPE FSSIZE RET
+ FS="${1}"
+
+ # blkid has a more complete list of file systems,
+ # but fstype is more robust
+ eval $(fstype "${FS}" 2> /dev/null)
+
+ if [ -z "${FSTYPE}" ]; then
+ FSTYPE="unknown"
+ fi
+
+ if [ "$FSTYPE" = "unknown" ] && [ -x /sbin/blkid ]; then
+ FSTYPE=$(/sbin/blkid -s TYPE -o value "${FS}" 2> /dev/null)
+ fi
+ RET=$?
+
+ if [ -z "${FSTYPE}" ]; then
+ FSTYPE="unknown"
+ fi
+
+ echo "${FSTYPE}"
+ return ${RET}
+}
+
+root_missing()
+{
+ ROOT="${1}"
+ [ ! -e "${ROOT}" ] || ! $(get_fstype "${ROOT}" >/dev/null) || ! /sbin/udevadm settle
+}
+
+# Parameter: Where to mount the filesystem
+mountroot ()
+{
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-top"
+ run_scripts /scripts/local-top
+ [ "$quiet" != "y" ] && log_end_msg
+
+ # If the root device hasn't shown up yet, give it a little while
+ # to deal with removable devices
+ while root_missing "${ROOT}"; do
+ log_begin_msg "Waiting for root file system..."
+
+ # Default delay is 30s
+ if [ -z "${ROOTDELAY}" ]; then
+ slumber=30
+ else
+ slumber=${ROOTDELAY}
+ fi
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT ${slumber}" || true
+ fi
+
+ slumber=$(( ${slumber} * 10 ))
+ while root_missing "${ROOT}"; do
+ /bin/sleep 0.1
+ slumber=$(( ${slumber} - 1 ))
+ [ ${slumber} -gt 0 ] || break
+ done
+
+ if [ ${slumber} -gt 0 ]; then
+ log_end_msg 0
+ else
+ log_end_msg 1 || true
+ fi
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT 15" || true
+ fi
+
+ # Run failure hooks, hoping one of them can fix up the system
+ # and we can restart the wait loop. If they all fail, abort
+ # and move on to the panic handler and shell.
+ if root_missing "${ROOT}" && ! try_failure_hooks; then
+ break
+ fi
+ done
+
+ # We've given up, but we'll let the user fix matters if they can
+ while root_missing "${ROOT}"; do
+ # give hint about renamed root
+ case "${ROOT}" in
+ /dev/hd*)
+ suffix="${ROOT#/dev/hd}"
+ major="${suffix%[[:digit:]]}"
+ major="${major%[[:digit:]]}"
+ if [ -d "/sys/block/sd${major}" ]; then
+ echo "WARNING bootdevice may be renamed. Try root=/dev/sd${suffix}"
+ fi
+ ;;
+ /dev/sd*)
+ suffix="${ROOT#/dev/sd}"
+ major="${suffix%[[:digit:]]}"
+ major="${major%[[:digit:]]}"
+ if [ -d "/sys/block/hd${major}" ]; then
+ echo "WARNING bootdevice may be renamed. Try root=/dev/hd${suffix}"
+ fi
+ ;;
+ esac
+ echo "Gave up waiting for root device. Common problems:"
+ echo " - Boot args (cat /proc/cmdline)"
+ echo " - Check rootdelay= (did the system wait long enough?)"
+ echo " - Check root= (did the system wait for the right device?)"
+ echo " - Missing modules (cat /proc/modules; ls /dev)"
+ panic "ALERT! ${ROOT} does not exist. Dropping to a shell!"
+ done
+
+ # Get the root filesystem type if not set
+ if [ -z "${ROOTFSTYPE}" ]; then
+ FSTYPE=$(get_fstype "${ROOT}")
+ else
+ FSTYPE=${ROOTFSTYPE}
+ fi
+
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-premount"
+ run_scripts /scripts/local-premount
+ [ "$quiet" != "y" ] && log_end_msg
+
+ if [ ${readonly} = y ] && \
+ [ -z "$LOOP" ]; then
+ roflag=-r
+ else
+ roflag=-w
+ fi
+
+ # FIXME This has no error checking
+ modprobe ${FSTYPE}
+
+ # FIXME This has no error checking
+ # Mount root
+ mount ${roflag} -t ${FSTYPE} ${ROOTFLAGS} ${ROOT} ${rootmnt}
+ mountroot_status="$?"
+ if [ "$LOOP" ]; then
+ if [ "$mountroot_status" != 0 ]; then
+ if [ ${FSTYPE} = ntfs ] || [ ${FSTYPE} = vfat ]; then
+ panic "
+Could not mount the partition ${ROOT}.
+This could also happen if the file system is not clean because of an operating
+system crash, an interrupted boot process, an improper shutdown, or unplugging
+of a removable device without first unmounting or ejecting it. To fix this,
+simply reboot into Windows, let it fully start, log in, run 'chkdsk /r', then
+gracefully shut down and reboot back into Windows. After this you should be
+able to reboot again and resume the installation.
+(filesystem = ${FSTYPE}, error code = $mountroot_status)
+"
+ fi
+ fi
+
+ mkdir -p /host
+ mount -o move ${rootmnt} /host
+
+ while [ ! -e "/host/${LOOP#/}" ]; do
+ panic "ALERT! /host/${LOOP#/} does not exist. Dropping to a shell!"
+ done
+
+ # Get the loop filesystem type if not set
+ if [ -z "${LOOPFSTYPE}" ]; then
+ eval $(fstype < "/host/${LOOP#/}")
+ else
+ FSTYPE="${LOOPFSTYPE}"
+ fi
+ if [ "$FSTYPE" = "unknown" ] && [ -x /sbin/blkid ]; then
+ FSTYPE=$(/sbin/blkid -s TYPE -o value "/host/${LOOP#/}")
+ [ -z "$FSTYPE" ] && FSTYPE="unknown"
+ fi
+
+ if [ ${readonly} = y ]; then
+ roflag=-r
+ else
+ roflag=-w
+ fi
+
+ # FIXME This has no error checking
+ modprobe loop
+ modprobe ${FSTYPE}
+
+ # FIXME This has no error checking
+ mount ${roflag} -o loop -t ${FSTYPE} ${LOOPFLAGS} "/host/${LOOP#/}" ${rootmnt}
+
+ if [ -d ${rootmnt}/host ]; then
+ mount -o move /host ${rootmnt}/host
+ fi
+ fi
+
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/local-bottom"
+ run_scripts /scripts/local-bottom
+ [ "$quiet" != "y" ] && log_end_msg
+}
diff --git a/dyneIII/live-init-scripts/scripts/local-bottom/cryptopensc b/dyneIII/live-init-scripts/scripts/local-bottom/cryptopensc
new file mode 100755
index 0000000..d1cd1ab
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-bottom/cryptopensc
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+set -e
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+
+# Hook for stopping smartcard reading software
+
+if [ ! -e /sbin/pcscd ]; then
+ exit 0
+fi
+
+# Start pcscd daemon nomrally. If it was started in foregound, chances are
+# it'll harmlessly complain about missing /var/run/pcscd* files due to the root
+# filessytem being remounted.
+start-stop-daemon --stop --quiet --pidfile /var/run/pcscd.pid --name pcscd
diff --git a/dyneIII/live-init-scripts/scripts/local-bottom/ntfs_3g b/dyneIII/live-init-scripts/scripts/local-bottom/ntfs_3g
new file mode 100755
index 0000000..1f895f6
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-bottom/ntfs_3g
@@ -0,0 +1,13 @@
+#! /bin/sh
+
+case $1 in
+prereqs)
+ exit 0
+ ;;
+esac
+
+mkdir -p /dev/.initramfs/varrun
+pidof mount.ntfs >> /dev/.initramfs/varrun/sendsigs.omit
+pidof mount.ntfs-3g >> /dev/.initramfs/varrun/sendsigs.omit
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/local-premount/ntfs_3g b/dyneIII/live-init-scripts/scripts/local-premount/ntfs_3g
new file mode 100755
index 0000000..57e7f8b
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-premount/ntfs_3g
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+case $1 in
+prereqs)
+ exit 0
+ ;;
+esac
+
+if [ "$ROOTFSTYPE" = ntfs ] || [ "$ROOTFSTYPE" = ntfs-3g ] || \
+ [ "$LOOPFSTYPE" = ntfs ] || [ "$LOOPFSTYPE" = ntfs-3g ]; then
+ modprobe fuse
+fi
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/local-premount/resume b/dyneIII/live-init-scripts/scripts/local-premount/resume
new file mode 100755
index 0000000..478cb02
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-premount/resume
@@ -0,0 +1,130 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+if [ -z "${resume}" ]; then
+ exit 0
+fi
+
+if [ -e /conf/page_size.conf ]; then
+ . /conf/page_size.conf
+else
+ PAGE_SIZE=4096 # fallback
+fi
+export PAGE_SIZE
+
+case $resume in
+LABEL=*)
+ resume="${resume#LABEL=}"
+
+ # support any / in LABEL= path (escape to \x2f)
+ case "${resume}" in
+ *[/]*)
+ if [ -x "$(command -v sed)" ]; then
+ resume="$(echo ${resume} | sed 's,/,\\x2f,g')"
+ else
+ if [ "${resume}" != "${resume#/}" ]; then
+ resume="\x2f${resume#/}"
+ fi
+ if [ "${resume}" != "${resume%/}" ]; then
+ resume="${resume%/}\x2f"
+ fi
+ IFS='/'
+ newresume=
+ for s in $resume; do
+ if [ -z "${newresume}" ]; then
+ newresume="${s}"
+ else
+ newresume="${newresume}\\x2f${s}"
+ fi
+ done
+ unset IFS
+ resume="${newresume}"
+ fi
+ esac
+ resume="/dev/disk/by-label/${resume}"
+ ;;
+UUID=*)
+ resume="/dev/disk/by-uuid/${resume#UUID=}"
+ ;;
+esac
+
+. ./scripts/functions
+
+if [ ! -e "${resume}" ] || ! /sbin/blkid -p "${resume}" >/dev/null 2>&1; then
+ log_begin_msg "Waiting for resume device..."
+
+ # Default delay is 5s
+ if [ -z "${RESUMEDELAY}" ]; then
+ slumber=5
+ else
+ slumber=${RESUMEDELAY}
+ fi
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT ${slumber}" || true
+ fi
+
+ slumber=$(( ${slumber} * 10 ))
+ while [ ! -e "${resume}" ] || ! /sbin/blkid -p "${resume}" >/dev/null 2>&1; do
+ /bin/sleep 0.1
+ slumber=$(( ${slumber} - 1 ))
+ [ ${slumber} -gt 0 ] || break
+ done
+
+ if [ ${slumber} -gt 0 ]; then
+ log_end_msg 0
+ else
+ log_end_msg 1 || true
+ exit
+ fi
+fi
+
+magic=SWAPSPACE2S1SUSPEND
+if [ -n "${resume_offset}" ]; then
+ offset=$(($PAGE_SIZE * $resume_offset + 4076))
+else
+ offset=4076
+fi
+str=$(dd if=$resume bs=1 skip=$offset count=19 2>/dev/null)
+magic_found=
+
+if [ "$str" = "$magic" ]; then
+ magic_found=yes
+fi
+
+if [ -n "$magic_found" -a -x /sbin/usplash_write ]; then
+ # Force usplash to finish drawing before attempting resume.
+ # The screen can sometimes become corrupted if usplash is
+ # interrupted by the resume.
+ /sbin/usplash_write "PROGRESS 0" \
+ "TEXT-URGENT Waking up. Please wait..." \
+ "INPUTCHAR" || true
+ read ignored < /dev/.initramfs/usplash_outfifo
+fi
+
+# hardcode path, uswsusp ships an resume binary too
+if [ -n "${resume_offset}" ]; then
+ /bin/resume ${resume} ${resume_offset} >/dev/null 2>&1
+else
+ /bin/resume ${resume} >/dev/null 2>&1
+fi
+
+# Not reached if resume is successful
+
+if [ -n "$magic_found" -a -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "FAILURE failed!" \
+ "TEXT-URGENT Attempting normal startup." || true
+fi
diff --git a/dyneIII/live-init-scripts/scripts/local-top/cryptopensc b/dyneIII/live-init-scripts/scripts/local-top/cryptopensc
new file mode 100755
index 0000000..eb163f8
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-top/cryptopensc
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -e
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+. /scripts/functions
+
+# Hook for starting smartcard reading software
+
+if [ ! -e /sbin/pcscd ]; then
+ exit 0
+fi
+
+# Start pcscd daemon nomrally:
+# start-stop-daemon --start --quiet \
+# --pidfile /var/run/pcscd.pid \
+# --exec /sbin/pcscd
+# Alternatively, start pcscd daemon in foreground so that it's pretty colored
+# output may be seen on the console, useful for watching error messages since
+# pcscd uses syslog which is not available (use --error or --critical to filter
+# out debug message clutter):
+# /sbin/pcscd --error --foreground &
+/sbin/pcscd --foreground &
diff --git a/dyneIII/live-init-scripts/scripts/local-top/cryptroot b/dyneIII/live-init-scripts/scripts/local-top/cryptroot
new file mode 100755
index 0000000..f616782
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/local-top/cryptroot
@@ -0,0 +1,343 @@
+#!/bin/sh
+
+# source for log_*_msg() functions, see LP: #272301
+. /scripts/functions
+
+#
+# Standard initramfs preamble
+#
+prereqs()
+{
+ # Make sure that cryptroot is run last in local-top
+ for req in /scripts/local-top/*; do
+ script=${req##*/}
+ if [ $script != cryptroot ]; then
+ echo $script
+ fi
+ done
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+#
+# Helper functions
+#
+message()
+{
+ if [ -p /dev/.initramfs/usplash_outfifo ] && [ -x /sbin/usplash_write ]; then
+ usplash_write "TEXT-URGENT $@"
+ else
+ echo "$@" >&2
+ fi
+ return 0
+}
+
+udev_settle()
+{
+ # Wait for udev to be ready, see https://launchpad.net/bugs/85640
+ if [ -x /sbin/udevadm ]; then
+ /sbin/udevadm settle --timeout=30
+ elif [ -x /sbin/udevsettle ]; then
+ /sbin/udevsettle --timeout=30
+ fi
+ return 0
+}
+
+parse_options()
+{
+ local cryptopts
+ cryptopts="$1"
+
+ if [ -z "$cryptopts" ]; then
+ return 1
+ fi
+
+ # Defaults
+ cryptcipher=aes-cbc-essiv:sha256
+ cryptsize=256
+ crypthash=ripemd160
+ crypttarget=cryptroot
+ cryptsource=""
+ cryptlvm=""
+ cryptkeyscript=""
+ cryptkey="" # This is only used as an argument to an eventual keyscript
+ crypttries=3
+
+ local IFS=" ,"
+ for x in $cryptopts; do
+ case $x in
+ hash=*)
+ crypthash=${x#hash=}
+ ;;
+ size=*)
+ cryptsize=${x#size=}
+ ;;
+ cipher=*)
+ cryptcipher=${x#cipher=}
+ ;;
+ target=*)
+ crypttarget=${x#target=}
+ ;;
+ source=*)
+ cryptsource=${x#source=}
+ if [ ${cryptsource#UUID=} != $cryptsource ]; then
+ cryptsource="/dev/disk/by-uuid/${cryptsource#UUID=}"
+ elif [ ${cryptsource#LABEL=} != $cryptsource ]; then
+ cryptsource="/dev/disk/by-label/${cryptsource#LABEL=}"
+ fi
+ ;;
+ lvm=*)
+ cryptlvm=${x#lvm=}
+ ;;
+ keyscript=*)
+ cryptkeyscript=${x#keyscript=}
+ ;;
+ key=*)
+ if [ "${x#key=}" != "none" ]; then
+ cryptkey=${x#key=}
+ fi
+ ;;
+ tries=*)
+ crypttries="${x#tries=}"
+ case "$crypttries" in
+ *[![:digit:].]*)
+ crypttries=3
+ ;;
+ esac
+ ;;
+ esac
+ done
+
+ if [ -z "$cryptsource" ]; then
+ message "cryptsetup: source parameter missing"
+ return 1
+ fi
+ return 0
+}
+
+activate_vg()
+{
+ local vg
+ vg="${1#/dev/mapper/}"
+
+ # Sanity checks
+ if [ ! -x /sbin/lvm ] || [ "$vg" = "$1" ]; then
+ return 1
+ fi
+
+ # Make sure that the device contains at least one dash
+ if [ "${vg%%-*}" = "$vg" ]; then
+ return 1
+ fi
+
+ # Split volume group from logical volume.
+ vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#')
+
+ # Reduce padded --'s to -'s
+ vg=$(echo ${vg} | sed -e 's#--#-#g')
+
+ lvm vgchange -ay ${vg}
+ return $?
+}
+
+activate_evms()
+{
+ local dev module
+ dev="${1#/dev/evms/}"
+
+ # Sanity checks
+ if [ ! -x /sbin/evms_activate ] || [ "$dev" = "$1" ]; then
+ return 1
+ fi
+
+ # Load modules used by evms
+ for module in dm-mod linear raid0 raid1 raid10 raid5 raid6; do
+ modprobe -q $module
+ done
+
+ # Activate it
+ /sbin/evms_activate
+ return $?
+}
+
+setup_mapping()
+{
+ local opts count cryptcreate cryptremove NEWROOT
+ opts="$1"
+
+ if [ -z "$opts" ]; then
+ return 0
+ fi
+
+ parse_options "$opts" || return 1
+
+ if [ -n "$cryptkeyscript" ] && [ ! -x "$cryptkeyscript" ]; then
+ message "cryptsetup: error - script \"$cryptkeyscript\" missing"
+ return 1
+ fi
+
+ # The same target can be specified multiple times
+ # e.g. root and resume lvs-on-lvm-on-crypto
+ if [ -e "/dev/mapper/$crypttarget" ]; then
+ return 0
+ fi
+
+ modprobe -q dm_crypt
+
+ # Make sure the cryptsource device is available
+ if [ ! -e $cryptsource ]; then
+ activate_vg $cryptsource
+ activate_evms $cryptsource
+ fi
+
+ # If the encrypted source device hasn't shown up yet, give it a
+ # little while to deal with removable devices
+
+ # the following lines below have been taken from
+ # /usr/share/initramfs-tools/scripts/local, as suggested per
+ # https://launchpad.net/bugs/164044
+ if [ ! -e "$cryptsource" ]
+ then
+ log_begin_msg "Waiting for encrypted source device..."
+
+ # Default delay is 180s
+ if [ -z "${ROOTDELAY}" ]; then
+ slumber=180
+ else
+ slumber=${ROOTDELAY}
+ fi
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT ${slumber}" || true
+ fi
+
+ slumber=$(( ${slumber} * 10 ))
+ while [ ! -e "$cryptsource" ]
+ do
+ /bin/sleep 0.1
+ slumber=$(( ${slumber} - 1 ))
+ [ ${slumber} -gt 0 ] || break
+ done
+
+ if [ ${slumber} -gt 0 ]; then
+ log_end_msg 0
+ else
+ log_end_msg 1 || true
+ fi
+ if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT 15" || true
+ fi
+ fi
+ udev_settle
+
+ # We've given up, but we'll let the user fix matters if they can
+ while [ ! -e "${cryptsource}" ]; do
+ echo " Check cryptopts=source= bootarg cat /proc/cmdline"
+ echo " or missing modules, devices: cat /proc/modules ls /dev"
+ panic -r "ALERT! ${cryptsource} does not exist. Dropping to a shell!"
+ done
+
+ # Prepare commands
+ if /sbin/cryptsetup isLuks $cryptsource > /dev/null 2>&1; then
+ cryptcreate="/sbin/cryptsetup -T 1 luksOpen $cryptsource $crypttarget"
+ else
+ cryptcreate="/sbin/cryptsetup -T 1 -c $cryptcipher -s $cryptsize -h $crypthash create $crypttarget $cryptsource"
+ fi
+ cryptremove="/sbin/cryptsetup remove $crypttarget"
+ NEWROOT="/dev/mapper/$crypttarget"
+
+ # Try to get a satisfactory password $crypttries times
+ count=0
+ while [ $crypttries -le 0 ] || [ $count -lt $crypttries ]; do
+ count=$(( $count + 1 ))
+
+ if [ $count -gt 1 ]; then
+ sleep 3
+ fi
+
+ if [ $crypttries -gt 0 ] && [ $count -gt $crypttries ]; then
+ message "cryptsetup: maximum number of tries exceeded for $crypttarget"
+ return 1
+ fi
+
+ if [ -z "$cryptkeyscript" ]; then
+ cryptkeyscript="/lib/cryptsetup/askpass"
+ cryptkey="Unlocking the disk $cryptsource ($crypttarget)\nEnter passphrase: "
+ fi
+
+
+ if ! crypttarget="$crypttarget" cryptsource="$cryptsource" \
+ $cryptkeyscript "$cryptkey" | $cryptcreate --key-file=- ; then
+ message "cryptsetup: cryptsetup failed, bad password or options?"
+ continue
+ fi
+
+ if [ ! -e "$NEWROOT" ]; then
+ message "cryptsetup: unknown error setting up device mapping"
+ return 1
+ fi
+
+ FSTYPE=''
+ eval $(fstype < "$NEWROOT")
+
+ # See if we need to setup lvm on the crypto device
+ if [ "$FSTYPE" = "lvm" ] || [ "$FSTYPE" = "lvm2" ]; then
+ if [ -z "$cryptlvm" ]; then
+ message "cryptsetup: lvm fs found but no lvm configured"
+ return 1
+ elif ! activate_vg "/dev/mapper/$cryptlvm"; then
+ # disable error message, LP: #151532
+ #message "cryptsetup: failed to setup lvm device"
+ return 1
+ fi
+
+ NEWROOT="/dev/mapper/$cryptlvm"
+ eval $(fstype < "$NEWROOT")
+ fi
+
+ if [ -z "$FSTYPE" ] || [ "$FSTYPE" = "unknown" ]; then
+ message "cryptsetup: unknown fstype, bad password or options?"
+ $cryptremove
+ continue
+ fi
+
+ message "cryptsetup: $crypttarget setup successfully"
+ break
+ done
+
+ udev_settle
+ return 0
+}
+
+#
+# Begin real processing
+#
+
+# Do we have any kernel boot arguments?
+found=''
+for opt in $(cat /proc/cmdline); do
+ case $opt in
+ cryptopts=*)
+ found=yes
+ setup_mapping "${opt#cryptopts=}"
+ ;;
+ esac
+done
+
+if [ -n "$found" ]; then
+ exit 0
+fi
+
+# Do we have any settings from the /conf/conf.d/cryptroot file?
+if [ -r /conf/conf.d/cryptroot ]; then
+ while read mapping <&3; do
+ setup_mapping "$mapping"
+ done 3< /conf/conf.d/cryptroot
+fi
+
+exit 0
diff --git a/dyneIII/live-init-scripts/scripts/nfs b/dyneIII/live-init-scripts/scripts/nfs
new file mode 100644
index 0000000..b9c2522
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/nfs
@@ -0,0 +1,83 @@
+# NFS filesystem mounting -*- shell-script -*-
+
+# FIXME This needs error checking
+
+retry_nr=0
+
+# parse nfs bootargs and mount nfs
+do_nfsmount()
+{
+
+ configure_networking
+
+ # get nfs root from dhcp
+ if [ "x${NFSROOT}" = "xauto" ]; then
+ # check if server ip is part of dhcp root-path
+ if [ "${ROOTPATH#*:}" = "${ROOTPATH}" ]; then
+ NFSROOT=${ROOTSERVER}:${ROOTPATH}
+ else
+ NFSROOT=${ROOTPATH}
+ fi
+
+ # nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
+ elif [ -n "${NFSROOT}" ]; then
+ # nfs options are an optional arg
+ if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
+ NFSOPTS="-o ${NFSROOT#*,}"
+ fi
+ NFSROOT=${NFSROOT%%,*}
+ if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
+ NFSROOT=${ROOTSERVER}:${NFSROOT}
+ fi
+ fi
+
+ if [ -z "${NFSOPTS}" ]; then
+ NFSOPTS="-o retrans=10"
+ fi
+
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-premount"
+ run_scripts /scripts/nfs-premount
+ [ "$quiet" != "y" ] && log_end_msg
+
+ if [ ${readonly} = y ]; then
+ roflag="-o ro"
+ else
+ roflag="-o rw"
+ fi
+
+ nfsmount -o nolock ${roflag} ${NFSOPTS} ${NFSROOT} ${rootmnt}
+}
+
+# NFS root mounting
+mountroot()
+{
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-top"
+ run_scripts /scripts/nfs-top
+ [ "$quiet" != "y" ] && log_end_msg
+
+ modprobe nfs
+ # For DHCP
+ modprobe af_packet
+
+ # Default delay is around 180s
+ # FIXME: add usplash_write info
+ if [ -z "${ROOTDELAY}" ]; then
+ delay=180
+ else
+ delay=${ROOTDELAY}
+ fi
+
+ # loop until nfsmount succeds
+ while [ ${retry_nr} -lt ${delay} ] && [ ! -e ${rootmnt}${init} ]; do
+ [ ${retry_nr} -gt 0 ] && \
+ [ "$quiet" != "y" ] && log_begin_msg "Retrying nfs mount"
+ do_nfsmount
+ retry_nr=$(( ${retry_nr} + 1 ))
+ [ ! -e ${rootmnt}${init} ] && /bin/sleep 1
+ [ ${retry_nr} -gt 0 ] && [ "$quiet" != "y" ] && log_end_msg
+ done
+
+ [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/nfs-bottom"
+ run_scripts /scripts/nfs-bottom
+ [ "$quiet" != "y" ] && log_end_msg
+}
diff --git a/dyneIII/live-init-scripts/scripts/nfs-top/udev b/dyneIII/live-init-scripts/scripts/nfs-top/udev
new file mode 100755
index 0000000..980e496
--- /dev/null
+++ b/dyneIII/live-init-scripts/scripts/nfs-top/udev
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+# initramfs nfs-top script for udev
+
+PREREQ=""
+
+# Output pre-requisites
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case "$1" in
+ prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+# Each call to udevsettle can take up to three minutes
+if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT 360"
+ trap "/sbin/usplash_write 'TIMEOUT 15'" 0
+fi
+
+# We need to wait for the network card drivers to be loaded
+/sbin/udevadm settle