summaryrefslogtreecommitdiffstats
path: root/inc/functions.create-installer.sh
diff options
context:
space:
mode:
authorSebastian Schmelzer2011-05-04 18:11:19 +0200
committerSebastian Schmelzer2011-05-04 18:11:19 +0200
commitade0d1f264970b404de66142d830b07a4ce43ddc (patch)
tree6f80e2df7863a598666272b116e37e4c6139f62e /inc/functions.create-installer.sh
parentfix for small, single partition usb sticks (diff)
downloadusb-boot-stick-ade0d1f264970b404de66142d830b07a4ce43ddc.tar.gz
usb-boot-stick-ade0d1f264970b404de66142d830b07a4ce43ddc.tar.xz
usb-boot-stick-ade0d1f264970b404de66142d830b07a4ce43ddc.zip
pbmtk v1
Diffstat (limited to 'inc/functions.create-installer.sh')
-rw-r--r--inc/functions.create-installer.sh119
1 files changed, 119 insertions, 0 deletions
diff --git a/inc/functions.create-installer.sh b/inc/functions.create-installer.sh
new file mode 100644
index 0000000..c323439
--- /dev/null
+++ b/inc/functions.create-installer.sh
@@ -0,0 +1,119 @@
+SHORT_OPTS=":vfdhi"
+LONG_OPTS="version,force,debug,iso,help"
+
+KERNEL="kernel-preboot-latest"
+INITRAMFS="initramfs-default"
+PBSI=$ROOT_DIR/installer/pbstick-installer
+
+LOG_DIR="/tmp/pbmtk"
+
+run_module_checks () {
+
+ if [ ! -z $1 ]; then
+ perror "Too many parameters. \n"
+ print_usage
+ exit 1
+ fi
+
+ if [ -z $(which uuencode) ]; then
+ perror "'uuencode' is missing (if you are on a debian/ubuntu system: apt-get install sharutils)"
+ exit 1
+ fi
+}
+
+init_params () {
+ FORCE=0
+ DEBUG=0
+}
+
+print_usage() {
+ echo "Usage: $(basename $SELF) installer [OPTIONS]"
+ echo -e " -d --debug \t give more debug output"
+ echo -e " -i --iso \t include code for ISO generation"
+ echo -e " -f --force \t don't ask questions"
+ echo -e " -h --help \t print help"
+ echo -e " -v --version \t print version information"
+}
+
+read_params() {
+ getopt_start $@
+
+ eval set -- "$GETOPT_TEMP"
+
+ while true ; do
+ case "$1" in
+ -v|--version)
+ echo "OpenSLX PreBoot .. ($VERSION - $VDATE)."
+ exit 0
+ ;;
+ -h|--help)
+ print_usage
+ exit 0
+ ;;
+ -i|--iso) pinfo "ISO mode not yet finished .. skipping."; shift ;;
+ -f|--force) pinfo "Disable user-interaction."; FORCE=1; shift ;;
+ -d|--debug) pinfo "Enabled debugmode."; DEBUG=1; unset_quiet; shift ;;
+ --) shift ; break ;;
+ *) perror "Internal error!" ; exit 1 ;;
+ esac
+ done
+}
+
+pre_start_cleanup () {
+ pinfo "Cleanup installer tmp."
+ rm -rfv $ROOT_DIR/installer/tmp
+ rm -fv $ROOT_DIR/installer/stick-payload.tar.bz2
+}
+
+setup_dir_structure () {
+ pinfo "Create dir structure."
+ mkdir -p $ROOT_DIR/installer/tmp/share \
+ $ROOT_DIR/installer/tmp/bin \
+ $ROOT_DIR/installer/tmp/boot
+}
+
+copy_files () {
+ pinfo "Copy required files."
+ cp -fv $SYSLINUX/mbr/mbr.bin $ROOT_DIR/installer/tmp/share
+ cp -fv $SYSLINUX/linux/syslinux $ROOT_DIR/installer/tmp/bin
+
+ cp -fv $ROOT_DIR/build/$KERNEL $ROOT_DIR/installer/tmp/boot/kernel
+
+ cp -fv $ROOT_DIR/build/$INITRAMFS $ROOT_DIR/installer/tmp/boot/initramfs
+
+ cp -fv $SYSLINUX/com32/menu/menu.c32 $ROOT_DIR/installer/tmp/boot/
+ cp -fv $SYSLINUX/com32/menu/vesamenu.c32 $ROOT_DIR/installer/tmp/boot/
+ cp -fv $ROOT_DIR/config/extlinux/* $ROOT_DIR/installer/tmp/boot/
+ mv -v $ROOT_DIR/installer/tmp/boot/extlinux.conf $ROOT_DIR/installer/tmp/boot/syslinux.cfg
+
+}
+
+create_payload () {
+ pinfo "Create payload."
+ cd $ROOT_DIR/installer/tmp/
+ tar cjfv ../stick-payload.tar.bz2 *
+ cd $ROOT_DIR
+}
+
+create_installer () {
+ pinfo "Complete installer."
+ cat $ROOT_DIR/installer/tpl/installer.tpl.sh > $PBSI
+ echo "PAYLOAD:" >> $PBSI
+ cat $ROOT_DIR/installer/stick-payload.tar.bz2 | uuencode - >> $PBSI
+ chmod +rx $PBSI
+}
+
+
+run () {
+ set_quiet
+
+ pre_start_cleanup
+ setup_dir_structure
+ copy_files
+ create_payload
+ create_installer
+
+ unset_quiet
+
+ pinfo "FINISHED: Installer can be found here: $PBSI!"
+} \ No newline at end of file