summaryrefslogtreecommitdiffstats
path: root/inc/functions.common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'inc/functions.common.sh')
-rw-r--r--inc/functions.common.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/inc/functions.common.sh b/inc/functions.common.sh
index 75586c2..c7ab9bd 100644
--- a/inc/functions.common.sh
+++ b/inc/functions.common.sh
@@ -68,4 +68,53 @@ getopt_start () {
run_global_checks () {
:
+}
+
+get_preboot_serials() {
+
+ pinfo "Retrieving serials..."
+
+ unset_quiet
+ wget -qO- ${pbs_url}/resource/getprebootserials/apikey/apikey_uni-freiburg | cat
+ set_quiet
+
+}
+
+choose_serial() {
+
+ pechon "Choose serial to use for the image.\n\tPress the corresponding number, or r for random serial or empty for default serial: "
+
+ read serial_choice
+ if [ "x$serial_choice" = "x" ]
+ then
+ echo ${default_serial} > $TMP_DIR/serial
+ else
+ wget -O $TMP_DIR/serial ${pbs_url}/resource/getprebootserials/apikey/apikey_uni-freiburg/serialnr/$serial_choice
+ # TODO apikeys
+ fi
+
+ unset_quiet
+ [ "x$FOO" = "x" ] && echo "foo"
+ echo -n "Chosen serial: "
+ cat $TMP_DIR/serial
+ set_quiet
+}
+
+create_serial_module() {
+
+ . $ROOT_DIR/config/setup.conf
+
+ pinfo "Creating initramfs serial module ..."
+
+ get_preboot_serials
+ choose_serial
+
+ cd $TMP_DIR
+
+ find serial | cpio --quiet -H newc -o > initramfs-serial.cpio
+ gzip initramfs-serial.cpio
+ mv initramfs-serial.cpio.gz $ROOT_DIR/build/initramfs-serial
+ cd -
+
+ rm $TMP_DIR/serial
} \ No newline at end of file