#!/usr/bin/bash # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Script to install Belenix onto a Bootable LiveUSB # By Anil Gulecha # if [ $# != 1 ]; then echo "Usage: $0 " exit 1 fi img=$1 if [ ! -f $img ] && [ ! -c $img ]; then echo "Error: $img does not exist." exit 1 fi let i=0 #nawk script to o/p the details of plugged in USB drives rmformat 2>/dev/null | nawk 'BEGIN { FS = ":"; lnode=0; physdev=""; node = ""; devname = ""; bus = ""; size = 0; bustype = "USB"; } { if (lnode == 1 && match($1, "Logical Node")) { if (match(bus, bustype)) printf("%s\t%s\t%s\t%s\n", physdev, node, size, devname); node = $2; } else { if (match($1, "Logical Node")) { lnode = 1; node = $2; } else if (match($1, "Bus")) { bus=$2 } else if (match($1, "Connected Device")) { devname = $2; } else if (match($1, "Size")) { size = $2; } else if (match($1, "Physical Node")) { physdev=$2 } } } END { if (lnode == 1) { if (match(bus, bustype)) printf("%s\t%s\t%s\t%s\n", physdev, node, size, devname); } }' >/tmp/ulst while read p l s m d; do phys[$i]=$p log[$i]=$l size[$i]=$s mult[$i]=$m desc[$i]=$d let i=$i+1 done /dev/null < /dev/null umount $mnt rmdir $mnt echo "Completed copy to USB"