cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
64178
Views
23
Helpful
68
Comments
Jeffrey Foster
Cisco Employee
Cisco Employee

****UPDATE July 2021

 

The HUU images launched with our C-Series M6 Rack Servers are now compatible with the following USB creator toolsets:

 

Tool name

Tool link

 Supported on Windows

Supported on Linux

Supported on Mac

 UEFI mode

UEFI secure mode

Legacy

Rufus

https://rufus.ie/en_US/

Yes

No

No

 Yes

Yes

Yes

Balena Etcher

https://www.balena.io/etcher/

Yes

Yes

Yes

 Yes

Yes

No

  

*Keep in mind that is for M6 only and SW release 4.2(1) or later. 

 

A new version of the script is posted below (v3). This version adds additional support for UEFI boot on UCS Rack Servers.

 

About the Cisco Standalone C-Series Host Update Utility USB Image Utility:

This utility is designed to assist users who want to update firmware on their standalone C-Series server from a USB drive. Specific, this utility will write the HUU ISO image to a bootable USB stick. This USB stick can be used to update firmware on a standalone C-Series server either by changing the boot order or manually selecting the USB device in the <F6> boot menu.

 

Requirements: 
- HUU USB Image Utility
- Linux Server (Tested with RHEL 6.4 and CENTOS 6.4)
- The following package must be installed: syslinux-4.02-8.el6.x86_64 (or later)
- Standalone C-Series HUU Image (to be written)

 

Note: You may need to unmount the drive to properly execute the script. (umount <dev>)

 

Tool usage:

sh create_util_usb_v2.sh <UCSB Device> <file.iso>

OR
sh create_util_usb_v2.sh /dev/sdb ucs-c240-huu-2.0.3.16.iso

 

------------------------------------------------------------------------------------

Expected Output: (Note: This is expected output form the tool)

# ./create_util_usb_v2.sh /dev/sdb ucs-c240-huu-2.0.3d-1.iso

syslinux-nonlinux-4.04-3.el6.noarch

syslinux-4.04-3.el6.x86_64

/dev/loop0

ucs-c240-huu-2.0.3d-1.iso

/dev/loop0

 

## Creating partitions... Please wait (Will take a few minutes)

10+0 records in

10+0 records out

40960 bytes (41 kB) copied, 0.00440779 s, 9.3 MB/s

Zeroing of USB done.....

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x4e25a2d2.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

 

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').

 

 

Command (m for help): Command action

   e   extended

   p   primary partition (1-4)

Partition number (1-4): First cylinder (1-15272, default 1): Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-15272, default 15272):

Command (m for help): The partition table has been altered!

 

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').

 

 

Command (m for help): Partition number (1-4):

Command (m for help): The partition table has been altered!

 

 

Calling ioctl() to re-read partition table.

Syncing disks.

## Formating the partitions

mkdosfs 3.0.9 (31 Jan 2010)

0+1 records in

0+1 records out

440 bytes (440 B) copied, 0.00460309 s, 95.6 kB/s

/dev/loop0

`/tmp/HUU/C240M3-2.0.3d.zip' -> `/tmp/usb2.4196/./C240M3-2.0.3d.zip'

`/tmp/HUU/EFI' -> `/tmp/usb2.4196/./EFI'

`/tmp/HUU/EFI/BOOT' -> `/tmp/usb2.4196/./EFI/BOOT'

`/tmp/HUU/EFI/BOOT/BOOTX64.conf' -> `/tmp/usb2.4196/./EFI/BOOT/BOOTX64.conf'

`/tmp/HUU/EFI/BOOT/BOOTX64.efi' -> `/tmp/usb2.4196/./EFI/BOOT/BOOTX64.efi'

`/tmp/HUU/EFI/BOOT/grub.conf' -> `/tmp/usb2.4196/./EFI/BOOT/grub.conf'

`/tmp/HUU/EFI/BOOT/initrd0.img' -> `/tmp/usb2.4196/./EFI/BOOT/initrd0.img'

`/tmp/HUU/EFI/BOOT/isolinux.bin' -> `/tmp/usb2.4196/./EFI/BOOT/isolinux.bin'

`/tmp/HUU/EFI/BOOT/isolinux.cfg' -> `/tmp/usb2.4196/./EFI/BOOT/isolinux.cfg'

