Compare commits

..

3 commits

Author SHA1 Message Date
edb12c7ef4 Add command line to choose build variant 2024-11-23 02:35:36 +04:00
d9f72f6ad9 Merge branch 't-rex' into 'master'
Update to 1.2.1

See merge request tile-os/iso-builder!2
2024-11-22 21:47:03 +00:00
78fa450c09 Build test ISO 2024-10-25 00:57:09 +04:00
14 changed files with 239 additions and 145 deletions

View file

@ -10,16 +10,14 @@ Clone this project & cd into it:
git clone https://gitlab.com/tile-os/iso-builder && cd iso-builder
Configure the channel in the etc/terraform.conf (`dev`, `stable`).
Configure desktop by export `DESKTOP` variable. May be a `river` or `sway`.
See `./build --help` for available options
Run the build for Sway:
Run the build for TileOS Sway stable edition:
docker run --privileged -i -v /proc:/proc \
-v ${PWD}:/working_dir \
-w /working_dir \
-e DESKTOP=sway \
debian:latest \
/bin/bash -s etc/terraform.conf < build.sh
./build --desktop sway --release stable
When done, your image will be in the `builds` folder.
When done, your image will be in the `builds/amd64` folder.

180
build Executable file
View file

@ -0,0 +1,180 @@
#!/usr/bin/env bash
set -e
# Where we are
BASE_DIR="$PWD"
# Build directory
TMP_DIR="$BASE_DIR/tmp"
# Output directory
BUILDS_DIR="$BASE_DIR/builds"
# Get config
CONFIG_FILE="etc/options"
source "$BASE_DIR"/"$CONFIG_FILE"
# TileOS edition
DESKTOP=
# Repo channel
CHANNEL=
# Release variant
RELEASE=
# Needs for lb config script
export DESKTOP CHANNEL
# check for root permissions
if [[ "$(id -u)" != 0 ]]; then
echo "E: Requires root permissions" > /dev/stderr
exit 1
fi
# List of available options
show_help() {
echo "Using: $0 [OPTIONS]"
echo
echo "Options:"
echo " --desktop <desktop_name> Desktop variant (sway, river, qtile)"
echo " --release <release_variant> Release variant (stable, beta, testing)"
echo " --help Shows this message"
echo
exit 0
}
while [[ $# -gt 0 ]]; do
case $1 in
--desktop)
DESKTOP="$2"
shift 2
;;
--release)
RELEASE="$2"
shift 2
;;
--help)
show_help
;;
*)
echo "Unknown option: $1"
show_help
;;
esac
done
case "$DESKTOP" in
sway|river|qtile)
;;
*)
echo "Error: Invalid value for --desktop!"
show_help
;;
esac
case "$RELEASE" in
stable|beta|testing)
;;
*)
echo "Error; Invalid value for --release!"
show_help
;;
esac
if [ "$RELEASE" == stable ]; then
CHANNEL="stable"
elif [ "$RELEASE" == beta ]; then
# Beta releases use stable repo channel
CHANNEL="stable"
elif [ "$RELEASE" == testing ]; then
CHANNEL="testing"
fi
# Check required dependencies (on Debian or Ubuntu)
check_deps() {
apt update -y && apt install -y lsb-release
dist="$(lsb_release -i -s)"
if [ "$dist" == "Debian" ]; then
apt install -y binutils patch zstd live-build
apt install -y ./debs/debian-keyring*.deb
else
apt install -y binutils patch zstd debootstrap
apt install -y ./debs/*.deb
fi
# Increase number of blocks for creating efi.img.
# This prevents error with "Disk full" on the lb binary_grub-efi stage
patch -f -d /usr/lib/live/build/ < increase_number_of_blocks.patch
}
# Cleanup build environment
cleanup() {
lb clean
rm -rf "$TMP_DIR"
}
# live-build ISO building
build() {
echo -e "
#------------------#
# START BUILD #
#------------------#
"
mkdir -p "$TMP_DIR/$ARCH"
cd "$TMP_DIR/$ARCH" || exit
# remove old configs and copy over new
rm -rf config auto
cp -r "$BASE_DIR"/etc/"$DESKTOP"/* .
# Make sure conffile specified as arg has correct name
cp -f "$BASE_DIR"/"$CONFIG_FILE" options
# Symlink chosen package lists to where live-build will find them
ln -s "package-lists.$PACKAGE_LISTS_SUFFIX" "config/package-lists"
# Configure build
lb config
# Start build
lb build
}
# Make the final ISO
make_iso() {
echo -e "
#---------------------------#
# MOVE OUTPUT TO BUILDS DIR #
#---------------------------#
"
YYYYMMDD="$(date +%Y%m%d%H%M)"
OUTPUT_DIR="$BUILDS_DIR/$ARCH"
mkdir -p "$OUTPUT_DIR"
if [ "$RELEASE" == testing ]; then
FNAME="tileos-$DESKTOP-$VERSION-$RELEASE-$YYYYMMDD-$OUTPUT_SUFFIX-$ARCH"
elif [ "$RELEASE" == beta ]; then
FNAME="tileos-$DESKTOP-$VERSION-$RELEASE-$OUTPUT_SUFFIX-$ARCH"
elif [ "$RELEASE" == stable ]; then
FNAME="tileos-$DESKTOP-$VERSION-$OUTPUT_SUFFIX-$ARCH"
fi
mv "$TMP_DIR/$ARCH/live-image-$ARCH.hybrid.iso" "$OUTPUT_DIR/${FNAME}.iso"
md5sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.md5.txt"
sha256sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.sha256.txt"
}
# remove old builds before creating new ones
rm -rf "$BUILDS_DIR"
check_deps
cleanup
build
make_iso
cleanup

115
build.sh
View file

@ -1,115 +0,0 @@
#!/bin/bash
set -e
# check for root permissions
if [[ "$(id -u)" != 0 ]]; then
echo "E: Requires root permissions" > /dev/stderr
exit 1
fi
# get config
if [ -n "$1" ]; then
CONFIG_FILE="$1"
else
CONFIG_FILE="etc/terraform.conf"
fi
BASE_DIR="$PWD"
TMP_DIR="$BASE_DIR/tmp"
BUILDS_DIR="$BASE_DIR/builds"
source "$BASE_DIR"/"$CONFIG_FILE"
echo -e "
#----------------------#
# INSTALL DEPENDENCIES #
#----------------------#
"
# Use system live-build if running on Debian
apt-get update && apt-get install -y lsb-release
dist="$(lsb_release -i -s)"
if [ "$dist" == "Debian" ]; then
apt-get install -y binutils patch zstd live-build
dpkg -i ./debs/debian-keyring*.deb
else
apt-get install -y binutils patch zstd debootstrap
dpkg -i ./debs/*.deb
fi
# Increase number of blocks for creating efi.img.
# This prevents error with "Disk full" on the lb binary_grub-efi stage
patch -f -d /usr/lib/live/build/ < increase_number_of_blocks.patch
build () {
BUILD_ARCH="$1"
if [ -d "$TMP_DIR" ]; then
rm -rf "$TMP_DIR"
mkdir -p "$TMP_DIR/$BUILD_ARCH"
else
mkdir -p "$TMP_DIR/$BUILD_ARCH"
fi
cd "$TMP_DIR/$BUILD_ARCH" || exit
# remove old configs and copy over new
rm -rf config auto
cp -r "$BASE_DIR"/etc/$DESKTOP/* .
# Make sure conffile specified as arg has correct name
cp -f "$BASE_DIR"/"$CONFIG_FILE" terraform.conf
# Symlink chosen package lists to where live-build will find them
ln -s "package-lists.$PACKAGE_LISTS_SUFFIX" "config/package-lists"
echo -e "
#------------------#
# LIVE-BUILD CLEAN #
#------------------#
"
lb clean
echo -e "
#-------------------#
# LIVE-BUILD CONFIG #
#-------------------#
"
lb config
echo -e "
#------------------#
# LIVE-BUILD BUILD #
#------------------#
"
lb build
echo -e "
#---------------------------#
# MOVE OUTPUT TO BUILDS DIR #
#---------------------------#
"
YYYYMMDD="$(date +%Y%m%d%H%M)"
OUTPUT_DIR="$BUILDS_DIR/$BUILD_ARCH"
mkdir -p "$OUTPUT_DIR"
if [ "$CHANNEL" == testing ]; then
FNAME="tileos-$DESKTOP-$VERSION-$CHANNEL-$YYYYMMDD-$OUTPUT_SUFFIX-$ARCH"
elif [ "$CHANNEL" == stable ] && [ "$BETA" == true ]; then
FNAME="tileos-$DESKTOP-$VERSION-beta-$OUTPUT_SUFFIX-$ARCH"
elif [ "$CHANNEL" == stable ] && [ "$BETA" == false ]; then
FNAME="tileos-$DESKTOP-$VERSION-$OUTPUT_SUFFIX-$ARCH"
else
echo -e "Error: invalid channel name!"
fi
mv "$TMP_DIR/$BUILD_ARCH/live-image-$BUILD_ARCH.hybrid.iso" "$OUTPUT_DIR/${FNAME}.iso"
md5sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.md5.txt"
sha256sum "$OUTPUT_DIR/${FNAME}.iso" > "$OUTPUT_DIR/${FNAME}.sha256.txt"
}
# remove old builds before creating new ones
rm -rf "$BUILDS_DIR"
build "$ARCH"

5
etc/miracle/auto/clean Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh
set -e
export LB_LINUX_FLAVOURS="none"
lb clean noauto "$@"

View file

@ -2,8 +2,10 @@
set -e
. ./terraform.conf
# Include common options
. ./options
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -15,8 +17,8 @@ lb config noauto \
--bootappend-live "boot=live username=tileos hostname=tileos quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--mirror-chroot-security "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \

View file

@ -13,19 +13,15 @@ CODENAME="t-rex"
# distribution version
VERSION="1.2.1"
# distribution channel
CHANNEL="stable"
#CHANNEL="testing"
# Beta build
BETA="false"
# distribution name
NAME="TileOS"
# mirror to fetch packages from
MIRROR_URL="http://deb.debian.org/debian/"
# debian-security mirror
MIRROR_SECURITY="http://deb.debian.org/debian-security/"
# suffix for generated .iso files
OUTPUT_SUFFIX="desktop"

5
etc/qtile/auto/clean Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh
set -e
export LB_LINUX_FLAVOURS="none"
lb clean noauto "$@"

View file

@ -2,8 +2,10 @@
set -e
. ./terraform.conf
# Include common options
. ./options
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -15,8 +17,8 @@ lb config noauto \
--bootappend-live "boot=live username=tileos hostname=tileos quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--mirror-chroot-security "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \

5
etc/river/auto/clean Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh
set -e
export LB_LINUX_FLAVOURS="none"
lb clean noauto "$@"

View file

@ -2,8 +2,10 @@
set -e
. ./terraform.conf
# Include common options
. ./options
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -15,11 +17,11 @@ lb config noauto \
--bootappend-live "boot=live username=tileos hostname=tileos quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--mirror-chroot-security "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages debian-keyring \
--keyring-packages "debian-keyring tileos-archive-keyring" \
--apt-options "--yes --option Acquire::Retries=5 --option Acquire::http::Timeout=100" \
--cache-packages false \
--checksums md5 \
@ -27,7 +29,7 @@ lb config noauto \
--binary-images iso-hybrid \
--iso-application "$NAME" \
--iso-volume "$NAME" \
--firmware-chroot true \
--firmware-chroot false \
--zsync false \
--security true \
--updates true \

5
etc/sway/auto/clean Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh
set -e
export LB_LINUX_FLAVOURS="none"
lb clean noauto "$@"

View file

@ -2,8 +2,10 @@
set -e
. ./terraform.conf
# Include common options
. ./options
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -15,8 +17,8 @@ lb config noauto \
--bootappend-live "boot=live username=tileos hostname=tileos quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--mirror-chroot-security "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \

5
etc/swayfx/auto/clean Executable file
View file

@ -0,0 +1,5 @@
#! /bin/sh
set -e
export LB_LINUX_FLAVOURS="none"
lb clean noauto "$@"

View file

@ -2,8 +2,10 @@
set -e
. ./terraform.conf
# Include common options
. ./options
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -15,8 +17,8 @@ lb config noauto \
--bootappend-live "boot=live username=tileos hostname=tileos quiet splash" \
--mirror-bootstrap "$MIRROR_URL" \
--parent-mirror-bootstrap "$MIRROR_URL" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--mirror-chroot-security "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \