tools: Allow building as root for CI
All checks were successful
Build and test / build (push) Successful in 1m45s

This commit is contained in:
apio 2024-02-11 13:39:51 +01:00
parent 8efcf6d852
commit 8d5f598488
Signed by: apio
GPG Key ID: B8A7D06E42258954
3 changed files with 15 additions and 10 deletions

View File

@ -10,8 +10,8 @@ jobs:
uses: actions/checkout@v3
- name: Download dependencies
run: |
sudo apt update
sudo apt install -y cmake ninja-build nasm genext2fs qemu-system build-essential wget git fakeroot
apt update
apt install -y cmake ninja-build nasm genext2fs qemu-system build-essential wget git fakeroot
- name: Set up the toolchain
run: |
wget https://pub.cloudapio.eu/luna/toolchains/ci-toolchain-arm64.tar.gz --quiet

View File

@ -11,12 +11,6 @@ then
exit 1
fi
if [ "$USER" == "root" ]
then
echo "This script must be run under fakeroot instead of as root."
exit 1
fi
chown -R root:root base
cmake --install $LUNA_BUILD_DIR
@ -31,5 +25,6 @@ mkdir -p base/tmp
rm -f base/bin
ln -s usr/bin base/bin
chown -h root:root base/bin
cp $LUNA_ROOT/LICENSE base/etc/skel/LICENSE

View File

@ -5,12 +5,22 @@ source $(dirname $0)/env.sh
cd $LUNA_ROOT
fakeroot -u -s $LUNA_ROOT/.fakeroot -- tools/install.sh
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 -u -i $LUNA_ROOT/.fakeroot -- genext2fs -d base -B 4096 -b $blocks -L luna-rootfs -N 1024 build/ext2fs.bin
${FAKEROOT_RESTORE}genext2fs -d base -B 4096 -b $blocks -L luna-rootfs -N 1024 build/ext2fs.bin
mkbootimg luna.json Luna.iso