SYSLINUX=${ROOT_DIR}/contrib/syslinux/latest PATH="${ROOT_DIR}/bin/:$PATH" QUIET="0" banner () { echo -e "\t __ __ __ " echo -e "\t.-----.| |--.--------.| |_| |--." echo -e "\t| _ || _ | || _| < " echo -e "\t| __||_____|__|__|__||____|__|__|" echo -e "\t|__| " echo -e "\t ** OpenSLX Project // 2011 **" echo -e "\t http://lab.openslx.org/" echo -e "" } set_quiet () { if [ "x$DEBUG" != "x1" -a "x$QUIET" != "x1" ]; then exec 6>&1 > $LOG_DIR/stdout.log exec 2> $LOG_DIR/stderr.log QUIET="1" fi } unset_quiet () { if [ "x$QUIET" = "x1" ]; then exec 1>&6 6>&- exec 2>&- QUIET="0" fi } pinfo () { unset_quiet echo -e "[info] $1" set_quiet } perror () { unset_quiet echo -e "[error] $1" set_quiet } pecho () { unset_quiet echo -e "[user] $1" set_quiet } pechon () { unset_quiet echo -e -n "[user] $1" set_quiet } getopt_start () { GETOPT_TEMP=`getopt -o $SHORT_OPTS --long $LONG_OPTS \ -n "$SELF" -- "$@"` if [ $? != 0 ] ; then perror "Unknown option(s).\n" print_usage exit 1 fi } 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 }