|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
# some fancy colors
|
|
|
|
if [ $(tty -s) ]; then
|
|
|
|
RED=$(tput setaf 1)
|
|
|
|
BRIGHT=$(tput bold)
|
|
|
|
NORMAL=$(tput sgr0)
|
|
|
|
else
|
|
|
|
RED=
|
|
|
|
BRIGHT=
|
|
|
|
NORMAL=
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$FLAVOR" ]; then
|
|
|
|
FLAVOR="gnome-live"
|
|
|
|
echo "Using default flavor: $FLAVOR"
|
|
|
|
else
|
|
|
|
echo "Using flavor: $FLAVOR"
|
|
|
|
fi
|
|
|
|
|
|
|
|
UI_TYPE=$(echo $FLAVOR | cut -f1 -d-)
|
|
|
|
IMAGE_TYPE=$(echo $FLAVOR | cut -f2 -d-)
|
|
|
|
|
|
|
|
CURRENT_DATE=$(date +%Y%m%d)
|
|
|
|
|
|
|
|
# repository URL
|
|
|
|
PUREOS_REPO="https://repo.puri.sm/pureos"
|
|
|
|
|
|
|
|
# current architecture
|
|
|
|
arch=$(dpkg --print-architecture)
|
|
|
|
|
|
|
|
# options
|
|
|
|
lb_opts=""
|
|
|
|
dist="green"
|
|
|
|
dist_version="8.0"
|
|
|
|
dist_reltag=""
|
|
|
|
|
|
|
|
VERSION_PRETTY=$dist_version
|
|
|
|
|
|
|
|
# live-build doesn't work if --parent-debian-distribution is unknown of
|
|
|
|
# debian-cd => we have to put a symlink so that it deals with Tanglu like jessie/sid
|
|
|
|
if [ ! -e "/usr/share/live/build/data/debian-cd/$dist" ]; then
|
|
|
|
if [ -w /usr/share/live/build/data/debian-cd ]; then
|
|
|
|
ln -sf sid "/usr/share/live/build/data/debian-cd/$dist"
|
|
|
|
else
|
|
|
|
echo "ERROR: Run this first:"
|
|
|
|
echo "ln -sf sid /usr/share/live/build/data/debian-cd/$dist"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create some directories which we will need later
|
|
|
|
mkdir -p config/package-lists
|
|
|
|
mkdir -p config/includes.chroot
|
|
|
|
|
|
|
|
lb_opts="$lb_opts --security false --updates false"
|
|
|
|
|
|
|
|
# FIXME: should be fixed in the live-build autodetection
|
|
|
|
case "$arch" in
|
|
|
|
amd64)
|
|
|
|
kernel_flavour="amd64"
|
|
|
|
;;
|
|
|
|
arm64)
|
|
|
|
kernel_flavour="arm64"
|
|
|
|
;;
|
|
|
|
i386)
|
|
|
|
kernel_flavour="686-pae"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "WARNING: configuration not tested on arch $arch" >&2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$IMAGE_TYPE" in
|
|
|
|
"live"|"LIVE")
|
|
|
|
|
|
|
|
case "$UI_TYPE" in
|
|
|
|
"gnome"|"GNOME")
|
|
|
|
FLAVOR=gnome-live
|
|
|
|
FLAVOR_PRETTY="GNOME Live"
|
|
|
|
# create package config for GNOME
|
|
|
|
cat > config/package-lists/desktop.list.chroot <<EOF
|
|
|
|
pureos-gnome
|
|
|
|
linux-image-$kernel_flavour
|
|
|
|
calamares
|
|
|
|
grub-pc
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
|
|
|
|
"plasma")
|
|
|
|
FLAVOR=plasma-live
|
|
|
|
FLAVOR_PRETTY="KDE Plasma Live"
|
|
|
|
# create package config for KDE Plasma
|
|
|
|
cat > config/package-lists/desktop.list.chroot <<EOF
|
|
|
|
pureos-plasma
|
|
|
|
linux-image-$kernel_flavour
|
|
|
|
calamares
|
|
|
|
grub-pc
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
rm -f config/hooks/normal/004-setup-oem.hook.chroot
|
|
|
|
rm -rf config/includes.chroot
|
|
|
|
|
|
|
|
rm -rf config/bootloaders/isolinux
|
|
|
|
cp -r config/bootloaders/isolinux.live/ config/bootloaders/isolinux
|
|
|
|
;;
|
|
|
|
|
|
|
|
"oem")
|
|
|
|
|
|
|
|
case "$UI_TYPE" in
|
|
|
|
"gnome"|"GNOME")
|
|
|
|
FLAVOR=gnome-oem
|
|
|
|
FLAVOR_PRETTY="GNOME OEM"
|
|
|
|
# create package config for GNOME (OEM)
|
|
|
|
cat > config/package-lists/desktop.list.chroot <<EOF
|
|
|
|
pureos-desktop
|
|
|
|
linux-image-$kernel_flavour
|
|
|
|
calamares-pureos-oem
|
|
|
|
grub-pc
|
|
|
|
EOF
|
|
|
|
;;
|
|
|
|
|
|
|
|
"plasma")
|
|
|
|
FLAVOR=plasma-oem
|
|
|
|
FLAVOR_PRETTY="KDE Plasma OEM"
|
|
|
|
|
|
|
|
echo "Can not create a OEM installer image for KDE Plasma at time."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
rm -f config/hooks/normal/004-setup-oem.hook.chroot
|
|
|
|
cp config/hooks.oem/004-setup-oem.hook.chroot config/hooks/normal/
|
|
|
|
|
|
|
|
rm -rf config/bootloaders/isolinux/
|
|
|
|
cp -r config/bootloaders/isolinux.oem config/bootloaders/isolinux
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# include the live tools
|
|
|
|
cat > config/package-lists/live.list.chroot <<EOF
|
|
|
|
casper
|
|
|
|
EOF
|
|
|
|
|
|
|
|
# Configure bootloader
|
|
|
|
sed -e s/@VERSION@/"$VERSION_PRETTY"/g config/bootloaders/splash.svg.in > config/bootloaders/splash.svg
|
|
|
|
mv -f config/bootloaders/splash.svg config/bootloaders/isolinux/
|
|
|
|
|
|
|
|
# Update GRUB EFI menu for our flavor
|
|
|
|
sed -e s/@FLAVOR@/"$FLAVOR"/g config/bootloaders/grub-efi.cfg.in > config/bootloaders/isolinux/grub-efi.cfg
|
|
|
|
|
|
|
|
IMAGE_FILENAME=pureos-${dist_version}-${FLAVOR}_${CURRENT_DATE}
|
|
|
|
|
|
|
|
lb config noauto \
|
|
|
|
--distribution "$dist" \
|
|
|
|
--mode pureos \
|
|
|
|
--binary-images iso-hybrid \
|
|
|
|
--archive-areas "main" \
|
|
|
|
--mirror-bootstrap $PUREOS_REPO \
|
|
|
|
--mirror-binary $PUREOS_REPO \
|
|
|
|
--mirror-debian-installer $PUREOS_REPO \
|
|
|
|
--parent-mirror-bootstrap $PUREOS_REPO \
|
|
|
|
--parent-mirror-binary $PUREOS_REPO \
|
|
|
|
--parent-mirror-debian-installer $PUREOS_REPO \
|
|
|
|
--apt-source-archives false \
|
|
|
|
--debian-installer false \
|
|
|
|
--win32-loader false \
|
|
|
|
--keyring-packages pureos-archive-keyring \
|
|
|
|
--bootloader syslinux \
|
|
|
|
--firmware-binary true \
|
|
|
|
--firmware-chroot true \
|
|
|
|
--initsystem systemd \
|
|
|
|
--initramfs casper \
|
|
|
|
--iso-application "PureOS GNU/Linux" \
|
|
|
|
--iso-publisher "Purism" \
|
|
|
|
--iso-volume "PureOS $dist_version $FLAVOR_PRETTY" \
|
|
|
|
--image-name $IMAGE_FILENAME \
|
|
|
|
--linux-flavours $kernel_flavour \
|
|
|
|
--debootstrap-options --keyring=/usr/share/keyrings/pureos-archive-keyring.gpg \
|
|
|
|
$lb_opts \
|
|
|
|
"${@}"
|