2 # --- T2-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # T2 SDE: misc/archive/iso2stick.sh
6 # Copyright (C) 2006 - 2020 The T2 SDE Project
8 # More information can be found in the files COPYING and README.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; version 2 of the License. A copy of the
13 # GNU General Public License can be found in the file COPYING.
14 # --- T2-COPYRIGHT-NOTE-END ---
19 echo "Usage iso2stick [ -fs file-system | -n ] iso-image usb-device [ files ]"
27 -fs) fs
="$2" ; shift ;;
35 if [ -z "$1" -o -z "$2" ]; then
42 # # create fresh image
43 # size=`du --block-size=1000000 $1 | cut -f 1`
44 # size=$(( size + 20 )) # just to be sure
46 # dd if=/dev/zero of=hd.img bs=1000000 count=$size
49 # losetup $loop hd.img
66 # losetup /dev/loop0 -o 512 hd.img
68 mkdir
-p /mnt
/{source,target
}
69 mount
${dev}1 /mnt
/target
70 mount
-o loop
$file /mnt
/source
72 rsync
-arvH --inplace --exclude TRANS.TBL
/mnt
/source
/ /mnt
/target
/
73 # copy additional content specified in arguments
75 cp -arv $x /mnt
/target
/
78 sed -i 's/(cd)/(hd0,0)/g' /mnt
/target
/boot
/grub
/menu.lst
83 echo -e "(hd0) $dev" > device.map
84 echo -e "root (hd0,0)\ninstall /boot/grub/stage1 (hd0) (hd0,0)/boot/grub/stage2 (hd0,0)/boot/grub/menu.lst\nquit" | grub
--batch --device-map=.
/device.map