s/PLATFORM/BOARD/
This commit is contained in:
parent
71a7420963
commit
1cce1c0d76
3 changed files with 45 additions and 45 deletions
30
README
30
README
|
@ -79,14 +79,14 @@ and I have no intention to make it much more complex.
|
||||||
|
|
||||||
Polystrap is invoked as such:
|
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.
|
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:
|
contains variable declarations like:
|
||||||
SUITE - stable, testing, unstable
|
SUITE - stable, testing, unstable
|
||||||
ARCH - armel, armhf, amd64, i386
|
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
|
Correct settings for ARCH and ROOTDIR are necessary
|
||||||
for proper operation, whereas other parameters are
|
for proper operation, whereas other parameters are
|
||||||
only used if your multistrap.conf references them.
|
only used if your multistrap.conf references them.
|
||||||
PLATFORM/debconfseed.txt - as the name suggests
|
BOARD/debconfseed.txt - as the name suggests
|
||||||
PLATFORM/hooks - A directory that contains files that are sourced by
|
BOARD/hooks - A directory that contains files that are sourced by
|
||||||
polystrap after packages are installed.
|
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.
|
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.
|
directory after packages are unpacked by multistrap.
|
||||||
|
|
||||||
Reasonable examples of how those pieces look like can be found in the defaults
|
Reasonable examples of how those pieces look like can be found in the defaults
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
Everything from the PLATFORM/config file can be overwritten by commandline
|
Everything from the BOARD/config file can be overwritten by commandline
|
||||||
options:
|
options:
|
||||||
|
|
||||||
-s suite
|
-s suite
|
||||||
|
@ -118,7 +118,7 @@ options:
|
||||||
-m mirror
|
-m mirror
|
||||||
|
|
||||||
Additionally the following option allows to specify a list of packages that is
|
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
|
-p packages
|
||||||
|
|
||||||
|
@ -126,16 +126,16 @@ How the script works:
|
||||||
|
|
||||||
*) re-execute itself in fakeroot
|
*) re-execute itself in fakeroot
|
||||||
*) source default/config
|
*) source default/config
|
||||||
*) source PLATFORM/config
|
*) source BOARD/config
|
||||||
*) determine package selection by PLATFORM/packages or commandline argument
|
*) determine package selection by BOARD/packages or commandline argument
|
||||||
*) create multistrap.conf in /tmp from PLATFORM/multistrap.conf
|
*) create multistrap.conf in /tmp from BOARD/multistrap.conf
|
||||||
*) run multistrap
|
*) run multistrap
|
||||||
*) copy contents of PLATFORM/root
|
*) copy contents of BOARD/root
|
||||||
*) copy qemu usermode binary
|
*) copy qemu usermode binary
|
||||||
*) set debconf selections
|
*) set debconf selections
|
||||||
*) run preinst scripts
|
*) run preinst scripts
|
||||||
*) configure packages
|
*) configure packages
|
||||||
*) source PLATFORM/hooks
|
*) source BOARD/hooks
|
||||||
*) cleanup
|
*) cleanup
|
||||||
*) generate tarball
|
*) generate tarball
|
||||||
|
|
||||||
|
|
32
newtarget.sh
32
newtarget.sh
|
@ -13,21 +13,21 @@ if [ "$#" -ne 1 ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PLATFORM="$1"
|
BOARD="$1"
|
||||||
|
|
||||||
if [ -e "$PLATFORM" ]; then
|
if [ -e "$BOARD" ]; then
|
||||||
echo "target already exists"
|
echo "target already exists"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $PLATFORM/
|
mkdir -p $BOARD/
|
||||||
mkdir -p $PLATFORM/packages/
|
mkdir -p $BOARD/packages/
|
||||||
mkdir -p $PLATFORM/root/etc/network/
|
mkdir -p $BOARD/root/etc/network/
|
||||||
mkdir -p $PLATFORM/hooks/
|
mkdir -p $BOARD/hooks/
|
||||||
|
|
||||||
cp default/config $PLATFORM
|
cp default/config $BOARD
|
||||||
cp default/multistrap.conf $PLATFORM
|
cp default/multistrap.conf $BOARD
|
||||||
cp default/debconfseed.txt $PLATFORM
|
cp default/debconfseed.txt $BOARD
|
||||||
|
|
||||||
for f in packages/base \
|
for f in packages/base \
|
||||||
root/usr/sbin/policy-rc.d \
|
root/usr/sbin/policy-rc.d \
|
||||||
|
@ -43,16 +43,16 @@ for f in packages/base \
|
||||||
hooks/serial_tty \
|
hooks/serial_tty \
|
||||||
hooks/firstboot \
|
hooks/firstboot \
|
||||||
hooks/empty_password; do
|
hooks/empty_password; do
|
||||||
mkdir -p `dirname $PLATFORM/$f`
|
mkdir -p `dirname $BOARD/$f`
|
||||||
ln -s `dir_depth $f`default/$f $PLATFORM/$f
|
ln -s `dir_depth $f`default/$f $BOARD/$f
|
||||||
done
|
done
|
||||||
|
|
||||||
cat << __END__ > $PLATFORM/root/etc/hosts
|
cat << __END__ > $BOARD/root/etc/hosts
|
||||||
127.0.0.1 localhost
|
127.0.0.1 localhost
|
||||||
127.0.0.1 $PLATFORM
|
127.0.0.1 $BOARD
|
||||||
__END__
|
__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/fstab $BOARD/root/etc/
|
||||||
cp default/root/etc/network/interfaces $PLATFORM/root/etc/network/
|
cp default/root/etc/network/interfaces $BOARD/root/etc/network/
|
||||||
|
|
28
polystrap.sh
28
polystrap.sh
|
@ -54,16 +54,16 @@ shift $(($OPTIND - 1))
|
||||||
|
|
||||||
[ "$#" -ne 1 ] && { echo "too many positional arguments" >&2; usage; exit 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 "$BOARD" ] && { echo "cannot find target directory: $BOARD" >&2; exit 1; }
|
||||||
[ ! -r "$PLATFORM/multistrap.conf" ] && { echo "cannot read multistrap config: $PLATFORM/multistrap.conf" >&2; exit 1; }
|
[ ! -r "$BOARD/multistrap.conf" ] && { echo "cannot read multistrap config: $BOARD/multistrap.conf" >&2; exit 1; }
|
||||||
|
|
||||||
# source default options
|
# source default options
|
||||||
. "default/config"
|
. "default/config"
|
||||||
|
|
||||||
# overwrite default options by target options
|
# overwrite default options by target options
|
||||||
[ -r "$PLATFORM/config" ] && . "$PLATFORM/config"
|
[ -r "$BOARD/config" ] && . "$BOARD/config"
|
||||||
|
|
||||||
# overwrite target options by commandline options
|
# overwrite target options by commandline options
|
||||||
SUITE=${_SUITE:-$SUITE}
|
SUITE=${_SUITE:-$SUITE}
|
||||||
|
@ -71,9 +71,9 @@ ARCH=${_ARCH:-$ARCH}
|
||||||
ROOTDIR=${_ROOTDIR:-$ROOTDIR}
|
ROOTDIR=${_ROOTDIR:-$ROOTDIR}
|
||||||
MIRROR=${_MIRROR:-$MIRROR}
|
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
|
# 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"
|
while read line; do PACKAGES="$PACKAGES $line"; done < "$f"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
|
@ -101,7 +101,7 @@ MULTISTRAPCONF=`tempfile -d . -p multistrap`
|
||||||
echo -n > "$MULTISTRAPCONF"
|
echo -n > "$MULTISTRAPCONF"
|
||||||
while read line; do
|
while read line; do
|
||||||
eval echo $line >> "$MULTISTRAPCONF"
|
eval echo $line >> "$MULTISTRAPCONF"
|
||||||
done < $PLATFORM/multistrap.conf
|
done < $BOARD/multistrap.conf
|
||||||
|
|
||||||
# download and extract packages
|
# download and extract packages
|
||||||
echo "I: run multistrap" >&2
|
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
|
mv $ROOTDIR/usr/bin/ldd $ROOTDIR/usr/bin/ldd.REAL
|
||||||
|
|
||||||
# copy initial directory tree - dereference symlinks
|
# copy initial directory tree - dereference symlinks
|
||||||
echo "I: copy initial directory root tree $PLATFORM/root/ to $ROOTDIR/"
|
echo "I: copy initial directory root tree $BOARD/root/ to $ROOTDIR/"
|
||||||
if [ -r "$PLATFORM/root" ]; then
|
if [ -r "$BOARD/root" ]; then
|
||||||
cp --recursive --dereference $PLATFORM/root/* $ROOTDIR/
|
cp --recursive --dereference $BOARD/root/* $ROOTDIR/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# preseed debconf
|
# preseed debconf
|
||||||
echo "I: preseed debconf"
|
echo "I: preseed debconf"
|
||||||
if [ -r "$PLATFORM/debconfseed.txt" ]; then
|
if [ -r "$BOARD/debconfseed.txt" ]; then
|
||||||
cp "$PLATFORM/debconfseed.txt" $ROOTDIR/tmp/
|
cp "$BOARD/debconfseed.txt" $ROOTDIR/tmp/
|
||||||
fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
|
fakechroot chroot $ROOTDIR debconf-set-selections /tmp/debconfseed.txt
|
||||||
rm $ROOTDIR/tmp/debconfseed.txt
|
rm $ROOTDIR/tmp/debconfseed.txt
|
||||||
fi
|
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
|
fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a || fakechroot chroot $ROOTDIR /usr/bin/dpkg --configure -a
|
||||||
|
|
||||||
# source hooks
|
# source hooks
|
||||||
if [ -r "$PLATFORM/hooks" ]; then
|
if [ -r "$BOARD/hooks" ]; then
|
||||||
for f in $PLATFORM/hooks/*; do
|
for f in $BOARD/hooks/*; do
|
||||||
echo "I: run hook $f"
|
echo "I: run hook $f"
|
||||||
. $f
|
. $f
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue