; html-script: false ]#!/bin/bash
TFTP_DIR=/srv/tftp
INSTSRC_DIR=/srv/instsrc
if [ -z $@ ] ; then
echo "Usage: register-vmware <path to iso-file> labelname"
exit 1
fi
#set -x
ISO_FILE=$1
mkdir /mnt/loop
mount -o loop $ISO_FILE /mnt/loop
if [ -f /mnt/loop/packages.xml ] ; then
# Determine ISO information
OS_LABEL="$( grep "<name>" /mnt/loop/packages.xml | sed -e "s,<name>,," -e "s,</name>,," )"
OS_NAME="$( grep "<ProductLineId>" /mnt/loop/packages.xml | sed -e "s,<ProductLineId>,," -e "s,</ProductLineId>,," )"
OS_RELEASE="$( grep "<version>" /mnt/loop/packages.xml | sed -e "s,<version>,," -e "s,</version>,," )"
OS_BUILD="$( grep "<release>" /mnt/loop/packages.xml | sed -e "s,<release>,," -e "s,</release>,," )"
shopt -s extglob
OS_LABEL=${OS_LABEL##*( )}
OS_NAME=${OS_NAME##*( )}
OS_RELEASE=${OS_RELEASE##*( )}
OS_BUILD=${OS_BUILD##*( )}
elif [ -f /mnt/loop/README.txt ] ; then
OS_LABEL=""
OS_NAME=""
OS_RELEASE=""
OS_BUILD=""
fi
# Create directories
mkdir -p $TFTP_DIR/boot/$OS_NAME/$OS_RELEASE-$OS_BUILD
mkdir -p $TFTP_DIR/pxelinux.cfg/$OS_NAME
mkdir -p $INSTSRC_DIR/$OS_NAME/$OS_RELEASE-$OS_BUILD
#set +x
# Copy CD/DVD content
rsync -av /mnt/loop/* $INSTSRC_DIR/$OS_NAME/$OS_RELEASE-$OS_BUILD
# Copy the PXE boot file (initrd/kernel)
cp $INSTSRC_DIR/$OS_NAME/$OS_RELEASE-$OS_BUILD/isolinux/initrd.img
$TFTP_DIR/boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/initrd.img
cp $INSTSRC_DIR/$OS_NAME/$OS_RELEASE-$OS_BUILD/isolinux/vmlinuz
$TFTP_DIR/boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/vmlinuz
# Create the PXE boot menu
cat > $TFTP_DIR/pxelinux.cfg/$OS_NAME/$OS_NAME-$OS_RELEASE-$OS_BUILD.menu << EOF
#LABEL $OS_LABEL $OS_RELEASE - build $OS_BUILD
#OSNAME $OS_NAME
#OSARCH x86_64
MENU TITLE VMware Installservice
MENU BACKGROUND addons/background-vmware.png
MENU COLOR screen 37;40 #80ffffff #00000000
MENU COLOR border 0 #ffffffff #ee000000 std
MENU COLOR title 0 #ffffffff #ee000000 std
MENU COLOR unsel 0 #ffffffff #ee000000 std
MENU COLOR sel 0 #ffffffff #85000000 std
MENU COLOR scrollbar 30;44 #40000000 #00000000
MENU COLOR tabmsg 0 #ee000000 #ffffffff std
MENU COLOR cmdmark 0 #ff00ff00 #00000000 std
MENU COLOR cmdline 0 #ee000000 #ffffffff std
MENU COLOR timeout_msg 0 #ee000000 #ffffffff std
MENU COLOR timeout 0 #ee000000 #ffffffff std
MENU COLOR disabled 0 #ffffffff #ee000000 std
MENU COLOR pwdheader 0 #ff000000 #99ffffff rev
MENU COLOR pwdborder 0 #ff000000 #99ffffff rev
MENU COLOR pwdentry 0 #ff000000 #99ffffff rev
MENU COLOR hotkey 0 #ff00ff00 #ee000000 std
MENU COLOR hotsel 0 #ffffffff #85000000 std
LABEL DESC
MENU LABEL $OS_LABEL $OS_RELEASE
MENU DISABLE
MENU SEPARATOR
LABEL kickstart
MENU LABEL ^Kickstart Installation
KERNEL boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/vmlinuz
APPEND initrd=boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/initrd.img vmkopts=debugLogToSerial:1 mem=512M ks=http://install.home.barfoo.org/kickstart/$OS_NAME-$OS_RELEASE-$OS_BUILD.cfg HOSTNAME=
IAPPEND 1
TEXT HELP
Es ist zu beachten, das mit TAB der Hostname angepasst werden muss!
ENDTEXT
LABEL netinst
MENU LABEL ^Netzwerkbasierte Installation
KERNEL boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/vmlinuz
APPEND initrd=boot/$OS_NAME/$OS_RELEASE-$OS_BUILD/initrd.img vmkopts=debugLogToSerial:1 mem=512M url=http://install.home.barfoo.org/instsrc/$OS_NAME/$OS_RELEASE-$OS_BUILD
IAPPEND 1
MENU SEPARATOR
LABEL back
MENU LABEL <-- ^Vorherige Ansicht
KERNEL addons/vesamenu.c32
APPEND pxelinux.cfg/$OS_NAME.menu
EOF
umount /mnt/loop
rmdir /mnt/loop