Compare commits

..

1 commit
ci ... t-rex

Author SHA1 Message Date
a01816fec3 Bump version to 1.3 2025-05-24 15:36:09 +04:00
22 changed files with 147 additions and 362 deletions

View file

@ -1,22 +0,0 @@
name: TileOS Sway ISO Builder
on: [workflow_call]
jobs:
build:
runs-on: [iso-builder]
container:
image: catthehacker/ubuntu:act-22.04
options: --privileged
steps:
-
name: Build image with sway
run: |
eval $(ssh-agent -s)
echo "${{ secrets.STORAGE_SSH_KEY }}" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
rm -rf ${PWD}/output/*
mkdir ${PWD}/output
docker run --privileged --rm -i -v ${PWD}/output:/builder/builds -v /proc:/proc builder:latest ./build --desktop sway --release testing
ssh -o StrictHostKeyChecking=no ${{ secrets.STORAGE_USER}}@${{ secrets.STORAGE_HOST }} -p ${{ secrets.STORAGE_PORT}} -i ~/.ssh/id_rsa rm -rf /media/iso/tile-os/testing/sway/*
docker run --rm -e STORAGE_HOST=${{ secrets.STORAGE_HOST }} -e STORAGE_USER=${{ secrets.STORAGE_USER }} -v ${PWD}/output:/builder/builds builder:latest scp -o StrictHostKeyChecking=no -o Port=10300 -o IdentityFile=/builder/id_rsa -p -B /builder/builds/amd64/* ${STORAGE_USER}@${STORAGE_HOST}:/media/iso/tile-os/testing/sway/

View file

@ -1,20 +0,0 @@
on: [workflow_call]
jobs:
prebuild:
runs-on: [iso-builder]
container:
image: catthehacker/ubuntu:act-22.04
options: --privileged
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Build builder image
run: |
eval $(ssh-agent -s)
echo "${{ secrets.STORAGE_SSH_KEY }}" > ./id_rsa
docker build --no-cache -f Dockerfile-builder -t builder:latest .

View file

@ -1,16 +0,0 @@
name: TileOS ISO Builder Wrapper
on:
push:
branches:
- ci
jobs:
prebuild:
uses: ./.forgejo/workflows/prebuild.yaml
secrets: inherit
build-sway:
uses: ./.forgejo/workflows/build-image-sway.yaml
secrets: inherit
needs: [prebuild]

3
.gitignore vendored
View file

@ -1,6 +1,3 @@
tmp/*
builds/*
artifacts/*
#.gitlab-ci.yml
.forgejo
.forgejo/workflows

View file

@ -1,55 +0,0 @@
stages:
- prebuild
- build
- postbuild
prebuild:
stage: prebuild
tags:
- Builder-1
script:
- docker build --no-cache -f Dockerfile-builder -t builder:latest .
tileos-sway-amd64:
when: manual
stage: build
variables:
DESKTOP: sway
tags:
- Builder-1
script:
- eval $(ssh-agent -s)
- mkdir ~/.ssh/
- echo "$BASE64_TILEOS_ISO_STORAGE_KEY" | base64 -d > ~/.ssh/id_rsa
- echo "$TILEOS_ISO_STORAGE_CONFIG" > ~/.ssh/config
- chmod 644 ~/.ssh/config
- chmod 400 ~/.ssh/id_rsa
- docker run --privileged --rm -i -v ${CI_PROJECT_DIR}/output:/builder/builds -v /proc:/proc -e DESKTOP=sway builder:latest ./build --desktop sway --release testing
- ssh -o StrictHostKeyChecking=no tileos@tileos rm -rf /media/iso/tile-os/ci/sway/*
- scp -o StrictHostKeyChecking=no -p -B ${CI_PROJECT_DIR}/output/amd64/* tileos@tileos:/media/iso/tile-os/ci/sway/
tileos-river-amd64:
when: manual
stage: build
variables:
DESKTOP: sway
tags:
- Builder-1
script:
- eval $(ssh-agent -s)
- mkdir ~/.ssh/
- echo "$BASE64_TILEOS_ISO_STORAGE_KEY" | base64 -d > ~/.ssh/id_rsa
- echo "$TILEOS_ISO_STORAGE_CONFIG" > ~/.ssh/config
- chmod 644 ~/.ssh/config
- chmod 400 ~/.ssh/id_rsa
- docker run --privileged --rm -i -v ${CI_PROJECT_DIR}/output:/builder/builds -v /proc:/proc builder:latest ./build --desktop river --release testing
- ssh -o StrictHostKeyChecking=no tileos@tileos rm -rf /media/iso/tile-os/ci/river/*
- scp -o StrictHostKeyChecking=no -p -B ${CI_PROJECT_DIR}/output/amd64/* tileos@tileos:/media/iso/tile-os/ci/river/
mrproper:
stage: postbuild
when: on_success
tags:
- Builder-1
needs:
- tileos-sway-amd64
- tileos-river-amd64
script:
- docker system prune -a -f

View file

@ -1,5 +0,0 @@
FROM debian:bookworm
RUN echo 'Acquire::http::Proxy "http://10.10.50.23:3142";' > /etc/apt/apt.conf.d/00aptproxy
RUN apt update && apt install -y openssh-client --no-install-recommends && rm -rf /var/lib/cache
WORKDIR /builder
COPY . /builder/

View file

@ -10,14 +10,16 @@ Clone this project & cd into it:
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 \
-v ${PWD}:/working_dir \
-w /working_dir \
-e DESKTOP=sway \
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
# Include common options
. ./options
. ./terraform.conf
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -17,8 +15,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 "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--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
# Include common options
. ./options
. ./terraform.conf
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -17,8 +15,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 "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--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
# Include common options
. ./options
. ./terraform.conf
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -17,11 +15,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 "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--apt-source-archives false \
--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" \
--cache-packages false \
--checksums md5 \
@ -29,7 +27,7 @@ lb config noauto \
--binary-images iso-hybrid \
--iso-application "$NAME" \
--iso-volume "$NAME" \
--firmware-chroot false \
--firmware-chroot true \
--zsync false \
--security true \
--updates true \

View file

@ -1,3 +1,3 @@
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
#deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main

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
# Include common options
. ./options
. ./terraform.conf
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -17,8 +15,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 "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \

View file

@ -1,3 +1,3 @@
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
#deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main

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
# Include common options
. ./options
. ./terraform.conf
# live-build configuration
lb config noauto \
--architectures "$ARCH" \
--mode debian \
@ -17,8 +15,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 "$MIRROR_SECURITY" \
--parent-mirror-chroot-security "$MIRROR_SECURITY" \
--mirror-chroot-security "http://deb.debian.org/debian-security/" \
--parent-mirror-chroot-security "http://deb.debian.org/debian-security/" \
--apt-source-archives false \
--parent-mirror-binary "$MIRROR_URL" \
--keyring-packages "debian-keyring tileos-archive-keyring" \

View file

@ -13,15 +13,19 @@ CODENAME="t-rex"
# distribution version
VERSION="1.3"
# 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"