`/tmp/HUU/EFI/BOOT/splash.jpg' -> `/tmp/usb2.4196/./EFI/BOOT/splash.jpg'

`/tmp/HUU/EFI/BOOT/splash.xpm.gz' -> `/tmp/usb2.4196/./EFI/BOOT/splash.xpm.gz'

`/tmp/HUU/EFI/BOOT/vesamenu.c32' -> `/tmp/usb2.4196/./EFI/BOOT/vesamenu.c32'

`/tmp/HUU/EFI/BOOT/vmlinuz0' -> `/tmp/usb2.4196/./EFI/BOOT/vmlinuz0'

`/tmp/HUU/firmware.squashfs' -> `/tmp/usb2.4196/./firmware.squashfs'

`/tmp/HUU/isolinux' -> `/tmp/usb2.4196/./isolinux'

`/tmp/HUU/isolinux/boot.cat' -> `/tmp/usb2.4196/./isolinux/boot.cat'

`/tmp/HUU/isolinux/efiboot.img' -> `/tmp/usb2.4196/./isolinux/efiboot.img'

`/tmp/HUU/isolinux/initrd0.img' -> `/tmp/usb2.4196/./isolinux/initrd0.img'

`/tmp/HUU/isolinux/isolinux.bin' -> `/tmp/usb2.4196/./isolinux/isolinux.bin'

`/tmp/HUU/isolinux/isolinux.cfg' -> `/tmp/usb2.4196/./isolinux/isolinux.cfg'

`/tmp/HUU/isolinux/splash.jpg' -> `/tmp/usb2.4196/./isolinux/splash.jpg'

`/tmp/HUU/isolinux/vesamenu.c32' -> `/tmp/usb2.4196/./isolinux/vesamenu.c32'

`/tmp/HUU/isolinux/vmlinuz0' -> `/tmp/usb2.4196/./isolinux/vmlinuz0'

`/tmp/HUU/LiveOS' -> `/tmp/usb2.4196/./LiveOS'

`/tmp/HUU/LiveOS/osmin.img' -> `/tmp/usb2.4196/./LiveOS/osmin.img'

`/tmp/HUU/LiveOS/squashfs.img' -> `/tmp/usb2.4196/./LiveOS/squashfs.img'

`/tmp/HUU/Release-Notes-SL2.txt' -> `/tmp/usb2.4196/./Release-Notes-SL2.txt'

`/tmp/HUU/squashfs_img.md5' -> `/tmp/usb2.4196/./squashfs_img.md5'

`/tmp/HUU/TOC_SANLUIS2.xml' -> `/tmp/usb2.4196/./TOC_SANLUIS2.xml'

`/tmp/HUU/tools.squashfs' -> `/tmp/usb2.4196/./tools.squashfs'

`/tmp/HUU/VIC_FIRMWARE' -> `/tmp/usb2.4196/./VIC_FIRMWARE'

`/tmp/HUU/VIC_FIRMWARE/cruzboot.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/cruzboot.bin'

`/tmp/HUU/VIC_FIRMWARE/cruzfw.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/cruzfw.bin'

`/tmp/HUU/VIC_FIRMWARE/paloboot.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/paloboot.bin'

`/tmp/HUU/VIC_FIRMWARE/palofw.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/palofw.bin'

`/tmp/HUU/VIC_FIRMWARE/serenoboot.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/serenoboot.bin'

`/tmp/HUU/VIC_FIRMWARE/serenofw.bin' -> `/tmp/usb2.4196/./VIC_FIRMWARE/serenofw.bin'

 

 

Disk /dev/sdb: 16.0 GB, 16013852672 bytes

64 heads, 32 sectors/track, 15272 cylinders

Units = cylinders of 2048 * 512 = 1048576 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x4e25a2d2

 

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1        1025     1049584   83  Linux

#


Comments
Tristan G
Level 1
Level 1

Bump to this thread because this is one of the more disappointing things I've seen in tech.

 

We need to upgrade some servers (actually, Cisco WLCs - 8540s) due to a bug that causes them to lose access to the SD card... ok.

So after finally gaining access to CIMC, I can't use the network because a) Adobe Flash has been deprecated and disabled, and b) Java won't recognise the certificates anymore of the vKVM applet - even when I change the date.

Windows? macOS? Sure.  Linux? Now I have to download an ancient version of CentOS and try rebuilding the USB stick.

What causes this to fail using other methods?  Why does a Rufus copy not work?

Greg Wilkinson
Cisco Employee
Cisco Employee

Adobe Flash deprecation is a documented issue that Cisco has noted in the release notes as well as in a Field Notice that was sent out proactively to customers who are signed up for notifications.

 

Release notes:

https://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/release/notes/b_UCS_C-Series_Release_Notes_3_0_4.html

 

Field Notice:

https://www.cisco.com/c/en/us/support/docs/field-notices/720/fn72014.html

 

It is unfortunate that you are impacted by the end of life of Adobe Flash and we understand that many customers with legacy systems will be adversely impacted.

 

Is the API an option for FW upgrades?

Stefan B.
Level 1
Level 1

I agree that we all knew that Flash would be depreciated, however I think we can also agree that Cisco should not hide behind some obscure work arounds. Speaking of "It was known that Flash will be depreciated", it was also known by Cisco since at least v2.0 that there is a problem with creating USB sticks and it's still present in v3.0. We have multiple c220/240 M3 servers which are still in extended support until end of '21. Especially in a time where big companies get hacked, we shouldn't have to jump through hoops for a simple upgrade or configuration change to address security issues.

Greg Wilkinson
Cisco Employee
Cisco Employee
What are the specific issues you are having around creating the HUU USB?
Stefan B.
Level 1
Level 1

I'm using Rufus to create a bootable USB stick and receive the error from CSCup62091 when booting the server with it. 

CIMC is on 3.0(4o) and we're trying to upgrade all servers to 4r.

I found a work around using CentOS with a special script to create the USB drive, but that is not really an option for us.

 

USB error.jpg

I am not aware of a windows way to do it. Earlier in this thread I posted my modifications to the provided script that allowed it to work on Ubuntu. I have done that a couple times, and it worked correctly. I can't recall if the M4 HUU works directly with Rufus, but I am pretty sure that M5 HUU does. I remote mount HUU most of the time, so it isn't a problem I deal with frequently. I have had issues with KVM mounting HUU failing because of running out of memory. If that occurs, NFS mounting HUU from the CIMC has worked.

Stefan B.
Level 1
Level 1
Hi Elliot,



Thanks for your reply - I actually tried your script, but all we have is Debian and I didn't want to install a Ubutu VM just to create a simple USB stick.




jubaez7041
Level 1
Level 1

Hi

i hope you are doing well

can you help me, because i tried to run the script and i got stucked in this part:

i cleaned the usb drive and run the script and this is the last part of the script and when reached it

it got stucked, can you help me? i tried differents .ISO files like 3 and 4 version for de UCS CIMC ISO and i got the same result, could be the USB? because i use it for differents installation and works well

 

sed: can't read /tmp/usb2.3493/EFI/BOOT/grub.cfg: No such file or directory

 

 

Disk /dev/sdb: 15.7 GB, 15664676864 bytes, 30595072 sectors


wipefs --all /dev/sdb
/dev/sdb: 2 bytes were erased at offset 0x000001fe (dos): 55 aa
/dev/sdb: calling ioclt to re-read partition table: Success

./create_util_usb_huu_v3.sh /dev/sdb ucs-c220m4-huu-3.0.4r.iso

 

 

‘/tmp/SCU/VIC_FIRMWARE/cruzboot.bin’ -> ‘/tmp/usb2.3493/./VIC_FIRMWARE/cruzboot.bin’
‘/tmp/SCU/VIC_FIRMWARE/cruzfw.bin’ -> ‘/tmp/usb2.3493/./VIC_FIRMWARE/cruzfw.bin’
‘/tmp/SCU/VIC_FIRMWARE/serenoboot.bin’ -> ‘/tmp/usb2.3493/./VIC_FIRMWARE/serenoboot.bin’
‘/tmp/SCU/VIC_FIRMWARE/serenofw.bin’ -> ‘/tmp/usb2.3493/./VIC_FIRMWARE/serenofw.bin’
sed: can't read /tmp/usb2.3493/EFI/BOOT/grub.cfg: No such file or directory

Greg Wilkinson
Cisco Employee
Cisco Employee

