creation script adapted to use parabola release tarballs

This commit is contained in:
Andreas Grapentin 2018-02-02 06:50:58 +01:00
parent 5cf528fffe
commit 67c9dfd461
No known key found for this signature in database
GPG Key ID: 7171986E4B745536
4 changed files with 68 additions and 19 deletions

43
README

@ -2,18 +2,32 @@
parabola-arm-imagebuilder
=========================
image creation
--------------
this is a collection of scripts creating parabola arm images for use with qemu
with the original goal of building parabola arm packages on these machines.
Development focus has since shifted towards creating parabola-arm release
tarballs.
to create a new virtual machine, run
to create a new virtual machine image, run
$> sudo ./create.sh
optionally, to create a new virtual machine with a packaging environment, run:
$> DEVSETUP=1 sudo ./create.sh
by default, the creation script will perform a full bootstrap, installing an
archlinuxarm release tarball and migrating the installed system to parabola
in-place. This behaviour can be changed by setting the environment variable
NOBOOTSTRAP to 1:
the packaging environment setup script makes use of several files and packages
$> sudo NOBOOTSTRAP=1 ./create.sh
In this case, a parabola arm release tarball is used instead.
optionally, to create a new virtual machine with a packaging environment, set
the environment variable DEVSETUP to 1:
$> sudo DEVSETUP=1 ./create.sh
The packaging environment setup script makes use of several files and packages
present on already setup parabola development machines. if your setup is
different, you might have to modify src/stage3.sh accordingly.
@ -32,6 +46,9 @@ The scripts assume that the following programs are available and in $PATH:
The scripts also assume that you like vim :)
virtual machine start
---------------------
to open a shell into the created machine, run
$> ./start.sh [path to created image]
@ -53,3 +70,21 @@ configured for passwordless sudo for the parabola user and the package tree and
a build chroot are prepared. have fun. also check out the .bashrc of the
parabola user in the created virtual machine, for batch build integration based
on task-spooler.
tarball creation
----------------
to create a tarball from the created vm image, run
$> sudo ./make_tarball.sh [path to created image]
the tarball creation script assumes to operate on an image *without* packaging
environment setup and will not perform additional cleanup operations if used on
the wrong image. Things that are cleaned up are:
/root/.ssh
/etc/ssh/ssh_host_*
/etc/pacman.d/gnupg
/var/log/*
/var/cache/*
/lost+found

@ -30,6 +30,7 @@ die() { echo "$*" 1>&2 ; exit 1; }
export OUTFILE="${OUTFILE:-armv7h.img}"
export SIZE="${SIZE:-64G}"
export ARCHTARBALL="${ARCHTARBALL:-ArchLinuxARM-armv7-latest.tar.gz}"
export PARABOLATARBALL="${PARABOLATARBALL:-ParabolaARM-armv7-latest.tar.gz}"
export _builddir=build
mkdir -p "$_builddir"
@ -40,12 +41,18 @@ export _outfile="$_builddir/$(basename "$OUTFILE")"
# prepare the empty image
./src/stage0.sh
# FIXME: skip this step once parabola release images are available
# install a clean archlinuxarm in the empty image
./src/stage1.sh
if [ -z "${NOBOOTSTRAP:-}" ]; then
# install a clean archlinux-arm system in the empty image
wget -nc http://os.archlinuxarm.org/os/$ARCHTARBALL
TARBALL="$ARCHTARBALL" ./src/stage1.sh
# migrate the installed image to a clean parabola
./src/stage2.sh
# migrate the installed image to a clean parabola
./src/stage2.sh
else
# install a clean parabola-arm system in the empty image
# FIXME: add download link for released parabola tarballs here
TARBALL="$PARABOLATARBALL" ./src/stage1.sh
fi
# setup package development environment
[ -n "${DEVSETUP:-}" ] && ./src/stage3.sh

@ -27,7 +27,8 @@ die() { echo "$*" 1>&2 ; exit 1; }
_builddir=build
mkdir -p "$_builddir"
_imagefile=$1
_imagefile="$_builddir/$(basename "$1")"
cp $1 $_imagefile
_rootdir="$_builddir"/root-$$
_loopdev=$(sudo losetup -f --show "$_imagefile")
@ -38,20 +39,29 @@ function cleanup {
sudo umount ${_loopdev}p1
sudo umount ${_loopdev}p3
sudo losetup -d $_loopdev
rm -rf "$_rootdir"
rm -rf "$_rootdir" "$_imagefile"
}
trap cleanup ERR
# mount the image
mkdir -p "$_rootdir"
sudo mount -o ro ${_loopdev}p3 "$_rootdir"
sudo mount -o ro ${_loopdev}p1 "$_rootdir"/boot
sudo mount ${_loopdev}p3 "$_rootdir"
sudo mount ${_loopdev}p1 "$_rootdir"/boot
# clean the image
rm -fvr \
"$_rootdir"/root/.ssh \
"$_rootdir"/etc/ssh/ssh_host_* \
"$_rootdir"/etc/pacman.d/gnupg \
"$_rootdir"/var/log/* \
"$_rootdir"/var/cache/* \
"$_rootdir"/lost+found
# create the tarball
tar -czf ParabolaARM-armv7-$(date "+%Y-%m-%d").tar.gz -C "$_rootdir" .
# cleanup
sudo umount ${_loopdev}p1
sudo umount ${_loopdev}p3
sudo losetup -d $_loopdev
rm -rf "$_rootdir"
rm -rf "$_rootdir" "$_imagefile"

@ -37,9 +37,6 @@ function cleanup {
}
trap cleanup ERR
# fetch latest archlinuxarm tarball
wget -nc http://os.archlinuxarm.org/os/$ARCHTARBALL
# the following installation instructions are adapted from
# https://archlinuxarm.org/platforms/armv7/arm/versatile-express
@ -62,7 +59,7 @@ mkdir -p "$_bootdir"
mkdir -p "$_rootdir"
mount ${_loopdev}p1 "$_bootdir"
mount ${_loopdev}p3 "$_rootdir"
bsdtar -vxpf $ARCHTARBALL -C "$_rootdir"
bsdtar -vxpf $TARBALL -C "$_rootdir"
sync
# fill the boot partition and create fstab