target: Don't symlink outside of /var

We will want to share /var with petitboot plugins, but most of the
directories in /var are actually symlinks to outside of var (to /tmp).

This change replaces the symlinks with actual directories. Since we're
running in an initramfs, we don't need to put everything in /tmp.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/openpower/scripts/fixup-target-var b/openpower/scripts/fixup-target-var
new file mode 100755
index 0000000..171b916
--- /dev/null
+++ b/openpower/scripts/fixup-target-var
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# replace /var/* symlinks with actual directories
+
+find $TARGET_DIR/var/ -type l |
+while read path
+do
+    target=$(realpath $path)
+    [ -d "$target" ] || continue
+    rm $path
+    mkdir $path
+done