Hi there - can you please try booting the USB? 

 

sed: can't read /tmp/usb2.3493/EFI/BOOT/grub.cfg: No such file or directory

 

EFI/BOOT/grub.cfg file does not exist in M3/M4 HUU ISO versions; it was added later to support M5 HUU versions. This error can be ignored for M3/M4. 

 

 

boonchiam
Level 1
Level 1

error on the scriptserror on the scriptsfirmware update donefirmware update done

i encountered the same issues as above

sed: can't read /tmp/usb2.3493/EFI/BOOT/grub.cfg: No such file or directory

however this was able to boot up and i managed to updated firmware and bios! thanks

for this i installed centos 7 minimal, then

sudo dhclient (it doesnt have any ip once clean installed of centos 7 on another machine)

yum install syslinux

sudo yum -y groups install "GNOME Desktop"
echo "exec gnome-session" >> ~/.xinitrc
sudo startx 

and also install the startx and use the script provided

finally get it done, almost want to buy an external optical drive and burn a dvd just for this easy firmware update

RUFUS will no work, tried million times frim windows 10 pro. Ubuntu also doesnt work on this script! yes i tried it as well

only things work is centos

Thanks

jubaez7041
Level 1
Level 1

Hi

thanks a lot grewilki for the advice, is odd but when the console hangs in sed, you have to wait until the files are copied i give more ram to the vm and took less time, thanks for your time, best regards

 

upgradecimc.jpg

 

‘/tmp/SCU/VIC_FIRMWARE/serenoboot.bin’ -> ‘/tmp/usb2.2367/./VIC_FIRMWARE/serenoboot.bin’
‘/tmp/SCU/VIC_FIRMWARE/serenofw.bin’ -> ‘/tmp/usb2.2367/./VIC_FIRMWARE/serenofw.bin’
sed: can't read /tmp/usb2.2367/EFI/BOOT/grub.cfg: No such file or directory

 

 

 

 

 

 

when you reach this you are up and running
##### copy_files Done ######

Disk /dev/sdb: 15.7 GB, 15664676864 bytes, 30595072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0xee68b975

Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 2099199 1048576 83 Linux

 

mnice
Level 1
Level 1

Hello All

 

I get an error message when I run the script. Does anyone have an idea about the problem?

 

Error:

...........

..............

WARNING: Re-reading the partition table failed with error 22: Invalid argument.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

Error: Partition creation failed.

 

Regards.

Greg Wilkinson
Cisco Employee
Cisco Employee

Do you have any additional details here? What device are you pointing to?

Paul Chapman
Level 4
Level 4

Hi All -

I've found the solution for Windows / Rufus users.  The problem is due to an incorrect disk ID.  Here is how to fix it.

1. Create bootable USB with Rufus (leave drive in system when complete)

2. Open a command prompt and get the FAT volume serial number by typing the following command (see screenshot):

dir <drive letter>:

DOS.png

 

 

 

 

3. In a text editor, open <drive letter>:\isolinux\isolinux.cfg

4. Replace "CDLABEL=<PARTIAL NAME>" with "UUID=<FAT Serial #>"

Before

Old.png

 

 

 

After

New.png

 

 

 

Tested on HUU 3.0(3a) and 4.1(2f) for C220 M3.

 

Happy Patching!

PSC

Paul Chapman
Level 4
Level 4

Hi All -

A fully functional Ubuntu version for your consideration.  (Tested on Ubuntu 20.04 Server and should work on Debian 10 and distros based on Debian).

 

