2021-09-10 20:37:36 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# created by Tobias Powalowski <tpowa@archlinux.org>
|
|
|
|
|
|
|
|
_BASENAME="$(basename "${0}")"
|
2021-10-07 11:21:28 +02:00
|
|
|
_PRESET_LATEST="x86_64-latest"
|
|
|
|
|
2021-09-23 09:14:28 +02:00
|
|
|
W_DIR="archboot-release"
|
|
|
|
|
2021-09-10 20:37:36 +02:00
|
|
|
usage () {
|
|
|
|
echo "CREATE ARCHBOOT RELEASE IMAGE"
|
|
|
|
echo "-----------------------------"
|
|
|
|
echo "Usage: ${_BASENAME} <directory>"
|
2021-09-10 22:13:26 +02:00
|
|
|
echo "This will create an archboot release image in <directory>."
|
2021-09-10 20:37:36 +02:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
[[ -z "${1}" ]] && usage
|
|
|
|
|
|
|
|
### check for root
|
|
|
|
if ! [[ ${UID} -eq 0 ]]; then
|
|
|
|
echo "ERROR: Please run as root user!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
mkdir -p $1
|
|
|
|
cd $1
|
2021-09-11 10:26:04 +02:00
|
|
|
# create container
|
2021-09-28 07:33:07 +02:00
|
|
|
archboot-create-container.sh "${W_DIR}" -cc -cp -alf
|
2021-09-22 18:59:33 +02:00
|
|
|
# generate tarball in container, umount tmp it's a tmpfs and weird things could happen then
|
2021-09-23 09:14:28 +02:00
|
|
|
systemd-nspawn -D "${W_DIR}" /bin/bash -c "umount /tmp;archboot-x86_64-iso.sh -t -i=archrelease"
|
2021-09-11 10:26:04 +02:00
|
|
|
# generate iso in container
|
2021-09-23 09:14:28 +02:00
|
|
|
systemd-nspawn -D "${W_DIR}" /bin/bash -c "umount /tmp;archboot-x86_64-iso.sh -g -T=archrelease.tar"
|
2021-10-07 21:46:35 +02:00
|
|
|
# remove not working lvm2 from latest image
|
2021-10-08 09:25:23 +02:00
|
|
|
systemd-nspawn -D "${W_DIR}" /bin/bash -c "pacman -Rdd lvm2 --noconfirm"
|
2021-10-04 20:15:21 +02:00
|
|
|
# generate latest tarball in container
|
2021-10-07 11:21:28 +02:00
|
|
|
systemd-nspawn -D "${W_DIR}" /bin/bash -c "umount /tmp;archboot-x86_64-iso.sh -t -i=latest -p="${_PRESET_LATEST}""
|
2021-10-04 20:15:21 +02:00
|
|
|
# generate latest iso in container
|
2021-10-07 11:21:28 +02:00
|
|
|
systemd-nspawn -D "${W_DIR}" /bin/bash -c "umount /tmp;archboot-x86_64-iso.sh -g -T=latest.tar -p="${_PRESET_LATEST}" -r=$(date +%Y.%m.%d-%H.%M)-latest"
|
2021-09-22 21:03:16 +02:00
|
|
|
# create Release.txt with included main archlinux packages
|
|
|
|
echo "Welcome to ARCHBOOT INSTALLATION / RESCUEBOOT SYSTEM" >>Release.txt
|
|
|
|
echo "Creation Tool: 'archboot' Tobias Powalowski <tpowa@archlinux.org>" >>Release.txt
|
|
|
|
echo "Homepage: https://wiki.archlinux.org/title/Archboot" >>Release.txt
|
|
|
|
echo "Architecture: x86_64" >>Release.txt
|
|
|
|
echo "RAM requirement to boot: 1024 MB or greater" >>Release.txt
|
2021-10-09 11:38:57 +02:00
|
|
|
echo "Archboot:$(systemd-nspawn -D "${W_DIR}" pacman -Qi archboot | grep Version | cut -d ":" -f2 | sed -e "s/\r//g")" >>Release.txt
|
2021-09-23 13:53:00 +02:00
|
|
|
echo "Kernel:$(systemd-nspawn -D "${W_DIR}" pacman -Qi linux | grep Version | cut -d ":" -f2 | sed -e "s/\r//g")" >>Release.txt
|
|
|
|
echo "Pacman:$(systemd-nspawn -D "${W_DIR}" pacman -Qi pacman | grep Version | cut -d ":" -f2 | sed -e "s/\r//g")" >>Release.txt
|
|
|
|
echo "Systemd:$(systemd-nspawn -D "${W_DIR}" pacman -Qi systemd | grep Version | cut -d ":" -f2 | sed -e "s/\r//g")" >>Release.txt
|
2021-09-11 10:26:04 +02:00
|
|
|
# move iso out of container
|
2021-09-23 09:14:28 +02:00
|
|
|
mv "${W_DIR}"/*.iso ./
|
2021-09-22 15:19:21 +02:00
|
|
|
# remove container
|
2021-09-23 09:14:28 +02:00
|
|
|
rm -r "${W_DIR}"
|
2021-09-11 10:26:04 +02:00
|
|
|
# create boot directory with ramdisks
|
2021-09-23 10:00:18 +02:00
|
|
|
mkdir -p boot/licenses/{amd-ucode,intel-ucode}
|
2021-10-04 20:15:21 +02:00
|
|
|
for i in *.iso; do
|
|
|
|
if [[ ! "$(echo $i | grep latest)" ]]; then
|
2021-10-10 10:58:01 +02:00
|
|
|
isoinfo -R -i "${i}" -x /boot/amd-ucode.img > boot/amd-ucode.img
|
|
|
|
isoinfo -R -i "${i}" -x /boot/intel-ucode.img > boot/intel-ucode.img
|
|
|
|
isoinfo -R -i "${i}" -x /boot/initramfs_x86_64.img > boot/initramfs_archboot_x86_64.img
|
|
|
|
isoinfo -R -i "${i}" -x /boot/vmlinuz_x86_64 > boot/vmlinuz_archboot_x86_64
|
2021-10-04 20:15:21 +02:00
|
|
|
else
|
2021-10-10 10:58:01 +02:00
|
|
|
isoinfo -R -i "${i}" -x /boot/initramfs_x86_64.img > boot/initramfs_archboot_latest_x86_64.img
|
2021-10-04 20:22:43 +02:00
|
|
|
fi
|
2021-10-04 20:15:21 +02:00
|
|
|
done
|
2021-09-17 10:43:00 +02:00
|
|
|
cp /usr/share/licenses/amd-ucode/* boot/licenses/amd-ucode/
|
|
|
|
cp /usr/share/licenses/intel-ucode/* boot/licenses/intel-ucode/
|
2021-10-11 07:19:23 +02:00
|
|
|
# create torrent files
|
2021-10-04 21:40:40 +02:00
|
|
|
for i in *.iso; do
|
2021-10-10 10:58:01 +02:00
|
|
|
archboot-mktorrent.sh archboot/"${1}" "${i}"
|
2021-10-04 21:40:40 +02:00
|
|
|
done
|
2021-09-11 10:26:04 +02:00
|
|
|
# create sha256sums
|
2021-10-10 18:53:39 +02:00
|
|
|
for i in *; do
|
|
|
|
[[ -f "${i}" ]] && cksum -a sha256 "${i}" >> sha256sum.txt
|
|
|
|
done
|
|
|
|
for i in boot/*; do
|
|
|
|
[[ -f "${i}" ]] && cksum -a sha256 "${i}" >> sha256sum.txt
|
|
|
|
done
|