Compare commits

..

No commits in common. "master" and "t-rex" have entirely different histories.

14 changed files with 145 additions and 239 deletions

View file

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

180
build
View file

@ -1,180 +0,0 @@
#!/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 Executable file
View file

@ -0,0 +1,115 @@
#!/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"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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