#!/bin/bash
################################################################################
# Description  : Creates bootable USB from HUU ISO file
# Author       : Jeffery Foster (Cisco)
# Website      : https://community.cisco.com/t5/unified-computing-system/cisco-standalone-c-series-host-update-utility-usb-image-utility/ta-p/3638625
# 
# ## Version 4 - Debian 10 / Ubuntu Server 20.04 ##
# Acknolegement: Elliot Dierksen for providing equivalent 'apt' command and updated syslinux path.
#
# Author       : Paul Chapman (ConvergeOne)
#
# Changes      : Removed references to SCU. (Replaced with HUU for clarity.)
#              : Converted ISO test to function.
#              : Added more status messages
#              : Removed verbose file copy (-rvfp --> -rfp)
#              : New partition set to 0C (FAT32 Win95) instead of 83 (Linux) (Tightens similarity to Rufus process for Windows Users)
#              : Added '-W always' to fdisk to fix config error due to partition signature
#              : Removed unused variables / code for clarity
#              : Piped all command outputs to /dev/null (Not possible for fdisk)
#              : Added deletion warning prompt for users
#              : Added early drive validation with syntax hint (based on community feedback on original script)
#
# Validation   : Tested with HUU 3.x and 4.x on Ubuntu Server 20.04 VM (USB Host Media mounted via ESXi)
# Platforms    : UCS C220 M3 & M4, C240 M4
# 
# Syntax       : sh create_util_usb.sh <device> <huu iso> [debug]
# Example      : sh create_util_usb_v4.sh /dev/sdb ucs-cxxmx-huu-x.x.x.iso
################################################################################
echo 
echo "###### Cisco Host Update Utility (HUU) - Bootable USB Creator ######"
echo 

