Luna/tools/make-iso.sh
apio 8d5f598488
All checks were successful
Build and test / build (push) Successful in 1m45s
tools: Allow building as root for CI
2024-02-11 13:39:51 +01:00

27 lines
892 B
Bash
Executable File

#!/usr/bin/env bash
set -e
source $(dirname $0)/env.sh
cd $LUNA_ROOT
if [ "$(id -u)" -ne "0" ]
then
export FAKEROOT_SAVE="fakeroot -u -s $LUNA_ROOT/.fakeroot -- "
export FAKEROOT_RESTORE="fakeroot -u -i $LUNA_ROOT/.fakeroot -- "
else
echo "Caution: you are running make-iso.sh as root. This should only be done inside a container, for example in CI."
export FAKEROOT_SAVE=""
export FAKEROOT_RESTORE=""
fi
${FAKEROOT_SAVE}tools/install.sh
disk_space=$(du -s base | awk '{ print $1 }')
min_blocks=$(($disk_space / 4)) # This is just the blocks needed for all the files in the file system: this excludes space for the inode table, block group descriptors, etc.
blocks=$(($min_blocks + 1024)) # This is the actual number of blocks we're using.
${FAKEROOT_RESTORE}genext2fs -d base -B 4096 -b $blocks -L luna-rootfs -N 1024 build/ext2fs.bin
mkbootimg luna.json Luna.iso