1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
set -e
if [ "$#" -ne 2 ]; then
echo "Usage: $0 codename ui"
exit 1
fi
CODENAME=$1
UI=$2
# Create clean state
yes | pmbootstrap zap -p
git --git-dir="$HOME/.local/var/pmbootstrap/cache_git/pmaports/.git" pull
yes '' | pmbootstrap init
pmbootstrap update
# Init device
pmbootstrap config device "$CODENAME"
pmbootstrap config ui "$UI"
pmbootstrap config hostname "$CODENAME"
pmbootstrap config user demo
pmbootstrap config ssh_keys False
pmbootstrap config timezone UTC
# Build image
yes 'demo' | pmbootstrap install --no-fde
# Extract image
mkdir -p /tmp/exportimage
pmbootstrap export /tmp/exportimage
# Organize image
mkdir -p "$CODENAME"
STAMP=$(date +%Y-%m-%d)
cp /tmp/exportimage/"$CODENAME".img "$CODENAME"/$STAMP-$UI-rootfs.img
gzip "$CODENAME"/$STAMP-$UI-rootfs.img
if ls /tmp/exportimage/boot.img-* 1> /dev/null 2>&1; then
cp /tmp/exportimage/boot.img-* "$CODENAME"/$STAMP-boot.img
fi
rm -rf /tmp/exportimage