if [ $# -lt 2 ];then
    echo "## ERROR: Missing argurments"
    echo "syntax: sh create_util_usb.sh <device> <huu-iso-image>"
    echo "example:"
    echo "  sh create_util_usb_v4.sh /dev/sdb ucs-c220m4-huu-2.0.12.31.iso" 
    exit 1;
elif [ $# -eq 3 ]; then
    if [ "$3" == "debug" ]; then
        set -x
    fi
fi

USB_DEV=$1
HUU_ISO=$2
PART1_DEV=$USB_DEV"1"
USB_DIR=/tmp/usb2.$$
MBR=/usr/lib/syslinux/mbr/mbr.bin
TMP_HUU=/tmp/HUU

# Verify user has correctly specified a drive, not a partition (or ISO file)
TGT_MODEL=$(fdisk -l $USB_DEV | grep -i model)
if [ $? -ne 0 ]; then
    echo "## ERROR: Invalid Device: $USB_DEV"
    echo
    echo "HINT 1: Verify syntax: sh create_util_usb.sh <device> <huu-iso-image>" 
    echo "HINT 2: If your device name ends with a number, it is probably a partition not a drive (e.g. sdb1 vs sdb). Try without the number."
    exit 1;
fi

#Check for syslinux (Debian / Ubuntu - apt)
apt list --installed 2>/dev/null | grep syslinux\/ > /dev/null
if [ $? -ne 0 ]; then
    echo "ERROR:  syslinux not installed"
    exit 1;
fi

# Verify user wants to proceed with device wipe
echo "## WARNING: THIS SCRIPT WILL DESTROY ALL PARTITIONS AND DATA ON THE SPECIFIED DEVICE!"
echo "    Device: $USB_DEV"
echo "    $TGT_MODEL"
echo "Do you want to proceed (y/N)?"
read ans
ans=`echo $ans | tr [:upper:] [:lower:]`
if [ "$ans" = "y" ]; then
    echo "Proceeding..."
else
    exit 1;
fi

test_iso ()
{
    echo "## Validating ISO..."

    basename $HUU_ISO | grep -i "huu" > /dev/null
    if [ $? -ne 0 ]; then
        echo "## WARNING: The ISO file name doesn't look correct. Do you want to proceed (y/N)?"
        read ans
        ans=`echo $ans | tr [:upper:] [:lower:]`
        if [ "$ans" = "y" ]; then
            echo "Proceeding..."
        else
            exit 1;
        fi
    fi

    TMP_TEST_DIR=/tmp/huu_test.$$
    mkdir -p $TMP_TEST_DIR
    losetup -f > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: No free loop device found. "
        exit 1
    fi

    mount -o loop $HUU_ISO $TMP_TEST_DIR 2> /dev/null > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: Unable to mount HUU iso for validation. Check file name and path."
        rm -rf $TMP_TEST_DIR
        exit 1;
    fi
    umount $TMP_TEST_DIR

    echo " "

    rm -rf $TMP_TEST_DIR

    echo "    ## ISO Validation Complete..."
}

create_part ()
{
    echo "## Repartitioning Drive..."
    
    echo "    ## Destroying partition table....."
    umount $PART1_DEV 2> /dev/null > /dev/null
    dd if=/dev/zero of=$USB_DEV bs=4096 count=10 2> /dev/null > /dev/null
    echo "    ## Building 1G partition....."
    (
        echo n # Create new partition
        echo p # Primary partition
        echo 1 # Partition 1
        echo # First sector (Accept default)
        echo +1024M # Create 1GB partition
        echo t # Set partition type (default Linux)
        echo c # Select FAT32 (Win95)
        echo w # Write changes
    ) | fdisk -W always $USB_DEV
    
    if [ $? -ne 0 ]; then
        echo "ERROR: Partition creation failed."
        exit 1;
    fi
    
    echo "    ## Marking partition 1 Active (bootable)....."
    (
        echo a # Set partition Active (bootable)
        echo w # Write changes
    ) | fdisk $USB_DEV
    
    echo "    ## Drive Partitioning Complete..."
}

format_part () 
{
    echo "## Formatting Drive with FAT32..."
    mkdosfs -F 32 $PART1_DEV > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: Formatting of first USB partition failed"
        exit 1;
    fi
    echo "    ## Formating Complete..."
}


add_syslinux ()
{
    echo "## Loading syslinux..."
    echo "    ## Applying Master Boot Record..."
    dd if=$MBR of=$USB_DEV 2> /dev/null > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: dd of mbr.bin failed ";
        exit 1;
    fi

	# Pause to allow drive to settle
	sleep 2

    echo "    ## Installing Boot Loader..."
    syslinux $PART1_DEV 
    if [ $? -ne 0 ]; then
        echo "ERROR: syslinux failed [ $PART1_DEV ] Failed";
        exit 1;
    fi
    
    echo "    ## Loading syslinux Complete..."
}


copy_files ()
{
    echo "## Starting Copy Process..."
    echo "    ## Mounting USB Partition $PART1_DEV..."
    mkdir -p $USB_DIR
    mount $PART1_DEV $USB_DIR > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: Mounting of partition [ $PART1_DEV ] on Dir [ $USB_DIR ] Failed";
        rm -rf $USB_DIR
        exit 1;
    fi
    
    echo "    ## Checking for Free Loop Devices..."
    losetup -f > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: No Free loop device found. Exiting";
        umount $USB_DIR
        rm -rf $USB_DIR
        rm -rf $TMP_HUU
        exit 1;
        
    fi
    
    echo "    ## Mounting ISO File $HUU_ISO..."
    mkdir -p $TMP_HUU
    mount -o loop $HUU_ISO $TMP_HUU 2> /dev/null > /dev/null
    if [ $? -ne 0 ]; then
        echo "ERROR: Mounting of HUU ISO [ $HUU_ISO ] on Dir [ $TMP_HUU ] Failed";
        umount $USB_DIR
        rm -rf $USB_DIR
        rm -rf $TMP_HUU
        exit 1;
    fi

    echo "    ## Copying Files. Please wait... (3 to 10 minutes)"
    cp -rpf $TMP_HUU/* $USB_DIR/.
    if [ $? -ne 0 ]; then
        echo "ERROR: Copying of HUU Files to USB failedFailed";
        umount $USB_DIR
        rm -rf $USB_DIR
        rm -rf $TMP_HUU
        exit 1;
    fi
     
    echo "    ## Renaming isolinux Directory..."
    mv $USB_DIR/isolinux/ $USB_DIR/syslinux
    echo "    ## Renaming isolinux Config File..."
    mv $USB_DIR/syslinux/isolinux.cfg $USB_DIR/syslinux/syslinux.cfg

    echo "    ## Changing Media Labels in syslinux.cfg..."
    # Set the UUID of USB FAT Partition device as part of syslinux.cfg
    USB_UUID=`blkid $PART1_DEV | cut -d" " -f2 | sed 's/\"//g'`
    sed -ir "s/root=live:CDLABEL=.*-huu-[0-9]*/root=live:${USB_UUID}/g" $USB_DIR/syslinux/syslinux.cfg    
    
    echo "    ## Cleaning Up..."
    umount $TMP_HUU
    umount $USB_DIR
    rm -rf $TMP_HUU $USB_DIR    

    echo "    ## Copy Process Complete..."
}

test_iso
create_part
format_part
add_syslinux
copy_files 

echo
echo "## Bootable drive creation complete.  New Partition Information"
echo 
fdisk -l $USB_DEV

exit 0

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: