--- /dev/null
+#!/bin/sh /lib/init/init-d-script
+### BEGIN INIT INFO
+# Provides: devices
+# Required-Start:
+# Required-Stop:
+# Default-Start: S
+# Default-Stop: 0 1 6
+# Short-Description: set up devnodes
+# Description: Initialize /dev from /.devnodes.tgz
+### END INIT INFO
+
+DAEMON=none
+DESC="devnodes: restore and capture /dev on startup and shutdown."
+TGZ=/.devnodes.tgz
+
+do_start_override() {
+ [ -e $TGZ ] && tar -xzf $TGZ --skip-old-files -C /dev
+}
+
+do_stop_override() {
+ cd /dev && tar czf $TGZ *
+}
+
+do_status_override() {
+ find /dev -type d -exec ls -ld '{}' ';'
+ stat -c %Y $TGZ
+}
for C in "$@" ; do
IF=$NETNS$i
MAC="${C#*=}"
+ if ip link show $IF > /dev/null 2>&1 ; then
+ : # The interface exists already (bad badness); let things fail
+ elif ifquery --state $IF >/dev/null 2>&1 ; then
+ # doesn't exist but has residue state; quiet cleanup
+ ifdown -f $IF > /dev/null 2>&1
+ fi
if [ -z "$MAC" ] ; then
# set up veth with "random" mac address
ip link add $IF type veth peer name eth$i netns $NETNS
--- /dev/null
+#!/bin/bash
+#
+# This script "cleans" the UPPER directory tree for a subhost by
+# comparing it with the LOWER tree and remove all files that are equal
+# to content.
+
+PROGRAMDIR="$(dirname $(realpath $0))"
+. $PROGRAMDIR/functions
+
+subhost_name $1
+subhost_config
+
+
+
+: ${LOWER:-/}
+
+if [ ! -d "$UPPER" ] || [ ! -d "$LOWER" ] ; then
+ echo "*** needs a root path" >&2
+ exit 1
+fi
+
+if is_live $NAME ; then
+ echo "** Cannot clean running subhost **" >&2
+ exit 1
+fi
+
+UPPER="${UPPER%/}"
+LOWER="${LOWER%/}"
+
+if [ "$UPPER" = "$LOWER" ] ; then
+ echo "** UPER and LOWER are the same directory **" >&2
+ exit 1
+fi
+
+du -sh $UPPER
+exit 0
+DIFFS=/tmp/clean-$NAME.$$
+rm -f $DIFFS
+find $UPPER -type f -printf '%P\n'| while read X ; do
+ cmp "$UPPER/$X" "$LOWER/$X" >> $DIFFS 2>&1 && rm "$UPPER/$X"
+done
+du -sh $UPPER
+echo "(See details in $DIFFS)"
--- /dev/null
+overlay-boot(8)
+===============
+:doctype: manpage
+:revdate: {sys:date "+%Y-%m-%d %H:%M:%S"}
+:COLON: :
+:EQUALS: =
+
+NAME
+----
+overlay-clean-root - Clean UPPER relative LOWER by removing equal files.
+
+SYNOPSIS
+--------
+*overlay-clean-root* _conf_
+
+DESCRIPTION
+-----------
+
+*overlay-clean-root* reduces the UPPER directory tree for an off-line
+subhost by removing all files that equal to the files they shadow in
+the LOWER directory tree.
+
+SEE ALSO
+--------
+
+*overlay-boot*
mount -t tmpfs -osize=$RAM_SIZE,mode=755 tmpfs $LIVE/run
fi
-echo "Installing $OVERLAYDIR/reaper to $LIVE/.reaper"
+echo "bind-mount /etc/adjtime into subhost, if possible"
+mount --bind /etc/adjtime $LIVE/etc/adjtime || true
+
+echo "install $OVERLAYDIR/reaper to $LIVE/.reaper"
cp -p $OVERLAYDIR/reaper $LIVE/.reaper