Mercurial > hg > aboriginal
annotate more/control-in-chroot.sh @ 1229:313c702a0984
Remove toybox.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 24 Aug 2010 03:08:47 -0500 |
parents | 65d1e11679af |
children |
rev | line source |
---|---|
1213
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Combine a control image and a root-filesystem image into an $ARCH-specific |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # chroot containing native build control files in /mnt. |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 if [ $# -ne 2 ] |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 then |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 echo 'usage: ./control-in-chroot.sh $ARCH $CONTROL_IMAGE' >&2 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 exit 1 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 fi |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 # Zap old stuff (if any) |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 rm -rf build/root-filesystem-"$1" build/chroot-"$1" && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 # Make sure the root filesystem is there for this $ARCH |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 ./root-filesystem.sh "$1" && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 # Build control image. |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 mkdir -p build/host-temp && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 rm -rf build/host-temp/"$2".hdc && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 sources/native-builds/"$2".sh build/host-temp/"$2".hdc && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 # Combine the control image's files with the root filesystem and rename result. |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 rm -rf build/control-in-chroot-"$1" build/root-filesystem-"$1"/mnt && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 mv build/host-temp/"$2" build/root-filesystem-"$1"/mnt && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 mv build/root-filesystem-"$1" build/control-in-chroot-"$1" && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 # Tar it up |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 tar -cvj -f build/control-in-chroot-"$1".tar.bz2 -C build control-in-chroot-"$1" && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 # Output some usage hints |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 echo "export CPUS=1 HOST=$1 && cd /home && /mnt/init" && |
65d1e11679af
Script to wrap up a control image and arch root filesystem into a tarball runnable on a host.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 echo "sudo chroot build/control-in-chroot-"$1" /sbin/init.sh" |