Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from crystal-linux/development
Browse files Browse the repository at this point in the history
Add bootstrap build files
  • Loading branch information
axtloss authored Aug 19, 2022
2 parents 505e691 + ad7b72b commit 8f52c83
Show file tree
Hide file tree
Showing 10 changed files with 105 additions and 40 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.iso
*.tar.gz
crystal/airootfs/etc/pacman.conf
crystal/airootfs/etc/buildstamp
chrooted.sh
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<something>` 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.
Expand Down
43 changes: 43 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 0 additions & 20 deletions build_iso.sh

This file was deleted.

19 changes: 19 additions & 0 deletions chrooted-bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/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

# Hostname
echo "crystal-live" > /etc/hostname

# Locale
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen


echo "Configured the system. Exiting chroot."
11 changes: 8 additions & 3 deletions chrooted.sh → chrooted-iso.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
11 changes: 0 additions & 11 deletions crystal/airootfs/etc/systemd/system/mirrorlist.service

This file was deleted.

25 changes: 25 additions & 0 deletions crystal/bootstrap_packages.x86_64
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions crystal/pacman.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8f52c83

Please sign in to comment.