comparison more/chroot-splice.sh @ 1529:90da269bc09c

Minor cleanup and remove hardlinking for chroot-splice: it's slower and uses more disk space but doesn't damage external copy if something goes wrong.
author Rob Landley <rob@landley.net>
date Sun, 10 Jun 2012 20:34:04 -0500
parents bb26de4dfe47
children 866adfa9c63c
comparison
equal deleted inserted replaced
1528:112e6fcbfce4 1529:90da269bc09c
26 exit 1 26 exit 1
27 fi 27 fi
28 28
29 # Zap old stuff (if any) 29 # Zap old stuff (if any)
30 30
31 CHROOT="build/chroot-$1" 31 [ -z "$CHROOT" ] && CHROOT="build/chroot-$1"
32 trap 'more/zapchroot.sh "$CHROOT"' EXIT 32 trap 'more/zapchroot.sh "$CHROOT"' EXIT
33 if [ -e "$CHROOT" ] 33 if [ -e "$CHROOT" ]
34 then 34 then
35 more/zapchroot.sh "$CHROOT" || exit 1 35 more/zapchroot.sh "$CHROOT" || exit 1
36 else
37 # Copy root filesystem and splice in control image
38 cp -la "build/root-filesystem-$1" "$CHROOT" || exit 1
39 fi 36 fi
40 37
41 # Copy root filesystem and splice in control image 38 # Copy root filesystem and splice in control image
42 cp -la "build/root-filesystem-$1" "$CHROOT" || exit 1 39 cp -a "build/root-filesystem-$1" "$CHROOT" || exit 1
43 40
44 if [ -d "$2" ] 41 if [ -d "$2" ]
45 then 42 then
46 rm -rf "$CHROOT/mnt" && cp -la "$2" "$CHROOT/mnt" || exit 1 43 rm -rf "$CHROOT/mnt" && cp -a "$2" "$CHROOT/mnt" || exit 1
47 else 44 else
48 mount -o loop "$2" "$CHROOT/mnt" || exit 1 45 mount -o loop "$2" "$CHROOT/mnt" || exit 1
49 fi 46 fi
50 47
51 # Tar it up
52
53 # Output some usage hints 48 # Output some usage hints
54 49
55 CPUS=1 HOST="$1" chroot "$CHROOT" /sbin/init.sh 50 CPUS=1 HOST="$1" chroot "$CHROOT" /sbin/init.sh