Lebnix Build #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Lebnix Build" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main, develop] | |
| schedule: | |
| - cron: '0 2 * * 0' | |
| jobs: | |
| build-and-upload: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Free disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache | |
| sudo docker system prune -af --volumes | |
| - name: Create build script | |
| run: | | |
| cat > build.sh << 'BUILD_SCRIPT_EOF' | |
| #!/bin/bash | |
| set -ex | |
| export DEBIAN_FRONTEND=noninteractive | |
| # Install live-build | |
| apt-get update && apt-get install -y \ | |
| live-build debootstrap xorriso git | |
| cd /w | |
| ISO="lebnix-v${RUN_NUM}" | |
| echo "=== Configuring live-build ===" | |
| # Initialize live-build | |
| lb config \ | |
| --distribution bookworm \ | |
| --architectures amd64 \ | |
| --archive-areas "main contrib non-free non-free-firmware" \ | |
| --debian-installer live \ | |
| --debian-installer-gui false \ | |
| --binary-images iso-hybrid \ | |
| --mode debian \ | |
| --system live \ | |
| --bootappend-live "boot=live components quiet splash" \ | |
| --bootappend-install "auto=true priority=critical" \ | |
| --iso-application "Lebnix" \ | |
| --iso-volume "LEBNIX" | |
| echo "=== Adding packages ===" | |
| # Create package list for live system | |
| mkdir -p config/package-lists | |
| cat > config/package-lists/lxde.list.chroot << 'PACKAGES' | |
| # Base system | |
| linux-image-amd64 | |
| firmware-linux | |
| systemd | |
| sudo | |
| network-manager | |
| wpasupplicant | |
| # LXDE Desktop | |
| lxde-core | |
| lxdm | |
| xorg | |
| xserver-xorg | |
| # Applications | |
| firefox-esr | |
| pcmanfm | |
| lxterminal | |
| gparted | |
| # File systems | |
| ntfs-3g | |
| e2fsprogs | |
| # Editors | |
| nano | |
| vim | |
| # Boot loader | |
| grub-efi-amd64 | |
| grub-pc-bin | |
| PACKAGES | |
| echo "=== Creating preseed file ===" | |
| # Create preseed for automated installation | |
| mkdir -p config/includes.installer | |
| cat > config/includes.installer/preseed.cfg << 'PRESEED' | |
| ### Localization | |
| d-i debian-installer/locale string en_US.UTF-8 | |
| d-i keyboard-configuration/xkb-keymap select us | |
| ### Network configuration | |
| d-i netcfg/choose_interface select auto | |
| d-i netcfg/get_hostname string lebnix | |
| d-i netcfg/get_domain string localdomain | |
| d-i netcfg/wireless_wep string | |
| ### Mirror settings | |
| d-i mirror/country string manual | |
| d-i mirror/http/hostname string deb.debian.org | |
| d-i mirror/http/directory string /debian | |
| d-i mirror/http/proxy string | |
| ### Account setup | |
| d-i passwd/user-fullname string Lebnix User | |
| d-i passwd/username string lebnix | |
| d-i passwd/user-password password lebnix | |
| d-i passwd/user-password-again password lebnix | |
| d-i passwd/user-default-groups string audio cdrom video sudo netdev plugdev | |
| d-i passwd/root-password password root | |
| d-i passwd/root-password-again password root | |
| ### Clock and time zone setup | |
| d-i clock-setup/utc boolean true | |
| d-i time/zone string US/Eastern | |
| d-i clock-setup/ntp boolean true | |
| ### Partitioning | |
| d-i partman-auto/method string regular | |
| d-i partman-auto/choose_recipe select atomic | |
| d-i partman-auto/disk string /dev/sda | |
| d-i partman-partitioning/confirm_write_new_label boolean true | |
| d-i partman/choose_partition select finish | |
| d-i partman/confirm boolean true | |
| d-i partman/confirm_nooverwrite boolean true | |
| ### Base system installation | |
| d-i base-installer/install-recommends boolean true | |
| d-i base-installer/kernel/image string linux-image-amd64 | |
| ### Package selection | |
| tasksel tasksel/first multiselect standard | |
| d-i pkgsel/include string lxde-core lxdm firefox-esr | |
| d-i pkgsel/upgrade select full-upgrade | |
| popularity-contest popularity-contest/participate boolean false | |
| ### Boot loader installation | |
| d-i grub-installer/only_debian boolean true | |
| d-i grub-installer/with_other_os boolean true | |
| d-i grub-installer/bootdev string default | |
| ### Finishing up the installation | |
| d-i finish-install/reboot_in_progress note | |
| d-i cdrom-detect/eject boolean false | |
| ### Post-install configuration | |
| d-i preseed/late_command string \ | |
| in-target sed -i 's/# autologin=dgod/autologin=lebnix/' /etc/lxdm/lxdm.conf; \ | |
| in-target systemctl enable lxdm; \ | |
| in-target systemctl enable NetworkManager | |
| PRESEED | |
| echo "=== Creating custom configuration hook ===" | |
| # Create hook to customize live system | |
| mkdir -p config/hooks/live | |
| cat > config/hooks/live/0100-customize.hook.chroot << 'HOOK' | |
| #!/bin/bash | |
| set -e | |
| # Configure LXDM auto-login for live system | |
| sed -i 's/# autologin=dgod/autologin=user/' /etc/lxdm/lxdm.conf | |
| # Enable services | |
| systemctl enable lxdm || true | |
| systemctl enable NetworkManager || true | |
| # Create live user | |
| if ! id -u user >/dev/null 2>&1; then | |
| useradd -m -s /bin/bash -G sudo,audio,video,netdev,plugdev user | |
| echo "user:live" | chpasswd | |
| fi | |
| # Configure sudoers for live user | |
| echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/live-user | |
| chmod 440 /etc/sudoers.d/live-user | |
| # Set hostname | |
| echo "lebnix-live" > /etc/hostname | |
| # Create OS release | |
| cat > /etc/os-release << 'EOF' | |
| NAME="Lebnix" | |
| ID=lebnix | |
| ID_LIKE=debian | |
| VERSION_ID="1.0" | |
| PRETTY_NAME="Lebnix - Little Debian Linux" | |
| HOME_URL="https://github.com/yourproject/lebnix" | |
| SUPPORT_URL="https://github.com/yourproject/lebnix/issues" | |
| BUG_REPORT_URL="https://github.com/yourproject/lebnix/issues" | |
| EOF | |
| HOOK | |
| chmod +x config/hooks/live/0100-customize.hook.chroot | |
| echo "=== Building ISO ===" | |
| # Build the ISO | |
| lb build 2>&1 | tee build.log | |
| # Find the generated ISO | |
| if [ -f live-image-amd64.hybrid.iso ]; then | |
| mv live-image-amd64.hybrid.iso "${ISO}.iso" | |
| # Generate checksum | |
| sha256sum "${ISO}.iso" > "${ISO}.iso.sha256" | |
| echo "" | |
| echo "═══ Build Complete ═══" | |
| ls -lh "${ISO}.iso" | |
| else | |
| echo "ERROR: ISO file not found!" | |
| exit 1 | |
| fi | |
| BUILD_SCRIPT_EOF | |
| chmod +x build.sh | |
| - name: Run build in Docker | |
| run: | | |
| docker run --rm --privileged \ | |
| -v "$PWD:/w" \ | |
| -e RUN_NUM="${{ github.run_number }}" \ | |
| debian:bookworm \ | |
| /w/build.sh | |
| - name: Upload to SourceForge | |
| if: github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
| env: | |
| SF_USER: ${{ secrets.SF_USER }} | |
| SF_PASS: ${{ secrets.SF_PASS }} | |
| run: | | |
| # Skip upload if secrets aren't configured | |
| if [ -z "$SF_USER" ] || [ -z "$SF_PASS" ]; then | |
| echo "SourceForge credentials not configured. Skipping upload." | |
| exit 0 | |
| fi | |
| sudo apt-get update | |
| sudo apt-get install -y sshpass rsync | |
| for iso_file in *.iso; do | |
| [ -f "$iso_file" ] || continue | |
| echo "Uploading $iso_file to SourceForge..." | |
| for attempt in 1 2 3; do | |
| if sshpass -p "$SF_PASS" rsync -avP \ | |
| -e "ssh -o StrictHostKeyChecking=no" \ | |
| "$iso_file" \ | |
| "[email protected]:/home/frs/project/lebnix/releases/"; then | |
| echo "Successfully uploaded $iso_file" | |
| break | |
| else | |
| echo "Upload attempt $attempt failed, retrying in 30s..." | |
| sleep 30 | |
| fi | |
| done | |
| done |