-
Notifications
You must be signed in to change notification settings - Fork 522
Building and Testing
Below are a set of quick instructions to build your own ISO.
The best thing you can do, is follow the official documentation for archiso on Arch Linux Wiki.
But the gist is this:
# mkdir -p ./archiso
# cd ./archiso
# cp -r /usr/share/archiso/configs/releng/* ./
git
python
python-setuptools
While standing in the archiso
folder, clone using:
# git clone https://github.com/Torxed/archinstall airootfs/root/archinstall-git
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 every login on tty1:
- Enter the
archinstall-git
folder -
git config
andgit pull
each time - copy
guided.py
into the root git folder due to how the import works in Python - Finally it will run the latest version of
guided.py
This makes it easy to test the latest version, by simply logging out and back in - and the four steps will get repeated.
No need to reboot or re-build.
Archiso has great information and the latest info. But in general, all you need to do (standing in the arciso folder), is to run:
# mkarchiso -v -w work/ -o out/ ./
And that should produce your ISO.
- Requires:
archiso
,git
andqemu
For a simple script that builds, boots and does all this automatically.
The following convenience script is provided. Simply run ./test.sh
.
#!/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 true"
echo "Example (skip building and run ISO as given path):"
echo " ./test.sh ./archiso"
exit 1
fi
REPO="https://github.com/Torxed/archinstall.git"
ARCHISO_FOLDER=$1
REBUILD=$2
BRANCH="master"
if [ $REBUILD ]
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 "${REPO}" "${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"
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.