Mercurial > hg > aboriginal
annotate more/chroot-splice.sh @ 1432:ee0e4f2f4bdb
Fiddle with the downloads/binaries layout yet again, and update README for it.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 23 Aug 2011 08:21:48 -0500 |
parents | aabc07905de3 |
children | bb26de4dfe47 |
rev | line source |
---|---|
1284
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Combine a root filesystem directory and a control image into an $ARCH-specific |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # chroot containing native build control files, suitable for chrooting into. |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 if [ $# -ne 2 ] |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 then |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 echo 'usage: ./control-in-chroot.sh $ARCH $CONTROL_IMAGE' >&2 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 exit 1 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 fi |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 # Make sure prerequisites exist |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 |
1417
aabc07905de3
Now that the control-images have their own repository, remove them from this one.
Rob Landley <rob@landley.net>
parents:
1284
diff
changeset
|
14 for i in "build/root-filesystem-$1" "$2" |
1284
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 do |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 if [ ! -d "$i" ] |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 then |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 echo "No $i" >&2 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 exit 1 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 fi |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 done |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 # Zap old stuff (if any) |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 if [ -e "build/chroot-$1-$2" ] |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 then |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 more/zapchroot.sh "build/chroot-$1-$2" && |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 rm -rf "build/chroot-$1-$2" || |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 exit 1 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 fi |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 # Copy root filesystem and splice in control image |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 cp -la "build/root-filesystem-$1" "build/chroot-$1-$2" && |
1417
aabc07905de3
Now that the control-images have their own repository, remove them from this one.
Rob Landley <rob@landley.net>
parents:
1284
diff
changeset
|
34 cp -la "$2/." "build/chroot-$1-$2/mnt/." || |
1284
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 exit 1 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 # Tar it up |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 # Output some usage hints |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
40 |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 echo "export CPUS=1 HOST=$1 && cd /home && /mnt/init" && |
095c9652525e
Second try at a chroot-splice script, combining a root-filesystem and a control image into a chroot directory. (Useful for working out new control images.)
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
42 echo "sudo chroot build/chroot-$1-$2" "/sbin/init.sh" |