[Casper] Upgrading from Tiger to Leopard
Miles Leacy
miles.leacy at themacadmin.com
Wed Jan 14 14:00:59 PST 2009
Dan,
I've been dissecting your script, and I'm unable to get the part that
appears to retrieve a volume's UUID working properly.
If I execute
DEVID=`diskutil list | grep Macintosh\ HD| awk '{print $6}'`
echo $DEVID
I get the following output:
Gi
There is no such thing as "diskGi", so the next line in the script, so after
executing:
UUID=`diskutil info $DEVID | grep UUID | /usr/bin/awk {'print $2'}`
echo $UUID
I get the following output:
diskutil info
It appears that you're attempting to capture the disk identifier in $DEVID
(e.g., disk0) for the volume in question and then use that disk identifier
to retrieve the UUID by capturing the output of `diskutil info <disk
identifier>`. Regardless of whether we are able to correctly capture a disk
identifier, I think there's a problem. Since the UUID we're after is the
volume's UUID, we need to use the volume name in the `diskutil info` command
instead of the disk identifier.
Maybe I've misunderstood or poorly dissected the script, if that's the case,
please let me know.
In any event, the following two lines should capture the UUID of volume
"Macintosh HD" to $uuid:
uuid=`diskutil info "/Volumes/Macintosh HD"| grep UUID`
uuid=${uuid: -36}
----------
Miles A. Leacy IV
Certified System Administrator 10.4
Certified Technical Coordinator 10.5
Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com
On Tue, Jan 13, 2009 at 11:44 AM, Daniel Farnworth <
daniel.farnworth at thecreativepartnership.co.uk> wrote:
> Hi Thomas,
>
> Just to clarify, the reason that we wrote the script is that this
> will need to be run on each machine as it is imaged. When you
> partition a disk, the UUID that is assigned to each volume is
> completely unique; thus is you write the fstab in advance of the
> machines being partitioned, you are confined to using Labels as each
> machines disks/volumes will have globally unique UUIDs. This is why
> we run this as a pre-image script.
>
> Hope this helps
> Dan
>
> On 9 Jan 2009, at 15:46, Thomas Larkin wrote:
>
> > When we did our massive dual boot image over this last summer I was
> > looking at the /etc/fstab file to hide the windows partition from
> > the OS X side. I had so many problems getting fstab to work. It
> > would not work for me if I used volume name or the device mount
> > point, ie /dev/disk1s3/. It would work if I used UUID, but if you
> > mass duplicate that UUID to tons of machines I found that it
> > wouldn't work.
> >
> > What has been your experience using /etc/fstab in 10.5?
> >
> >
> > ___________________________
> > Thomas Larkin
> > TIS Department
> > KCKPS USD500
> > tlarki at kckps.org
> > blackberry: 913-449-7589
> > office: 913-627-0351
> >
> >
> >
> >
> >
> > >>> Daniel Farnworth
> > <daniel.farnworth at thecreativepartnership.co.uk> 01/09/09 7:15 AM >>>
> > He he, thought that'd be popular.
> >
> > The script is fairly poorly written (I'm not a Bash wiz) so any
> > improvements are welcome (please let me have any so I can improve
> > mine).
> >
> > We run it as a 'before' script during our imaging process and it
> > takes a look at the internal disks, tries to figure out which is the
> > system disk or otherwise the disk in the first bay (Mac Pros only I
> > think) and then partitions it up into various volumes that we want.
> > Our post-flight script then takes the names of these and builds an
> > fstab file which it writes down to /etc. It also moves our admin
> > user's ('lwsadmin' in the script) home directory to /var/homes. We
> > figured this may be wise just in case the data partition goes dead
> > for any reason. Our OS image is pre-confd with lwsadmin's home
> > pointing at the correct location, so you may want to excise this
> > section and rely on using root to login in bad circumstances.
> >
> > Oh, the post script also 'hides' some of the partitions (Restore,
> > Freespace etc) so they don't show on the desktop, check the resulting
> > fstab to see how this is done.
> >
> > Be careful using this, it is destructive. Usual disclaimers apply =)
> >
> > ### Pre-install Partition Script
> >
> > #!/bin/bash -v
> >
> > exec 2>&1
> >
> > function rawdisksize {
> > FLOAT=$1
> > INT1=${FLOAT/.*}
> > #if $(( INT1 % 10 )) then
> > while (( INT1 % 10 ))
> > do
> > let INT1++
> > done
> > #fi
> > echo "$INT1"
> > }
> >
> >
> > function partitionsizes {
> >
> > case $RAW_SIZE in
> >
> > 30)
> > INTHD_SIZE=15
> > HOMES_SIZE=10
> > SCRATCH_SIZE=3
> > RESTORE_SIZE=0
> > ;;
> >
> > 40)
> > INTHD_SIZE=20
> > HOMES_SIZE=10
> > SCRATCH_SIZE=5
> > RESTORE_SIZE=0
> > ;;
> >
> > 60)
> > INTHD_SIZE=30
> > HOMES_SIZE=10
> > SCRATCH_SIZE=10
> > RESTORE_SIZE=5
> > ;;
> >
> > 80)
> > INTHD_SIZE=40
> > HOMES_SIZE=10
> > SCRATCH_SIZE=10
> > RESTORE_SIZE=10
> > ;;
> >
> > 120)
> > INTHD_SIZE=60
> > HOMES_SIZE=20
> > SCRATCH_SIZE=10
> > RESTORE_SIZE=20
> > ;;
> >
> > 160)
> > INTHD_SIZE=80
> > HOMES_SIZE=25
> > SCRATCH_SIZE=10
> > RESTORE_SIZE=25
> > ;;
> >
> > 240)
> > INTHD_SIZE=160
> > HOMES_SIZE=25
> > SCRATCH_SIZE=10
> > RESTORE_SIZE=25
> > ;;
> >
> > *)
> > INTHD_SIZE=$(( ($RAW_SIZE / 100) * 66 ))
> > HOMES_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> > SCRATCH_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> > RESTORE_SIZE=$(( ($RAW_SIZE / 100) * 11 ))
> > ;;
> > esac
> >
> > }
> >
> >
> > # Define a function to define whether this is a 'Bay Capable' machine
> > #function bayedmachine {
> >
> > # This needs to be written fairly soon
> >
> > #}
> >
> >
> > if [ ! -e /Volumes/CP-IntHD-01/.cp-partition-done ]; then
> >
> > echo ${1}
> > TARGETDISK=`diskutil info ${1} | grep "Device Identifier:" | awk
> > '{ print $3 }' | cut -c 1-5`
> > echo ${TARGETDISK}
> >
> > # now to partition the disk
> > #
> >
> > if [ ! -z $TARGETDISK ]
> > then
> > TOTAL_SIZE=`diskutil info $TARGETDISK | grep "Total Size" | awk
> > '{ print $3 }'`
> > RAW_SIZE=$(rawdisksize $TOTAL_SIZE)
> > partitionsizes
> >
> > echo "Total size of $TARGETDISK: $TOTAL_SIZE GB"
> > echo "Raw size of $TARGETDISK: $RAW_SIZE GB"
> > echo "CP-IntHD-01 Size: $INTHD_SIZE GB"
> > echo "CP-Homes-01 Size: $HOMES_SIZE GB"
> > echo "CP-Scratch-NOT-BackedUp Size: $SCRATCH_SIZE GB"
> > echo "Restore Size: $RESTORE_SIZE GB"
> >
> >
> > # Check processor type so we partition in the right format
> >
> > sysinfo=`system_profiler`
> >
> > countPPC=`echo ${sysinfo} | grep -c PowerPC`
> > countIntel=`echo ${sysinfo} | grep -c Intel`
> >
> > if [ ${countPPC} -ge 1 -a ${countIntel} -eq 0 ]; then
> > echo "Got a PPC in here"
> > partition_scheme_type="APMFormat"
> >
> > elif [ ${countIntel} -ge 1 -a ${countPPC} -eq 0 ]; then
> > echo "Intel Inside"
> > partition_scheme_type="GPTFormat"
> >
> > else
> > echo "Can't work out what kinda proc, it either ain't got one or
> > could be a Cray?"
> > exit 1
> >
> > fi
> >
> >
> > # Set the partition going
> >
> > if [ $RESTORE_SIZE -gt 0 ]; then
> >
> > diskutil partitionDisk $TARGETDISK 4 $partition_scheme_type \
> > "Journaled HFS+" CP-IntHD-01 "$INTHD_SIZE"G \
> > "Journaled HFS+" CP-Homes-01 "$HOMES_SIZE"G \
> > "Journaled HFS+" CP-Scratch-NOT-BackedUp "$SCRATCH_SIZE"G \
> > "Journaled HFS+" Restore "$RESTORE_SIZE"G
> >
> > else
> >
> > diskutil partitionDisk $TARGETDISK 3 $partition_scheme_type \
> > "Journaled HFS+" CP-IntHD-01 "$INTHD_SIZE"G \
> > "Journaled HFS+" CP-Homes-01 "$HOMES_SIZE"G \
> > "Journaled HFS+" CP-Scratch-NOT-BackedUp "$SCRATCH_SIZE"G
> >
> > fi
> >
> >
> > chown root:admin /Volumes/CP-Homes-01
> > chown root:admin /Volumes/CP-Scratch-NOT-BackedUp
> > chown root:admin /Volumes/Restore
> > chown root:admin /Volumes/Free-Space
> >
> > chmod g+w /Volumes/CP-Homes-01
> > chmod g+w /Volumes/CP-Scratch-NOT-BackedUp
> > chmod g+w /Volumes/Restore
> > chmod g+w /Volumes/Free-Space
> >
> > touch /Volumes/CP-IntHD-01/.cp-partition-done
> >
> > else
> >
> > echo "Problem acquiring target disk, exiting";
> > exit 1
> >
> > fi
> >
> > else
> >
> > echo "The partition scheme has already been created. Exiting"
> > exit 0
> >
> > fi
> >
> > exit 0
> >
> >
> > ### Post Install Script
> >
> > #!/bin/bash -v
> >
> > # Redirect STDERR to STDOUT
> > exec 2>&1
> >
> > VOLSDIR="/Volumes/"
> >
> > ROOTVOL="CP-IntHD-01"
> > HOMESVOL="CP-Homes-01"
> >
> > ROOTPATH="${VOLSDIR}${ROOTVOL}"
> > HOMESPATH="${VOLSDIR}${HOMESVOL}"
> >
> >
> >
> >
> > if [ -e "${1}/.cp-partition-done" ]; then
> >
> > # Ditto the contents of $ROOTPART/Users/Shared to their new location
> >
> > ditto -v "${1}/Users/Shared" "${HOMESPATH}/Shared"
> > if (( ! $? )); then
> >
> > # Remove the old copy of $ROOTPART/Users/Shared
> > echo "Done dittoing..."
> > rm -vR "${1}/Users/Shared" || { echo "rm /Users/Shared failed" ; }
> > rm -v "${1}/Users/.DS_Store" || { echo "rm /Users/.DS_Store
> > failed" ; }
> > rm -v "${1}/Users/.localized" || { echo "rm /Users/.localized
> > failed" ; }
> >
> > if [ -e "${1}/var/homes/lwsadmin" ]; then
> > rm -vR "${1}/Users/lwsadmin" || { echo "rm /Users/lwsadmin
> > failed" ; }
> > fi
> >
> > DEVID=`diskutil list | grep $HOMESVOL | awk '{print $6}'`
> > UUID=`diskutil info $DEVID | grep UUID | /usr/bin/awk {'print $2'}`
> > echo "# Remap the $HOMESPATH to /Users" >> $1/etc/fstab || { echo
> > "'fstab' Stage 1 failed: $HOMESPATH" ; exit 1 ; }
> > echo -e "UUID=${UUID}\t/Users\thfs\trw,nobrowse\t1\t1\n" >> $1/etc/
> > fstab || { echo "'fstab' Stage 2 failed: $HOMESPATH" ; exit 1 ; }
> >
> > HIDDEN_VOLS=(Restore Free-Space)
> >
> > for volume in "${HIDDEN_VOLS[@]}"; do
> >
> > DEVID=`diskutil list | grep $volume | awk '{print $6}'`
> > UUID=`diskutil info $DEVID | grep UUID | /usr/bin/awk {'print $2'}`
> >
> > echo "# Set the volume $volume to not mount at startup" >> $1/etc/
> > fstab || { echo "'fstab' Stage 3 ($volume) failed: $volume" ; exit
> > 1 ; }
> > echo -e "UUID=${UUID}\tnone\thfs\trw,noauto\t1\t1\n" >> $1/etc/
> > fstab || { echo "'fstab' Stage 4 ($volume) failed: $UUID" ; exit 1 ; }
> >
> > done
> >
> > fi
> >
> > touch "${1}/.cp-user-migration-done" || { echo "Task completion file
> > could not be created" ; exit 1 ; }
> >
> > exit 0
> >
> > else
> > # Log the error
> > echo "Could not find partition completion file. It would be wise not
> > to continue"
> > # Exit with above 0 status
> > exit 1
> >
> > fi
> >
> >
> >
> >
> >
> >
> > On 9 Jan 2009, at 12:44, Damien Weiss wrote:
> >
> > >
> > > YES!!!!! PLEASE!!!! Send that script on. That's something that I
> > > would implement almost immediately.
> > >
> > > Thanks!
> > > Damien
> > >
> > > On Jan 9, 2009, at 7:19 AM, Daniel Farnworth wrote:
> > >
> > >> I have a pre-
> > >> install script that we use to do this for us if anyone is
> > interested.
> > >>
> > >> Cheers
> > >> Dan
> > >
> >
> > --
> > Daniel Farnworth
> > IT Manager
> > The Creative Partnership
> > daniel.farnworth at thecreativepartnership.co.uk
> >
> > http://www.thecreativepartnership.co.uk
> > Tel: +44 (0)20 7439 7762
> > Fax: +44 (0)20 7437 1467
> >
> > PGP Public Key available
> >
> >
> >
> >
> >
> >
> > The information contained in this communication is intended solely
> > for the use of the individual or entity to whom it is addressed and
> > others authorised to receive it. It may contain confidential or
> > legally privileged information. If you are not the intended
> > recipient you are hereby notified that any disclosure, copying,
> > distribution or taking any action in reliance on the contents of
> > this information is strictly prohibited and may be unlawful. If you
> > have received this communication in error, please notify
> > postmaster at thecreativepartnership.co.uk immediately and then delete
> > this email from your system. Any views or opinions presented in
> > this email are solely those of the author and do not necessarily
> > represent those of The Creative Partnership. The Creative
> > Partnership has taken every reasonable precaution to ensure that
> > any attachment to this e-mail has been swept for viruses. However,
> > The Creative Partnership cannot accept liability for any damage
> > sustained as a result of s
> > oftware viruses and would advise that you carry out your own virus
> > checks before opening any attachment.
> >
> > _______________________________________________
> > Casper mailing list
> > Casper at list.jamfsoftware.com
> > http://list.jamfsoftware.com/mailman/listinfo/casper
>
> --
> Daniel Farnworth
> IT Manager
> The Creative Partnership
> daniel.farnworth at thecreativepartnership.co.uk
>
> http://www.thecreativepartnership.co.uk
> Tel: +44 (0)20 7439 7762
> Fax: +44 (0)20 7437 1467
>
> PGP Public Key available
>
>
>
>
>
>
> The information contained in this communication is intended solely for the
> use of the individual or entity to whom it is addressed and others
> authorised to receive it. It may contain confidential or legally privileged
> information. If you are not the intended recipient you are hereby notified
> that any disclosure, copying, distribution or taking any action in reliance
> on the contents of this information is strictly prohibited and may be
> unlawful. If you have received this communication in error, please notify
> postmaster at thecreativepartnership.co.uk immediately and then delete this
> email from your system. Any views or opinions presented in this email are
> solely those of the author and do not necessarily represent those of The
> Creative Partnership. The Creative Partnership has taken every reasonable
> precaution to ensure that any attachment to this e-mail has been swept for
> viruses. However, The Creative Partnership cannot accept liability for any
> damage sustained as a result of software viruses and would advise that you
> carry out your own virus checks before opening any attachment.
>
> _______________________________________________
> Casper mailing list
> Casper at list.jamfsoftware.com
> http://list.jamfsoftware.com/mailman/listinfo/casper
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090114/f9539cd4/attachment.htm
More information about the Casper
mailing list