T
take-xen.de
Guest
Hi, hat jemand von euch schonmal folgendes Patch erfolgreich durchgearbeitet?
Stehe gerade vor dem Problem die ESXi ISO für den HW-Raid Controller nicht gepached zu bekommen..
MOD: Bitte [noparse]
[/noparse]-Tags um Ausgaben, Code, etc. verwenden (im Editor auch mit '#' erreichbar). Danke!
Stehe gerade vor dem Problem die ESXi ISO für den HW-Raid Controller nicht gepached zu bekommen..
Code:
#!/bin/bash
# VMware ESXi 4.0.0 ISO patch script 20090704
# - integrates 3ware 9650SE driver
# - integrates better wget and rsync from vm-help.com
# - activates unsupported (!!) SSH server
#
# by Philipp Wollermann <philipp@igowo.de>
# uses ideas from Varazirs mkesxiaio.sh: [url]http://varazir.mine.nu/esxi/[/url]
# Requirements:
#
# tested with Ubuntu Linux 8.04
# please do "apt-get install unzip bzip2 mkisofs"
# Usage:
#
# 1) Get the following files and put them in a directory with this shell script:
#
# VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso
# (-> [url]https://www.vmware.com/go/get-free-esxi/[/url])
#
# ESX_ESXi_4.0_driver-GUID78f4117c3d57443485d1c9c989d80909.iso
# (-> [url]http://www.3ware.com/KB/article.aspx?id=15548[/url])
#
# simple.map (you can extract that from an installed ESXi 4.0, see below)
#
# 2) Start the script from the directory where you placed all the files.
# Hint:
#
# I don't know if the simple.map can be redistributed, so for now you have to
# extract it yourself:
#
# Get VMware Workstation or Fusion (something else like VirtualBox may also work)
# Install ESXi as a virtual machine (see [url]http://communities.vmware.com/docs/DOC-6590[/url])
# When the install is finished and you see the yellow management screen, press Alt-F1
# Enter "unsupported", press ENTER, when asked for a password, just press ENTER
# Copy the simple.map to your Linux workstation using:
#
# scp /etc/vmware/simple.map 123.123.123.123:/root
# Todo:
#
# - Find out how to unpack the sys.vgz files, so the simple.map can be extracted
# automatically.
set -e
set -u
RPWD=`pwd`
# Check if the script is run as a super-user
if [ ! $( id -u ) -eq 0 ]; then
echo "Must have super-user rights to run this script."
exit 0
fi
# Clean-up
echo "Preparing ..."
umount esx-cd || /bin/true
umount esx-dd || /bin/true
umount esx-3ware || /bin/true
rm -f ESXi-custom.iso
rm -rf $RPWD/esx-cd $RPWD/esx-build $RPWD/esx-oem $RPWD/esx-image $RPWD/esx-dd $RPWD/esx-3ware $RPWD/esx-3ware-unzip
# Create folders
mkdir -p $RPWD/esx-cd $RPWD/esx-build $RPWD/esx-oem $RPWD/esx-image $RPWD/esx-dd $RPWD/esx-3ware $RPWD/esx-3ware-unzip
# Copy files from ISO
echo "Extracting ISO ..."
mount -o loop VMware-VMvisor-Installer-4.0.0-171294.x86_64.iso $RPWD/esx-cd
cp -a $RPWD/esx-cd/* $RPWD/esx-build/
umount $RPWD/esx-cd
# Unzip 3ware driver
mount -o loop ESX_ESXi_4.0_driver-GUID78f4117c3d57443485d1c9c989d80909.iso $RPWD/esx-3ware
cd $RPWD/esx-3ware-unzip
unzip $RPWD/esx-3ware/offline-bundle/offline-bundle.zip
umount $RPWD/esx-3ware
ar x vmware-esx-drivers-scsi-3w-9xxx-400.2.26.08.035vm40-1.0.4.00000.x86_64.vib
tar xfz data.tar.gz
# Create oem.tgz staging folder
echo "Creating oem.tgz staging area ..."
mkdir -p $RPWD/esx-oem/etc/vmware $RPWD/esx-oem/bin $RPWD/esx-oem/usr/lib/vmware/vmkmod
# Create new inetd.conf with enabled SSH
echo "Creating new inetd.conf ..."
cat > $RPWD/esx-oem/etc/inetd.conf <<'EOF'
# Remote shell access
#
ssh stream tcp nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60
ssh stream tcp6 nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60
# VMware authentication daemon
#
authd stream tcp nowait root /sbin/authd authd
authd stream tcp6 nowait root /sbin/authd authd
EOF
# Create new simple.map with support for 3ware controllers ...
echo "Creating new simple.map ..."
cp $RPWD/simple.map $RPWD/esx-oem/etc/vmware/simple.map
echo "13c1:1004 0000:0000 storage 3w-9xxx.o" >> $RPWD/esx-oem/etc/vmware/simple.map
# Copy 3ware driver into vmkmod directory ...
echo "Copying 3w-9xxx.o driver ..."
cp $RPWD/esx-3ware-unzip/usr/lib/vmware/vmkmod/3w-9xxx.o $RPWD/esx-oem/usr/lib/vmware/vmkmod/
# Download wget and rsync package if not already downloaded
cd $RPWD
if [ ! -e SSH_FTP_oem_1.3.tgz ]; then
echo "Downloading wget/rsync from vm-help.com ..."
wget -q [url]http://www.vm-help.com/esx/esx3i/Custom_oem.tgz/SSH_FTP_oem_1.3.tgz[/url]
fi
# Extract wget and rsync
echo "Integrating wget and rsync ..."
cd $RPWD/esx-oem
tar xfz $RPWD/SSH_FTP_oem_1.3.tgz bin/wget bin/rsync
# Build oem.tgz
echo "Building oem.tgz ..."
cd $RPWD/esx-oem
tar czf $RPWD/esx-build/oem.tgz *
# Add oem.tgz to isolinux.cfg
echo "Patching isolinux.cfg ..."
sed -i 's/install.tgz/install.tgz --- oem.tgz/g' $RPWD/esx-build/isolinux.cfg
# Extract & delete the image
echo "Extracting image ..."
tar -xzf $RPWD/esx-build/image.tgz -C $RPWD/esx-image
rm $RPWD/esx-build/image.tgz
# Unpack the compressed DD file
echo "Unpacking dd file ..."
cd $RPWD/esx-image/usr/lib/vmware/installer/
esx_ddf=(*.bz2)
bunzip2 ${esx_ddf[0]}
esx_ddf=(*.dd)
# Check the number of sectors
esx_sector=$(fdisk -ul ${esx_ddf[0]} 2>>/dev/null | awk '/bytes/ {print $9}')
# Check where the 5th partition starts
esx_number=$(fdisk -ul ${esx_ddf[0]} 2>>/dev/null | awk '/dd5/ {print $2}')
# Calculate offset of 5th partition in dd file
esx_offset=$(($esx_sector*$esx_number))
# Mounting the 5th partition of the DD file to esx-dd
echo "Mounting 5th partition of the DD file (offset: $esx_offset) ..."
mount -o loop,offset=$(($esx_sector*$esx_number)) $esx_ddf $RPWD/esx-dd/
# Copy the custom oem file to the mounted dd file
echo "Copying oem.tgz into dd file ..."
cp $RPWD/esx-build/oem.tgz $RPWD/esx-dd/oem.tgz
# Unmount the dd file
umount $RPWD/esx-dd
# Compressing the dd file
echo "Compressing dd file ..."
bzip2 -9 $esx_ddf
# Rebuilding image.tgz
echo "Rebuilding image ..."
cd $RPWD/esx-image
tar czf $RPWD/esx-build/image.tgz *
echo "Building new ISO ..."
# Build new ISO
cd $RPWD/esx-build
mkisofs -o $RPWD/ESXi-custom.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset utf-8 ../esx-build
rm -rf $RPWD/esx-cd $RPWD/esx-build $RPWD/esx-oem $RPWD/esx-image $RPWD/esx-dd $RPWD/esx-3ware $RPWD/esx-3ware-unzip
echo "Finished!"
exit 0
Code:
...
Last edited by a moderator: