Skip to content

Commit 3cebb9f

Browse files
authored
refactor(build): Rewrite build script to use live-build hooks
1 parent a70b3c7 commit 3cebb9f

File tree

1 file changed

+27
-50
lines changed

1 file changed

+27
-50
lines changed

build.sh

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
22
set -e
33

4-
echo "====== LUMINOS MASTER BUILD SCRIPT ======"
5-
if [ "$(id -u)" -ne 0 ]; then echo "ERROR: This script must be run as root."; exit 1; fi
4+
echo "====== LUMINOS MASTER BUILD SCRIPT (v2) ======"
5+
if [ "$(id -u)" -ne 0 ]; then echo "ERROR: This script must be run as root. Sorry."; exit 1; fi
66

7-
# Clean up previous build attempts first
7+
# Clean up all previous build artifacts
88
echo "--> Cleaning up previous build artifacts..."
99
sudo umount chroot/sys &>/dev/null || true
1010
sudo umount chroot/proc &>/dev/null || true
@@ -17,27 +17,8 @@ echo "--> Installing build dependencies (live-build, etc.)..."
1717
apt-get update
1818
apt-get install -y live-build debootstrap debian-archive-keyring plymouth curl rsync
1919

20-
# Run build phases in logical order
21-
./01-build-base-system.sh
22-
./02-configure-system.sh
23-
./03-install-desktop.sh
24-
./04-customize-desktop.sh
25-
./05-install-ai.sh
26-
./07-install-plymouth-theme.sh
27-
./06-final-cleanup.sh # Final cleanup must be last before packaging
28-
29-
30-
# --- ISO Building ---
20+
# --- Live-Build Configuration ---
3121
echo "--> Configuring live-build for ISO creation..."
32-
mkdir -p live-build-config
33-
cd live-build-config
34-
35-
# Explicitly clean any previous live-build state
36-
echo "--> Forcing clean of live-build environment..."
37-
sudo lb clean --purge
38-
39-
# Configure live-build
40-
echo "--> Running lb config..."
4122
lb config \
4223
--mode debian \
4324
--architectures amd64 \
@@ -46,7 +27,7 @@ lb config \
4627
--security true \
4728
--mirror-bootstrap "http://deb.debian.org/debian/" \
4829
--mirror-binary "http://deb.debian.org/debian/" \
49-
--mirror-binary-security "http://security.debian.org/debian-security/" \
30+
--mirror-binary-security "http://security.debian.org/debian-security/ trixie-security/main contrib non-free-firmware" \
5031
--bootappend-live "boot=live components locales=en_US.UTF-8" \
5132
--iso-application "LuminOS" \
5233
--iso-publisher "LuminOS Project" \
@@ -55,39 +36,35 @@ lb config \
5536
--debian-installer false \
5637
"${@}"
5738

58-
# Copy our custom-built system into the live-build chroot overlay
59-
echo "--> Copying the customized LuminOS system into the build environment..."
60-
# Ensure the target directory exists WITHIN the config structure lb expects
61-
mkdir -p config/includes.chroot/
62-
rsync -a ../chroot/ config/includes.chroot/
39+
# --- Prepare Hooks and Assets ---
40+
echo "--> Preparing build hooks and assets..."
41+
# Create directories for hooks
42+
mkdir -p config/hooks/live
43+
# Copy our scripts into the hooks directory, renaming them for execution order
44+
cp 02-configure-system.sh config/hooks/live/0200_configure-system.hook.chroot
45+
cp 03-install-desktop.sh config/hooks/live/0300_install-desktop.hook.chroot
46+
cp 04-customize-desktop.sh config/hooks/live/0400_customize-desktop.hook.chroot
47+
cp 05-install-ai.sh config/hooks/live/0500_install-ai.hook.chroot
48+
cp 07-install-plymouth-theme.sh config/hooks/live/0700_install-plymouth.hook.chroot
49+
cp 06-final-cleanup.sh config/hooks/live/9999_final-cleanup.hook.chroot
50+
51+
# Create directory for assets and copy them
52+
mkdir -p config/includes.chroot/usr/share/wallpapers/luminos
53+
cp assets/* config/includes.chroot/usr/share/wallpapers/luminos/
6354

64-
echo "--> Building the ISO (DEBUG MODE). This will could a significant amount of time..."
65-
# Run build with sudo and debug flags
66-
sudo lb build --debug --verbose
55+
echo "--> Building the ISO. This could take a significant amount of time..."
56+
# Run build with sudo
57+
sudo lb build
6758

6859
# Move the final ISO to the root of the project directory
69-
# Check if ISO exists before moving
70-
if ls *.iso 1> /dev/null 2>&1; then
71-
echo "--> Moving ISO to project root..."
72-
mv *.iso ..
73-
else
74-
echo "ERROR: ISO file was not found after build!"
75-
# Optionally: keep build dir for inspection
76-
# exit 1
77-
fi
60+
mv live-image-amd64.iso LuminOS-0.2-amd64.iso
7861

79-
cd ..
8062
echo "--> Cleaning up live-build configuration directory..."
81-
sudo rm -rf live-build-config
63+
sudo rm -rf config chroot cache binary .build
8264

8365
echo ""
8466
echo "========================================="
85-
# Check again if ISO exists in parent dir
86-
if ls *.iso 1> /dev/null 2>&1; then
87-
echo "SUCCESS: LuminOS ISO build is complete!"
88-
echo "Find your image in the main project folder"
89-
else
90-
echo "ERROR: Build finished but ISO file is missing!"
91-
fi
67+
echo "SUCCESS: LuminOS ISO build is complete!"
68+
echo "Find your image at: LuminOS-0.2-amd64.iso"
9269
echo "========================================="
9370
exit 0

0 commit comments

Comments
 (0)