63 lines
1.4 KiB
Bash
Executable File
63 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (C) 2023 Umorpha Systems
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
set -euE -o pipefail
|
|
|
|
main() {
|
|
local arg_rootfs_img arg_iso_img
|
|
arg_rootfs_img=$1
|
|
arg_iso_img=$2
|
|
|
|
local basename
|
|
basename=${arg_rootfs_img##*/}
|
|
basename=${basename%%.*}
|
|
|
|
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-"$(date +%s)"}
|
|
|
|
local label
|
|
label="${basename^^}_$(TZ=UTC date --date="@$SOURCE_DATE_EPOCH" +%Y%m%d_%H%M%S)"
|
|
|
|
local workdir
|
|
workdir="$(mktemp -dt "${0##*/}.XXXXXXXXXX")"
|
|
trap "rm -rf -- ${workdir@Q}" EXIT
|
|
|
|
mkdir -- "$workdir/mnt"
|
|
sudo osi-mount --user -- images/bootstrap.rootfs.img "$workdir/mnt" \
|
|
cp -T --recursive --dereference -- "$workdir/mnt/boot" "$workdir/iso"
|
|
|
|
echo " APPEND iso=LABEL=${label}" >>"$workdir/iso/isolinux/syslinux.cfg"
|
|
|
|
cp -- "$arg_rootfs_img" "$workdir/iso/rootfs.img"
|
|
|
|
|
|
sudo osi-mount --user -- images/bootstrap.rootfs.img "$workdir/mnt" \
|
|
xorriso \
|
|
\
|
|
-no_rc \
|
|
-report_about SORRY \
|
|
\
|
|
-as mkisofs \
|
|
\
|
|
-iso-level 3 \
|
|
-full-iso9660-filenames \
|
|
-joliet \
|
|
-joliet-long \
|
|
-rational-rock \
|
|
-volid "$label" \
|
|
-appid "Umorpha ${basename} bootstrap installer" \
|
|
-publisher "Umorpha Systems <https://umorpha.io>" \
|
|
-preparer "prepared by umorpha-boxes mkbootstrapiso" \
|
|
\
|
|
-eltorito-boot isolinux/isolinux.bin \
|
|
-eltorito-catalog isolinux/boot.cat \
|
|
-no-emul-boot \
|
|
-boot-load-size 4 \
|
|
-boot-info-table \
|
|
\
|
|
-output "$arg_iso_img" \
|
|
"$workdir/iso"
|
|
}
|
|
|
|
main "$@"
|