Some extra example hooks
authorSerge van Ginderachter <serge@vanginderachter.be>
Fri, 24 Sep 2010 07:45:06 +0000 (09:45 +0200)
committerGuido Trotter <ultrotter@google.com>
Mon, 10 Oct 2011 17:36:42 +0000 (13:36 -0400)
1) Hook to set default passwords in the instance
2) Hook to set a timezone for the instance

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

examples/hooks/confdata/defaultpasswords [new file with mode: 0644]
examples/hooks/confdata/timezone [new file with mode: 0644]
examples/hooks/defaultpasswords [new file with mode: 0755]
examples/hooks/hosts [new file with mode: 0755]
examples/hooks/timezone [new file with mode: 0755]

diff --git a/examples/hooks/confdata/defaultpasswords b/examples/hooks/confdata/defaultpasswords
new file mode 100644 (file)
index 0000000..548683d
--- /dev/null
@@ -0,0 +1 @@
+root:s3cr3t
diff --git a/examples/hooks/confdata/timezone b/examples/hooks/confdata/timezone
new file mode 100644 (file)
index 0000000..82f7e44
--- /dev/null
@@ -0,0 +1 @@
+Europe/Brussels
diff --git a/examples/hooks/defaultpasswords b/examples/hooks/defaultpasswords
new file mode 100755 (executable)
index 0000000..ed1dbd6
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+#
+# This is an example script that sets the root pasword to a given default
+
+cat $(dirname $0)/confdata/defaultpasswords | chroot $TARGET chpasswd
+
+
diff --git a/examples/hooks/hosts b/examples/hooks/hosts
new file mode 100755 (executable)
index 0000000..4daf620
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# This is an example script that sets the hostname and hosts file
+
+VMFQDN=$INSTANCE_NAME
+VMHOSTNAME=${VMFQDN%%.*}
+
+[ x$VMFQDN -eq x$VMHOSTNAME ] && VMFQDN=""
+
+echo "127.0.1.1                $VMFQDN $VMHOSTNAME" >> $TARGET/etc/host
+
diff --git a/examples/hooks/timezone b/examples/hooks/timezone
new file mode 100755 (executable)
index 0000000..ff6c968
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# This is an example script that sets the timezone to a given default
+
+cp confdata/timezone $TARGET/etc/
+chroot $TARGET dpkg-reconfigure --frontend noninteractive tzdata
+
+