Sponsored Content
Full Discussion: os x hdiutil expert needed
Top Forums UNIX for Advanced & Expert Users os x hdiutil expert needed Post 302626023 by nextyoyoma on Wednesday 18th of April 2012 05:20:24 PM
Old 04-18-2012
This first part of the script is supposed to get the total size of the disk image when mounted:

Code:
os=0
for i in ${DMGLIST[@]} #This array contains a list of .dmg files
do
    DMGSIZES[pos]=$(hdiutil imageinfo -plist $i | awk -F"[<>]" 'a{print $3; exit}$2=="key"&&$3=="Total Bytes"{a=1}')
	let pos++
done
unset pos
echo;echo

This part of the script restores images to their corresponding partitions. The size of the partitions is based on the total size of the mounted disk image.

Code:
a=0

for i in ${DMGLIST[@]}
	do

	echo "Reimaging the "${DMGLISTshort[a]}" Partition..."

	asr --source "$i" --target /Volumes/"${DMGLISTshort[a]}" --erase --noverify --noprompt --disableOwners
	sleep 2

	let a++

 

6 More Discussions You Might Find Interesting

1. Solaris

expert vi commands

:) Hi UNIX friends, Where do I get advanced vi commands to practice. Please Help Me. Love (4 Replies)
Discussion started by: Love
4 Replies

2. UNIX for Advanced & Expert Users

Expert Opinion

This perhaps does not belong in ths category; apologies, however, we have a heated debate going and your input will decide the result. Should UNIX (HP, AIX, etc) be rebooted following a monthly cycle (Every month, or a qtr, etc.). We have some UX admins (grumps) who say they have seen a UX... (6 Replies)
Discussion started by: rsheikh
6 Replies

3. Shell Programming and Scripting

Expert cp command

How can I use the cp command to copy every file that I can find inside several folders cp -R *test* folder Supose there is ./122342343teste122343.txt ./bound/123teste1223453.txt ./feed/123teste1223453.txt and i want the files 122342343teste122343.txt, bound/123teste1223453.txt... (12 Replies)
Discussion started by: lipe.82
12 Replies

4. Solaris

Becoming a Solaris expert?

Hello everyone, how do you really study to become an expert in solaris OS? Thanks (3 Replies)
Discussion started by: cjashu
3 Replies

5. Shell Programming and Scripting

Parse hdiutil -plist data for specific info

I am trying to get the mounted size of a compressed .dmg. I can use hdiutil imageinfo -plist $imagename to get a lot of info, including what I need. The problem is that I have no idea how to parse that single piece of info into a variable (or in this case, array element). Here is what I have so... (2 Replies)
Discussion started by: nextyoyoma
2 Replies

6. Shell Programming and Scripting

Optimizing the Shell Script [Expert Advise Needed]

I have prepared a shell script to find the duplicates based on the part of filename and retain latest. #!/bin/bash if ; then mkdir -p dup fi NOW=$(date +"%F-%H:%M:%S") LOGFILE="purge_duplicate_log-$NOW.log" LOGTIME=`date "+%Y-%m-%d %H:%M:%S"` echo... (6 Replies)
Discussion started by: gold2k8
6 Replies
virt-list-partitions(1) 				      Virtualization Support					   virt-list-partitions(1)

NAME
virt-list-partitions - List partitions in a virtual machine or disk image SYNOPSIS
virt-list-partitions [--options] domname virt-list-partitions [--options] disk.img [disk.img ...] OBSOLETE
This tool is obsolete. Use virt-filesystems(1) as a more flexible replacement. DESCRIPTION
"virt-list-partitions" is a command line tool to list the partitions that are contained in a virtual machine or disk image. It is mainly useful as a first step to using virt-resize(1). "virt-list-partitions" is just a simple wrapper around libguestfs(3) functionality. For more complex cases you should look at the guestfish(1) tool. OPTIONS
--help Display brief help. --version Display version number and exit. -c URI --connect URI If using libvirt, connect to the given URI. If omitted, then we connect to the default libvirt hypervisor. If you specify guest block devices directly, then libvirt is not used at all. --format raw Specify the format of disk images given on the command line. If this is omitted then the format is autodetected from the content of the disk image. If disk images are requested from libvirt, then this program asks libvirt for this information. In this case, the value of the format parameter is ignored. If working with untrusted raw-format guest disk images, you should ensure the format is always specified. -h --human-readable Show sizes in human-readable form (eg. "1G"). -l --long With this option, "virt-list-partitions" displays the type and size of each partition too (where "type" means "ext3", "pv" etc.) -t --total Display the total size of each block device (as a separate row or rows). SHELL QUOTING
Libvirt guest names can contain arbitrary characters, some of which have meaning to the shell such as "#" and space. You may need to quote or escape these characters on the command line. See the shell manual page sh(1) for details. SEE ALSO
guestfs(3), guestfish(1), virt-filesystems(1), virt-list-filesystems(1), virt-resize(1), Sys::Guestfs(3), Sys::Guestfs::Lib(3), Sys::Virt(3), <http://libguestfs.org/>. AUTHOR
Richard W.M. Jones <http://people.redhat.com/~rjones/> COPYRIGHT
Copyright (C) 2009-2012 Red Hat Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. libguestfs-1.18.1 2013-12-07 virt-list-partitions(1)
All times are GMT -4. The time now is 06:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy