archboot/usr/bin/archboot-x86_64-release.sh
Tobias Powalowski e9b742b32b test
2021-09-11 11:42:59 +02:00

43 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# created by Tobias Powalowski <tpowa@archlinux.org>
_BASENAME="$(basename "${0}")"
usage () {
echo "${_BASENAME}:"
echo "CREATE ARCHBOOT RELEASE IMAGE"
echo "-----------------------------"
echo "Usage: ${_BASENAME} <directory>"
echo "This will create an archboot release image in <directory>."
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
# create container
archboot-create-container.sh archboot-release
# generate tarball in container
systemd-nspawn -D archboot-release archboot-x86_64-iso.sh -t -i=archrelease
# generate iso in container
systemd-nspawn -D archboot-release archboot-x86_64-iso.sh -g -T=archrelease.tar
# move iso out of container
mv archboot-release/*.iso ./
# create boot directory with ramdisks
mkdir boot
isoinfo -R -i *.iso -x /boot/amd-ucode.img > boot/amd-ucode.img
isoinfo -R -i *.iso -x /boot/intel-ucode.img > boot/intel-ucode.img
isoinfo -R -i *.iso -x /boot/initramfs_x86_64.img > boot/initramfs_x86_64_archboot.img
isoinfo -R -i *.iso -x /boot/vmlinuz_x86_64 > boot/vmlinuz_x86_64_archboot
# create torrent file
archboot-mktorrent.sh archboot/$1 *.iso
# create sha256sums
sha256sum boot/* >> boot/sha256sum.txt
sha256sum * >> sha256sum.txt
# remove container
rm -r archboot-release