merge tarball-helpers

This commit is contained in:
Tobias Powalowski 2022-01-06 19:02:18 +01:00
parent 2ad9f119a1
commit 7ab2c28760
2 changed files with 42 additions and 31 deletions

View file

@ -32,7 +32,7 @@ usage () {
PRESET_DIR="/etc/archboot/presets"
TARBALL_HELPER="/usr/bin/archboot-tarball-helper-arm.sh"
TARBALL_HELPER="/usr/bin/archboot-tarball-helper.sh"
# change to english locale!
export LANG="en_US"

View file

@ -39,46 +39,57 @@ if [ ! -f "${CONFIG}" ]; then
fi
. "${CONFIG}"
# export for mkinitcpio
[ -n "${APPENDBOOTMESSAGE}" ] && export APPENDBOOTMESSAGE
[ -n "${APPENDOPTIONSBOOTMESSAGE}" ] && export APPENDOPTIONSBOOTMESSAGE
export RUNPROGRAM="${APPNAME}"
export BOOTDIRNAME="boot/syslinux"
if [[ "$(uname -m)" == "x86_64" ]]; then
# export for mkinitcpio
[ -n "${APPENDBOOTMESSAGE}" ] && export APPENDBOOTMESSAGE
[ -n "${APPENDOPTIONSBOOTMESSAGE}" ] && export APPENDOPTIONSBOOTMESSAGE
[ "${BOOTMESSAGE}" = "" ] && export BOOTMESSAGE=$(mktemp bootmessage.XXXX)
[ "${OPTIONSBOOTMESSAGE}" = "" ] && export OPTIONSBOOTMESSAGE=$(mktemp optionsbootmessage.XXXX)
export BOOTDIRNAME="boot/syslinux"
# begin script
mkdir -p "${TEMPDIR}/${BOOTDIRNAME}/"
# prepare syslinux bootloader
install -m755 /usr/lib/syslinux/bios/isolinux.bin ${TEMPDIR}/${BOOTDIRNAME}/isolinux.bin
for i in /usr/lib/syslinux/bios/*; do
[ -f $i ] && install -m644 $i ${TEMPDIR}/${BOOTDIRNAME}/$(basename $i)
done
install -m644 /usr/share/hwdata/pci.ids ${TEMPDIR}/${BOOTDIRNAME}/pci.ids
install -m644 $BACKGROUND ${TEMPDIR}/${BOOTDIRNAME}/splash.png
[ "${BOOTMESSAGE}" = "" ] && export BOOTMESSAGE=$(mktemp bootmessage.XXXX)
[ "${OPTIONSBOOTMESSAGE}" = "" ] && export OPTIONSBOOTMESSAGE=$(mktemp optionsbootmessage.XXXX)
# Use config file
echo ":: Creating syslinux.cfg ..."
if [ "${SYSLINUXCFG}" = "" ]; then
echo "No syslinux.cfg file specified, aborting ..."
exit 1
else
sed "s|@@PROMPT@@|${PROMPT}|g;s|@@TIMEOUT@@|${TIMEOUT}|g;s|@@KERNEL_BOOT_OPTIONS@@|${KERNEL_BOOT_OPTIONS}|g" \
${SYSLINUXCFG} > ${TEMPDIR}/${BOOTDIRNAME}/syslinux.cfg
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/syslinux.cfg ] && echo "No syslinux.cfg found" && exit 1
# begin script
mkdir -p "${TEMPDIR}/${BOOTDIRNAME}/"
# prepare syslinux bootloader
install -m755 /usr/lib/syslinux/bios/isolinux.bin ${TEMPDIR}/${BOOTDIRNAME}/isolinux.bin
for i in /usr/lib/syslinux/bios/*; do
[ -f $i ] && install -m644 $i ${TEMPDIR}/${BOOTDIRNAME}/$(basename $i)
done
install -m644 /usr/share/hwdata/pci.ids ${TEMPDIR}/${BOOTDIRNAME}/pci.ids
install -m644 $BACKGROUND ${TEMPDIR}/${BOOTDIRNAME}/splash.png
# Use config file
echo ":: Creating syslinux.cfg ..."
if [ "${SYSLINUXCFG}" = "" ]; then
echo "No syslinux.cfg file specified, aborting ..."
exit 1
else
sed "s|@@PROMPT@@|${PROMPT}|g;s|@@TIMEOUT@@|${TIMEOUT}|g;s|@@KERNEL_BOOT_OPTIONS@@|${KERNEL_BOOT_OPTIONS}|g" \
${SYSLINUXCFG} > ${TEMPDIR}/${BOOTDIRNAME}/syslinux.cfg
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/syslinux.cfg ] && echo "No syslinux.cfg found" && exit 1
fi
fi
if [[ "$(uname -m)" == "aarch64" ]]; then
mkdir -p "${TEMPDIR}/boot"
fi
# generate initramdisk
echo ":: Calling mkinitcpio CONFIG=${MKINITCPIO_CONFIG} ..."
echo ":: Creating initramdisk ..."
mkinitcpio -c ${MKINITCPIO_CONFIG} -k ${ALL_kver} -g ${TEMPDIR}/boot/initrd.img
echo ":: Using ${ALL_kver} as image kernel ..."
install -m644 ${ALL_kver} ${TEMPDIR}/boot/vmlinuz
install -m644 ${BOOTMESSAGE} ${TEMPDIR}/${BOOTDIRNAME}/boot.msg
install -m644 ${OPTIONSBOOTMESSAGE} ${TEMPDIR}/${BOOTDIRNAME}/options.msg
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/boot.msg ] && echo 'ERROR:no boot.msg found, aborting!' && exit 1
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/options.msg ] && echo 'ERROR:no options.msg found, aborting!' && exit 1
install -m644 ${ALL_kver} ${TEMPDIR}/boot/vmlinuz
if [[ "$(uname -m)" == "x86_64" ]]; then
install -m644 ${BOOTMESSAGE} ${TEMPDIR}/${BOOTDIRNAME}/boot.msg
install -m644 ${OPTIONSBOOTMESSAGE} ${TEMPDIR}/${BOOTDIRNAME}/options.msg
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/boot.msg ] && echo 'ERROR:no boot.msg found, aborting!' && exit 1
[ ! -s ${TEMPDIR}/${BOOTDIRNAME}/options.msg ] && echo 'ERROR:no options.msg found, aborting!' && exit 1
fi
if [[ "$(uname -m)" == "aarch64" ]]; then
cp -r /boot/dtbs ${TEMPDIR}/boot
fi
# create image
if ! [ "${TARNAME}" = "" ]; then
echo ":: Creating tar image ..."