New build instructions

Anton Hvornum 2021-03-14 22:24:52 +01:00
parent 296cffeeb7
commit d3b6085b2b
2 changed files with 113 additions and 43 deletions

113
Building-and-Testing.md Normal file

@ -0,0 +1,113 @@
Below are a set of quick instructions to build your own ISO.<br>
# Building the ISO
### Step 1: Setup archiso
The best thing you can do, is follow the official documentation for [archiso](https://wiki.archlinux.org/index.php/archiso) on Arch Linux Wiki.<br>
But the gist is this:
# mkdir -p ./archiso
# cd ./archiso
# cp -r /usr/share/archiso/configs/releng/* ./
### Step 2: Add packages to `packages.x86_64`
git
python
python-setuptools
### Step 3: Clone the repo
While standing in the `archiso` folder, clone using:
# git clone https://github.com/Torxed/archinstall airootfs/root/archinstall-git
### Step 4: Create a skel `.zprofile` for autolaunch
While standing in the `archiso` folder, create and add the following:
# cat <<\EOF >> ./airootfs/root/.zprofile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && sh -c "cd /root/archinstall-git; git config --global pull.rebase false; git pull; cp examples/guided.py ./; python guided.py"
EOF
This will auto-run when the ISO boots.
It will perform four simple tasks:
1. Enter the `archinstall-git` folder
2. `git config` and `git pull` each time
3. copy `guided.py` into the root git folder due to how the import works in Python
4. Finally it will run the latest version of `guided.py`
----
For a simple script that builds, boots and does all this automatically.
The following convenience script is provided. Simply run `./test.sh`.
```bash
#!/bin/bash
if [ -z "$1" ]
then
echo "Need to define a output folder for the archiso:"
echo "Example (build and run):"
echo " ./test.sh ./archiso"
echo "Example (skip building and run existing ISO):"
echo " ./test.sh ./archiso true"
exit 1
fi
ARCHISO_FOLDER=$1
SKIP_BUILD=$2
BRANCH="master"
if [ -z $SKIP_BUILD ]
then
echo "Making a clean build!"
`rm -rf "${ARCHISO_FOLDER}" 2>/dev/null` || (
echo "Could not delete protected folder:";
echo "-> ${ARCHISO_FOLDER}";
echo "Running as sudo.";
sudo rm -rf "${ARCHISO_FOLDER}"
)
mkdir -p "${ARCHISO_FOLDER}"
cp -r /usr/share/archiso/configs/releng/* "${ARCHISO_FOLDER}/"
git clone https://github.com/Torxed/archinstall "${ARCHISO_FOLDER}/airootfs/root/archinstall-git"
(cd "${ARCHISO_FOLDER}/airootfs/root/archinstall-git"; git checkout "${BRANCH}" )
echo "git" >> "${ARCHISO_FOLDER}/packages.x86_64"
echo "python" >> "${ARCHISO_FOLDER}/packages.x86_64"
echo "python-setuptools" >> "${ARCHISO_FOLDER}/packages.x86_64"
cat <<\EOF >> "${ARCHISO_FOLDER}/airootfs/root/.zprofile"
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && sh -c "cd /root/archinstall-git; git config --global pull.rebase false; git pull; cp examples/guided.py ./; python guided.py --harddrive=/dev/sda --keyboard-language=sv-latin1 --mirror-region=Sweden --hostname=tested '--!encryption-password=test' '--!root-password=test'"
EOF
( cd "${ARCHISO_FOLDER}/"; sudo mkarchiso -v -w work/ -o out/ ./; )
fi
if [ ! -f "./test.qcow2" ];
then
qemu-img create -f qcow2 ./test.qcow2 15G
fi
sudo qemu-system-x86_64 \
-cpu host \
-enable-kvm \
-machine q35,accel=kvm \
-device intel-iommu \
-m 8192 \
-drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_CODE.fd \
-drive if=pflash,format=raw,readonly,file=/usr/share/ovmf/x64/OVMF_VARS.fd \
-device virtio-scsi-pci,bus=pcie.0,id=scsi0 \
-device scsi-hd,drive=hdd0,bus=scsi0.0,id=scsi0.0,bootindex=2 \
-drive file=./test.qcow2,if=none,format=qcow2,discard=unmap,aio=native,cache=none,id=hdd0 \
-device virtio-scsi-pci,bus=pcie.0,id=scsi1 \
-device scsi-cd,drive=cdrom0,bus=scsi1.0,bootindex=1 \
-drive file=$(ls -t $ARCHISO_FOLDER/out/*.iso | head -n 1),media=cdrom,if=none,format=raw,cache=none,id=cdrom0
```
Modify `BRANCH` to suit your needs.
This enables quick testing, there's no need to re-boot between each try, simply press `Ctrl+D` in the terminal to re-log and the latest version will be fetched and executed, thanks to the `.zprofile`.

43
Home.md

@ -1,43 +0,0 @@
Below are a set of quick instructions to build your own ISO.<br>
For a more detailed documentation of the project, see the official [documentation](#).
# Building your own ISO
### Step 1: Setup archiso
The best thing you can do, is follow the official documentation for [archiso](https://wiki.archlinux.org/index.php/archiso) on Arch Linux Wiki.<br>
But the gist is this:
# mkdir -p ./archiso
# cd ./archiso
# cp -r /usr/share/archiso/configs/releng/* ./
### Step 2: Updated `pacman.conf` in build environment.
We need to update the `pacman.conf` for the **build** environment.<br>
The addition will be a custom mirror pointing towards [archlife](https://archlinux.life).
[archlife]
Server = https://archlinux.life/$repo/os/$arch
SigLevel = Optional TrustAll
### Step 3: Add packages to `packages.x86_64`
python
archinstall
`archinstall` is pckaged in the `archlife` mirror.
### Step 4: Create a skel `.zprofile` for autolaunch
While standing in the `archiso` folder, create and add the following:
# mkdir -p ./airootfs/etc/skel
# cat <<\EOF >> ./airootfs/etc/skel/.zprofile
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && sh -c "archinstall"
EOF
This will auto launch the `archinstall` command without arguments.<br>
In this mode, it will start a guided installation of archinstall.
This is the same setup you'll find on [https://archlinux.life](https://archlinux.life/).