3 preimage="$1" ;# original guest
4 newimage="$2" ;# new guest
5 root="$3" ;# root filesystem
6 nameserver="$4" ;# new nameserver
7 hostname="$5" ;# new hostname
9 dd if="$preimage" of="$newimage" bs=1M
11 guestfish -a "$newimage" -m "$root" <<EOF
12 write /etc/resolv.conf "nameserver $nameserver"
13 write /etc/HOSTNAME "$hostname"