From 3bbb3fc516a112460f34193585ae05b360b39b5d Mon Sep 17 00:00:00 2001 From: Lexi <63929325+ShyyLexi@users.noreply.github.com> Date: Wed, 17 Aug 2022 18:14:36 +0000 Subject: [PATCH 1/7] Set default parallel downloads on pacman to 3 --- crystal/pacman.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/crystal/pacman.conf b/crystal/pacman.conf index f750078..49c07f6 100644 --- a/crystal/pacman.conf +++ b/crystal/pacman.conf @@ -37,6 +37,7 @@ ILoveCandy # We cannot check disk space from within a chroot environment #CheckSpace #VerbosePkgLists +ParallelDownloads = 3 # By default, pacman accepts packages signed by keys that its local keyring # trusts (see pacman-key and its man page), as well as unsigned packages. From d10d0f409ce5c925fbfacdb3bbe3813ccd71fb60 Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 18 Aug 2022 20:43:24 +0200 Subject: [PATCH 2/7] Add bootstrap build scripts --- build_iso.sh | 1 + build_rootfs.sh | 21 +++++++++++++++++++ chrooted-bootstrap.sh | 14 +++++++++++++ chrooted-iso.sh | 34 +++++++++++++++++++++++++++++++ crystal/bootstrap_packages.x86_64 | 25 +++++++++++++++++++++++ 5 files changed, 95 insertions(+) create mode 100755 build_rootfs.sh create mode 100755 chrooted-bootstrap.sh create mode 100755 chrooted-iso.sh create mode 100644 crystal/bootstrap_packages.x86_64 diff --git a/build_iso.sh b/build_iso.sh index 0b64b6b..a976156 100755 --- a/build_iso.sh +++ b/build_iso.sh @@ -2,6 +2,7 @@ rm -fv *.iso cp crystal/pacman.conf crystal/airootfs/etc/. +cp chrooted-iso.sh chrooted.sh if [[ "$1" == "" ]]; then WORKDIR=$(mktemp -d) diff --git a/build_rootfs.sh b/build_rootfs.sh new file mode 100755 index 0000000..be6d0d3 --- /dev/null +++ b/build_rootfs.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +rm -fv *.tar.xz +cp crystal/pacman.conf crystal/airootfs/etc/. +cp chrooted-bootstrap.sh chrooted.sh + +if [[ "$1" == "" ]]; then + WORKDIR=$(mktemp -d) +else + WORKDIR="$1" + if [[ ! -d "$WORKDIR" ]]; then + mkdir -p "$WORKDIR" + fi +fi + +echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp + +time sudo ./mkarchiso -m bootstrap -v -w $WORKDIR -o . crystal + +sudo rm -rf $WORKDIR +sudo chown $USER:$USER *.iso diff --git a/chrooted-bootstrap.sh b/chrooted-bootstrap.sh new file mode 100755 index 0000000..b61fc6c --- /dev/null +++ b/chrooted-bootstrap.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +echo "Chrooted in the new system, running as $(whoami)" + +# Services +systemctl enable NetworkManager +systemctl enable mirrorlist +systemctl enable gdm + +# Hostname and Locale +echo "crystal-live" > /etc/hostname +echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen +locale-gen +echo "LANG=en_US.UTF-8" > /etc/locale.conf +echo "Configured the system. Exiting chroot." diff --git a/chrooted-iso.sh b/chrooted-iso.sh new file mode 100755 index 0000000..02f2022 --- /dev/null +++ b/chrooted-iso.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +echo "Chrooted in the new system, running as $(whoami)" + +# Compile GSchemas +glib-compile-schemas /usr/share/glib-2.0/schemas + +# User setup +useradd -mG wheel crystal +usermod -c "Password // \"crystal\"" crystal +usermod -p $(echo "crystal" | openssl passwd -6 -stdin) crystal +usermod -p $(echo "crystal" | openssl passwd -6 -stdin) root +chsh -s /usr/bin/zsh crystal + +# Install Jade's GUI +flatpak install -y --noninteractive /usr/share/jade-gui/jade-gui.flatpak + +# Desktop icon for Jade's GUI +mkdir -p /home/crystal/Desktop +cp \ + /var/lib/flatpak/exports/share/applications/al.getcryst.jadegui.desktop \ + /home/crystal/Desktop/Install.desktop +chown -R crystal:crystal /home/crystal/ + +# Services +systemctl enable NetworkManager +systemctl enable mirrorlist +systemctl enable gdm + +# Hostname and Locale +echo "crystal-live" > /etc/hostname +echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen +locale-gen +echo "LANG=en_US.UTF-8" > /etc/locale.conf +echo "Configured the system. Exiting chroot." diff --git a/crystal/bootstrap_packages.x86_64 b/crystal/bootstrap_packages.x86_64 new file mode 100644 index 0000000..590a522 --- /dev/null +++ b/crystal/bootstrap_packages.x86_64 @@ -0,0 +1,25 @@ +# Arch packages +cowsay +curl +openbsd-netcat +openssh +pacman-contrib +reflector +tree +zsh + +# Things we're hosting +base +filesystem +lsb-release +neofetch +pfetch +sudo + +# Our packages +amethyst + +# Text editors +micro +nano +vim From 806269b33eac55fb0465b393ec18c69728c177af Mon Sep 17 00:00:00 2001 From: axtloss Date: Thu, 18 Aug 2022 20:48:18 +0200 Subject: [PATCH 3/7] Change workflow file --- .github/workflows/build.yml | 7 +++++-- .gitignore | 1 + chrooted.sh | 34 ---------------------------------- 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100755 chrooted.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4acda06..c9106c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,10 @@ jobs: git clone https://github.com/crystal-linux/iso/ cd iso bash build_iso.sh - md5sum *.iso > MD5SUMS + md5sum *.iso > MD5SUM-iso + rm chrooted.sh + bash build_rootfs.sh + md5sum *.tar.gz > MD5SUM-rootfs - name: Get current date @@ -33,7 +36,7 @@ jobs: - name: Upload uses: ncipollo/release-action@v1 with: - artifacts: "iso/*.iso,iso/MD5SUMS" + artifacts: "iso/*.iso,iso/MD5SUM-iso,iso/*.tar.gz,iso/MD5SUM-rootfs" token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ steps.date.outputs.date }} diff --git a/.gitignore b/.gitignore index 8fd2cf6..1b42677 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.iso crystal/airootfs/etc/pacman.conf crystal/airootfs/etc/buildstamp +chrooted.sh diff --git a/chrooted.sh b/chrooted.sh deleted file mode 100755 index 02f2022..0000000 --- a/chrooted.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env bash -echo "Chrooted in the new system, running as $(whoami)" - -# Compile GSchemas -glib-compile-schemas /usr/share/glib-2.0/schemas - -# User setup -useradd -mG wheel crystal -usermod -c "Password // \"crystal\"" crystal -usermod -p $(echo "crystal" | openssl passwd -6 -stdin) crystal -usermod -p $(echo "crystal" | openssl passwd -6 -stdin) root -chsh -s /usr/bin/zsh crystal - -# Install Jade's GUI -flatpak install -y --noninteractive /usr/share/jade-gui/jade-gui.flatpak - -# Desktop icon for Jade's GUI -mkdir -p /home/crystal/Desktop -cp \ - /var/lib/flatpak/exports/share/applications/al.getcryst.jadegui.desktop \ - /home/crystal/Desktop/Install.desktop -chown -R crystal:crystal /home/crystal/ - -# Services -systemctl enable NetworkManager -systemctl enable mirrorlist -systemctl enable gdm - -# Hostname and Locale -echo "crystal-live" > /etc/hostname -echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen -locale-gen -echo "LANG=en_US.UTF-8" > /etc/locale.conf -echo "Configured the system. Exiting chroot." From d228cd713eee5568b51082c03268311104529b27 Mon Sep 17 00:00:00 2001 From: axtloss Date: Fri, 19 Aug 2022 17:03:09 +0200 Subject: [PATCH 4/7] Unify both build scripts, use flags as options --- .gitignore | 1 + build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ build_iso.sh | 21 --------------------- build_rootfs.sh | 21 --------------------- 4 files changed, 44 insertions(+), 42 deletions(-) create mode 100755 build.sh delete mode 100755 build_iso.sh delete mode 100755 build_rootfs.sh diff --git a/.gitignore b/.gitignore index 1b42677..d291895 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.iso +*.tar.gz crystal/airootfs/etc/pacman.conf crystal/airootfs/etc/buildstamp chrooted.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e747e69 --- /dev/null +++ b/build.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +if [[ "$2" == "" ]]; then + WORKDIR=$(mktemp -d) +else + WORKDIR="$2" + if [[ ! -d "$WORKDIR" ]]; then + mkdir -p "$WORKDIR" + fi +fi +if [[ "$1" == "--build-iso" ]]; then + cp chrooted-iso.sh chrooted.sh + MKARCHISO_FLAGS="-v -w $WORKDIR -o . crystal" + rm -fv *.iso +elif [[ "$1" == "--build-bootstrap" ]]; then + cp chrooted-bootstrap.sh chrooted.sh + MKARCHISO_FLAGS="-m bootstrap -v -w $WORKDIR -o . crystal" + rm -fv *.tar.gz +else + RESULTCODE=0 + if [[ "$1" == "" ]]; then + echo "no option given, available options are:" + RESULTCODE=1 + elif [[ "$1" != "--help" ]]; then + echo "option '$1' not known, available options are:" + RESULTCODE=1 + fi + echo "--build-iso builds a crystal linux iso" + echo "--build-bootstrap builds a crystal linux rootfs tarball" + echo "--help display this message" + exit $RESULTCODE +fi +cp crystal/pacman.conf crystal/airootfs/etc/. + +echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp + +time sudo ./mkarchiso $MKARCHISO_FLAGS + +sudo rm -rf $WORKDIR +if [[ "$1" == "--build-iso" ]]; then + sudo chown $USER:$USER *.iso +else + sudo chown $USER:$USER *.tar.gz +fi diff --git a/build_iso.sh b/build_iso.sh deleted file mode 100755 index a976156..0000000 --- a/build_iso.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -rm -fv *.iso -cp crystal/pacman.conf crystal/airootfs/etc/. -cp chrooted-iso.sh chrooted.sh - -if [[ "$1" == "" ]]; then - WORKDIR=$(mktemp -d) -else - WORKDIR="$1" - if [[ ! -d "$WORKDIR" ]]; then - mkdir -p "$WORKDIR" - fi -fi - -echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp - -time sudo ./mkarchiso -v -w $WORKDIR -o . crystal - -sudo rm -rf $WORKDIR -sudo chown $USER:$USER *.iso diff --git a/build_rootfs.sh b/build_rootfs.sh deleted file mode 100755 index be6d0d3..0000000 --- a/build_rootfs.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -rm -fv *.tar.xz -cp crystal/pacman.conf crystal/airootfs/etc/. -cp chrooted-bootstrap.sh chrooted.sh - -if [[ "$1" == "" ]]; then - WORKDIR=$(mktemp -d) -else - WORKDIR="$1" - if [[ ! -d "$WORKDIR" ]]; then - mkdir -p "$WORKDIR" - fi -fi - -echo "Built on $(date +"%D @ %T EST")" > crystal/airootfs/etc/buildstamp - -time sudo ./mkarchiso -m bootstrap -v -w $WORKDIR -o . crystal - -sudo rm -rf $WORKDIR -sudo chown $USER:$USER *.iso From 4dcc06e634744dbea2f268ce4fac019179d2548d Mon Sep 17 00:00:00 2001 From: axtloss Date: Fri, 19 Aug 2022 17:04:32 +0200 Subject: [PATCH 5/7] Update readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 71170b6..59cbbce 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,8 @@ You will have to use Arch or Arch-Based distros to build this ISO File. * Install Dependencies * Go to the project folder -* Run `./build_iso.sh` - * If you get an error about `/tmp/` running out of space, reboot (to clear tmpfs), then re-run with a dir to use as temp (e.g. `./build_iso.sh FOOBAR`) - * If you also add a second arg as in `./build_iso.sh /some/folder testing`, you'll pull from our testing repo - +* Run `./build.sh --build-iso` to build an iso image +* Or Run `./build.sh --build-bootstrap` to build a rootfs tarball ### How to build inside of Docker or Podman: * The container **MUST** be ran as root to build. * Other than needing to be ran as root, it should function correctly. You may need to install a few more dependencies aside from the ones listed here. From b1bfa243bc4b7f9b3a12ff984695b24b19eb2e5b Mon Sep 17 00:00:00 2001 From: Michal S Date: Fri, 19 Aug 2022 16:36:26 +0100 Subject: [PATCH 6/7] fixed mirrorlist issue adn cleaned up bootstrap --- chrooted-bootstrap.sh | 14 ++++++++------ chrooted-iso.sh | 11 ++++++++--- .../airootfs/etc/systemd/system/mirrorlist.service | 11 ----------- 3 files changed, 16 insertions(+), 20 deletions(-) delete mode 100644 crystal/airootfs/etc/systemd/system/mirrorlist.service diff --git a/chrooted-bootstrap.sh b/chrooted-bootstrap.sh index b61fc6c..4647ca0 100755 --- a/chrooted-bootstrap.sh +++ b/chrooted-bootstrap.sh @@ -1,14 +1,16 @@ #!/usr/bin/env bash echo "Chrooted in the new system, running as $(whoami)" -# Services -systemctl enable NetworkManager -systemctl enable mirrorlist -systemctl enable gdm +# Mirrorlist +reflector > /etc/pacman.d/mirrorlist -# Hostname and Locale +# Hostname echo "crystal-live" > /etc/hostname + +# Locale echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen -locale-gen echo "LANG=en_US.UTF-8" > /etc/locale.conf +locale-gen + + echo "Configured the system. Exiting chroot." diff --git a/chrooted-iso.sh b/chrooted-iso.sh index 02f2022..e3aec08 100755 --- a/chrooted-iso.sh +++ b/chrooted-iso.sh @@ -23,12 +23,17 @@ chown -R crystal:crystal /home/crystal/ # Services systemctl enable NetworkManager -systemctl enable mirrorlist systemctl enable gdm -# Hostname and Locale +# Mirrorlist +reflector > /etc/pacman.d/mirrorlist + +# Hostname echo "crystal-live" > /etc/hostname + +# Locale echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen -locale-gen echo "LANG=en_US.UTF-8" > /etc/locale.conf +locale-gen + echo "Configured the system. Exiting chroot." diff --git a/crystal/airootfs/etc/systemd/system/mirrorlist.service b/crystal/airootfs/etc/systemd/system/mirrorlist.service deleted file mode 100644 index fcf9b44..0000000 --- a/crystal/airootfs/etc/systemd/system/mirrorlist.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Generates Base Crystal ISO Mirrorlist -Requires=network-online.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/bin/bash -c "reflector > /etc/pacman.d/mirrorlist" - -[Install] -WantedBy=multi-user.target From ad7b72b754b68fc4c73fe0e79205c44baa8482b4 Mon Sep 17 00:00:00 2001 From: axtloss Date: Fri, 19 Aug 2022 18:35:00 +0200 Subject: [PATCH 7/7] Fix wrong pacman config in bootstrap --- chrooted-bootstrap.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/chrooted-bootstrap.sh b/chrooted-bootstrap.sh index 4647ca0..45a87fa 100755 --- a/chrooted-bootstrap.sh +++ b/chrooted-bootstrap.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash echo "Chrooted in the new system, running as $(whoami)" +# Fix pacman config being put in / instead of /etc +mv /pacman.conf /etc/pacman.conf + # Mirrorlist reflector > /etc/pacman.d/mirrorlist