summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2012-01-27 18:45:44 +0100
committerJonathan Bauer2012-01-27 18:45:44 +0100
commitadd30cb16f22e5603ee99eac5fc09cc4efde06ea (patch)
treeb8b45bd83d0455e9e9291bb28d5ed960c17b62b9
parentremoved file (diff)
downloadusb-boot-stick-master.tar.gz
usb-boot-stick-master.tar.xz
usb-boot-stick-master.zip
serial genHEADmaster
-rw-r--r--config/setup.conf4
-rw-r--r--inc/functions.common.sh49
-rw-r--r--inc/functions.iso.sh30
-rw-r--r--inc/functions.pbs-serials.sh11
-rw-r--r--inc/functions.usb.sh4
5 files changed, 55 insertions, 43 deletions
diff --git a/config/setup.conf b/config/setup.conf
index ece1f21..627e11c 100644
--- a/config/setup.conf
+++ b/config/setup.conf
@@ -13,8 +13,8 @@ base_dir=~/work/preboot
#PBS CONFIG
pbs_url=http://pbs2.mp.openslx.org
-default_serial=11-22-33-44-55
+default_serial=22-33-44-55-66
#Apikeys
-openslx=apikey1
+uni_fr=apikey_uni-freiburg
dfn=apikey2
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
diff --git a/inc/functions.iso.sh b/inc/functions.iso.sh
index c5508b3..a9cc570 100644
--- a/inc/functions.iso.sh
+++ b/inc/functions.iso.sh
@@ -73,7 +73,7 @@ copy_files () {
cp -v $ROOT_DIR/build/kernel-preboot-latest $TMP_DIR/isolinux/kernel
cp -v $ROOT_DIR/build/initramfs-default $TMP_DIR/isolinux/initramfs
- mv $TMP_DIR/initramfs-serial $TMP_DIR/isolinux/serial
+ cp -v $ROOT_DIR/build/initramfs-serial $TMP_DIR/isolinux/serial
cp -v $SYSLINUX/com32/menu/menu.c32 $TMP_DIR/isolinux/
cp -v $SYSLINUX/com32/menu/vesamenu.c32 $TMP_DIR/isolinux/
@@ -92,34 +92,7 @@ copy_files () {
}
-get_preboot_serial() {
-
- pinfo "Retrieving serials..."
-
- unset_quiet
- wget -qO- pbs2.mp.openslx.org/resource/getprebootserials/apikey/apikey_uni-freiburg | cat
- set_quiet
-
- 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
- wget -O $TMP_DIR/serial pbs2.mp.openslx.org/resource/getprebootserials/apikey/apikey_uni-freiburg/serialnr/$serial_choice
-
-}
-create_serial_module() {
-
- pinfo "Writing initramfs serial module ..."
-
- cd $TMP_DIR
-
- find serial | cpio --quiet -H newc -o > initramfs-serial.cpio
- gzip initramfs-serial.cpio
- mv initramfs-serial.cpio.gz initramfs-serial
-
- cd -
-
- rm $TMP_DIR/serial
-}
create_iso () {
pinfo "Create ISO."
@@ -143,7 +116,6 @@ run () {
pre_start_cleanup
setup_dir_structure
- get_preboot_serial
create_serial_module
copy_files
create_iso
diff --git a/inc/functions.pbs-serials.sh b/inc/functions.pbs-serials.sh
index a079e9e..75f02c9 100644
--- a/inc/functions.pbs-serials.sh
+++ b/inc/functions.pbs-serials.sh
@@ -44,17 +44,6 @@ read_params() {
done
}
-get_preboot_serials() {
-
- pinfo "Retrieving Serials..."
-
- unset_quiet
- wget -qO- pbs2.mp.openslx.org/resource/getprebootserials/apikey/apikey_uni-freiburg | cat
- set_quiet
-
-
-}
-
run () {
set_quiet
diff --git a/inc/functions.usb.sh b/inc/functions.usb.sh
index 41a3a8a..f5b01f6 100644
--- a/inc/functions.usb.sh
+++ b/inc/functions.usb.sh
@@ -163,6 +163,7 @@ copy_files () {
$SUDOCMD cp -v ${ROOT_DIR}/build/${KERNEL} /media/openslx-stick/boot/kernel
$SUDOCMD cp -v ${ROOT_DIR}/build/${INITRAMFS} /media/openslx-stick/boot/initramfs
+ $SUDOCMD cp -v ${ROOT_DIR}/build/initramfs-serial /media/openslx-stick/boot/serial
$SUDOCMD cp -v ${SYSLINUX}/com32/menu/menu.c32 /media/openslx-stick/boot/
$SUDOCMD cp -v ${SYSLINUX}/com32/menu/vesamenu.c32 /media/openslx-stick/boot/
@@ -192,7 +193,8 @@ run () {
umount_dev
create_partitions
create_fs
- mount_stick
+ mount_stick
+ create_serial_module
copy_files
umount_stick
run_syslinux