s/PLATFORM/BOARD/

main
Geert Stappers 13 years ago committed by josch
parent 71a7420963
commit 1cce1c0d76

@ -79,14 +79,14 @@ and I have no intention to make it much more complex.
Polystrap is invoked as such:
./polystrap.sh PLATFORM
./polystrap.sh BOARD
PLATFORM is a directory that at least contains a multistrap.conf. The
BOARD is a directory that at least contains a multistrap.conf. The
multistrap.conf may contain variables from polystrap.sh.
In the normal case PLATFORM will contain some additional bits.
In the normal case BOARD will contain some additional bits.
PLATFORM/config - A file that is sourced by ./polystrap.sh and
BOARD/config - A file that is sourced by ./polystrap.sh and
contains variable declarations like:
SUITE - stable, testing, unstable
ARCH - armel, armhf, amd64, i386
@ -98,18 +98,18 @@ In the normal case PLATFORM will contain some additional bits.
Correct settings for ARCH and ROOTDIR are necessary
for proper operation, whereas other parameters are
only used if your multistrap.conf references them.
PLATFORM/debconfseed.txt - as the name suggests
PLATFORM/hooks - A directory that contains files that are sourced by
BOARD/debconfseed.txt - as the name suggests
BOARD/hooks - A directory that contains files that are sourced by
polystrap after packages are installed.
PLATFORM/packages - Contains files with one debian package per line.
BOARD/packages - Contains files with one debian package per line.
Grouping packages by that allows easier selection.
PLATFORM/root - Contains a rootfs tree that is copied to the target
BOARD/root - Contains a rootfs tree that is copied to the target
directory after packages are unpacked by multistrap.
Reasonable examples of how those pieces look like can be found in the defaults
directory.
Everything from the PLATFORM/config file can be overwritten by commandline
Everything from the BOARD/config file can be overwritten by commandline
options:
-s suite
@ -118,7 +118,7 @@ options:
-m mirror
Additionally the following option allows to specify a list of packages that is
then used instead of the contents of the PLATFORM/packages directory:
then used instead of the contents of the BOARD/packages directory:
-p packages
@ -126,16 +126,16 @@ How the script works:
*) re-execute itself in fakeroot
*) source default/config
*) source PLATFORM/config
*) determine package selection by PLATFORM/packages or commandline argument
*) create multistrap.conf in /tmp from PLATFORM/multistrap.conf
*) source BOARD/config
*) determine package selection by BOARD/packages or commandline argument
*) create multistrap.conf in /tmp from BOARD/multistrap.conf
*) run multistrap
*) copy contents of PLATFORM/root
*) copy contents of BOARD/root
*) copy qemu usermode binary
*) set debconf selections
*) run preinst scripts
*) configure packages
*) source PLATFORM/hooks
*) source BOARD/hooks
*) cleanup
*) generate tarball

@ -13,21 +13,21 @@ if [ "$#" -ne 1 ]; then
exit
fi
PLATFORM="$1"
BOARD="$1"
if [ -e "$PLATFORM" ]; then
if [ -e "$BOARD" ]; then
echo "target already exists"
exit
fi
mkdir -p $PLATFORM/
mkdir -p $PLATFORM/packages/
mkdir -p $PLATFORM/root/etc/network/
mkdir -p $PLATFORM/hooks/
mkdir -p $BOARD/
mkdir -p $BOARD/packages/
mkdir -p $BOARD/root/etc/network/
mkdir -p $BOARD/hooks/
cp default/config $PLATFORM
cp default/multistrap.conf $PLATFORM
cp default/debconfseed.txt $PLATFORM
cp default/config $BOARD
cp default/multistrap.conf $BOARD
cp default/debconfseed.txt $BOARD
for f in packages/base \
root/usr/sbin/policy-rc.d \
@ -43,16 +43,16 @@ for f in packages/base \
hooks/serial_tty \
hooks/firstboot \
hooks/empty_password; do
mkdir -p `dirname $PLATFORM/$f`
ln -s `dir_depth $f`default/$f $PLATFORM/$f
mkdir -p `dirname $BOARD/$f`
ln -s `dir_depth $f`default/$f $BOARD/$f
done
cat << __END__ > $PLATFORM/root/etc/hosts
cat << __END__ > $BOARD/root/etc/hosts
127.0.0.1 localhost
127.0.0.1 $PLATFORM
127.0.0.1 $BOARD
__END__
echo $PLATFORM > $PLATFORM/root/etc/hostname
echo $BOARD > $BOARD/root/etc/hostname
cp default/root/etc/fstab $PLATFORM/root/etc/
cp default/root/etc/network/interfaces $PLATFORM/root/etc/network/
cp default/root/etc/fstab $BOARD/root/etc/
cp default/root/etc/network/interfaces $BOARD/root/etc/network/

@ -54,16 +54,16 @@ shift $(($OPTIND - 1))
[ "$#" -ne 1 ] && { echo "too many positional arguments" >&2; usage; exit 1; }
PLATFORM="$1"
BOARD="$1"
[ ! -r "$PLATFORM" ] && { echo "cannot find target directory: $PLATFORM" >&2; exit 1; }
[ ! -r "$PLATFORM/multistrap.conf" ] && { echo "cannot read multistrap config: $PLATFORM/multistrap.conf" >&2; exit 1; }
[ ! -r "$BOARD" ] && { echo "cannot find target directory: $BOARD" >&2; exit 1; }
[ ! -r "$BOARD/multistrap.conf" ] && { echo "cannot read multistrap config: $BOARD/multistrap.conf" >&2; exit 1; }
# source default options
. "default/config"
# overwrite default options by target options
[ -r "$PLATFORM/config" ] && . "$PLATFORM/config"
[ -r "$BOARD/config" ] && . "$BOARD/config"
# overwrite target options by commandline options
SUITE=${_SUITE:-$SUITE}
@ -71,9 +71,9 @@ ARCH=${_ARCH:-$ARCH}
ROOTDIR=${_ROOTDIR:-$ROOTDIR}
MIRROR=${_MIRROR:-$MIRROR}
if [ "$_PACKAGES" = "" ] && [ -r "$PLATFORM/packages" ]; then
if [ "$_PACKAGES" = "" ] && [ -r "$BOARD/packages" ]; then
# if no packages were given by commandline, read from package files
for f in $PLATFORM/packages/*; do
for f in $BOARD/packages/*; do
while read line; do PACKAGES="$PACKAGES $line"; done < "$f"
done
else
@ -101,7 +101,7 @@ MULTISTRAPCONF=`tempfile -d . -p multistrap`
echo -n > "$MULTISTRAPCONF"
while read line; do
eval echo $line >> "$MULTISTRAPCONF"
done < $PLATFORM/multistrap.conf
done < $BOARD/multistrap.conf
# download and extract packages
echo "I: run multistrap" >&2
@ -116,15 +116,15 @@ mv $ROOTDIR/sbin/ldconfig $ROOTDIR/sbin/ldconfig.REAL
mv $ROOTDIR/usr/bin/ldd $ROOTDIR/usr/bin/ldd.REAL
# copy initial directory tree - dereference symlinks
echo "I: copy initial directory root tree $PLATFORM/root/ to $ROOTDIR/"
if [ -r "$PLATFORM/root" ]; then
cp --recursive --dereference $PLATFORM/root/* $ROOTDIR/
echo "I: copy initial directory root tree $BOARD/root/ to $ROOTDIR/"
if [ -r "$BOARD/root" ]; then
cp --recursive --dereference $BOARD/root/* $ROOTDIR/
fi
# preseed debconf
echo "I: preseed debconf"
if [ -r "$PLATFORM/debconfseed.txt" ]; then
cp "$PLATFORM/debconfseed.txt" $ROOTDIR/tmp/
if [ -r "$BOARD/debconfseed.txt" ]; then
cp "$BOARD/debconfseed.txt" $ROOTDIR/tmp/
fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
rm $ROOTDIR/tmp/debconfseed.txt
fi
@ -141,8 +141,8 @@ echo "I: configure packages"
fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a || fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a
# source hooks
if [ -r "$PLATFORM/hooks" ]; then
for f in $PLATFORM/hooks/*; do
if [ -r "$BOARD/hooks" ]; then
for f in $BOARD/hooks/*; do
echo "I: run hook $f"
. $f
done

Loading…
Cancel
Save