The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / fixup-fs
diff --git a/cirros-testvm/src-cirros/fixup-fs b/cirros-testvm/src-cirros/fixup-fs
new file mode 100755 (executable)
index 0000000..82e2a76
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+error() { echo "$@" 1>&2; }
+fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
+
+rootd=${1}
+[ -n "${rootd}" -a -d "${rootd}" ] || exit 1
+
+rm -Rf "$rootd/home/default"
+
+# no need for visudo
+rm -f "$rootd/usr/sbin/visudo"
+
+# buildroot symlinks stuff in /var to /tmp
+links="lib/pcmcia pcmcia lock cache log spool pcmcia"
+for f in $links; do
+       p="/var/$f"
+       if [ -L "$rootd/$p" ]; then
+               rm "$rootd/$p" ||
+                       fail "failed to remove file $p"
+       elif [ -d "$rootd/$p" ]; then
+               rmdir "$rootd/$p" ||
+                       fail "rmdir $p failed"
+       else
+               [ -e "$rootd/$p" ] &&
+                       fail "don't know what to do with $p. not dir or link"
+       fi
+done
+mkdir -p $rootd/var
+( cd "$rootd/var" && mkdir -p $links ) ||
+   fail "failed to create directories in /var"
+
+( cd "$rootd/var" && rm -Rf tmp run &&
+   ln -s ../run run && ln -s ../run/var.tmp tmp ) ||
+   fail "failed to make var/run and var/tmp"
+
+rm -f $rootd/etc/resolv.conf &&
+   ln -sf ../run/resolv.conf "$rootd/etc/resolv.conf" ||
+   fail "failed to create resolv.conf symlink"
+
+if [ -L "$rootd/sbin/blkid" -a -x "$rootd/usr/sbin/blkid" ]; then
+   rm -f "$rootd/sbin/blkid"
+fi