archboot/usr/bin/archboot-tarball-helper.sh
Tobias Powalowski 19bfd13771 - Renamed kernel and initramfs files.
- Separated x86_64 and i686 specific code in all-in-one script so that
a x86_64 only iso can be created if needed.
- revamp grub2 uefi config used in all-in-one and update-iso scripts
- added  "gpt loglevel=7" to kernel parameters
- Enabled xz compression for packages squashfs files
- xz initramfs (in archboot-update-iso.sh)
- used INITRD option in syslinux config files
- change PREFIX for GRUB2_UEFI in setup script to /boot/grub as per
changes in grub2 bzr r3856 (upstream), package will be in the repos
shortly
- disable get_grub2_map() , grub-mkdevicemap removed by upstream in r3856
- revamp dogrub2_config function
- common config for both grub2-bios and grub2 uefi in setup script
(required r3856 pkg)
- use sgdisk alone for auto_prepare gpt in setup script
- increase UEFISYS part size to 512 MiB in auto_prepare in setup
script (required for alternate UEFI bootloaders)
- fix repeating .efi in efibootmgr command in setup script
- other minor fixes, added quotes whereever required
- [TRIED TO] fix quickinst script
2012-02-06 14:44:34 +01:00

90 lines
3.1 KiB
Bash
Executable file

#! /bin/sh
# Created by Tobias Powalowski <tpowa@archlinux.org>
# Settings
APPNAME=$(basename "${0}")
CONFIG=""
TARNAME=""
export TEMPDIR=$(mktemp -d /tmp/tarball-helper.XXXX)
usage ()
{
echo "${APPNAME}: usage"
echo " -c=CONFIG Use CONFIG file"
echo " -t=TARNAME Generate a tar image instead of an iso image"
echo " -h This message."
exit 1
}
[ "$1" == "" ] && usage
while [ $# -gt 0 ]; do
case $1 in
-c=*|--c=*) CONFIG="$(echo $1 | awk -F= '{print $2;}')" ;;
-t=*|--t=*) TARNAME="$(echo $1 | awk -F= '{print $2;}')" ;;
-h|--h|?) usage ;;
*) usage ;;
esac
shift
done
if [ "${TARNAME}" = "" ]; then
echo "ERROR: No image name specified, please use the -t option"
exit 1
fi
if [ ! -f "${CONFIG}" ]; then
echo "config file '${CONFIG}' cannot be found, aborting..."
exit 1
fi
. "${CONFIG}"
# export for mkinitcpio
[ -n "${APPENDBOOTMESSAGE}" ] && export APPENDBOOTMESSAGE
[ -n "${APPENDOPTIONSBOOTMESSAGE}" ] && export APPENDOPTIONSBOOTMESSAGE
export RUNPROGRAM="${APPNAME}"
export BOOTDIRNAME="boot/syslinux"
export USEKERNEL="${VERSION}"
[ "${BOOTMESSAGE}" = "" ] && export BOOTMESSAGE=$(mktemp /tmp/bootmessage.XXXX)
[ "${OPTIONSBOOTMESSAGE}" = "" ] && export OPTIONSBOOTMESSAGE=$(mktemp /tmp/optionsbootmessage.XXXX)
# begin script
mkdir -p "${TEMPDIR}/${BOOTDIRNAME}/"
# prepare syslinux bootloader
install -m755 /usr/lib/syslinux/isolinux.bin ${TEMPDIR}/${BOOTDIRNAME}/isolinux.bin
for i in /usr/lib/syslinux/*; do
[ -f $i ] && install -m644 $i ${TEMPDIR}/${BOOTDIRNAME}/$(basename $i)
done
install -m644 /lib/modules/${VERSION}/modules.pcimap ${TEMPDIR}/${BOOTDIRNAME}/modules.pcimap
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
# generate initramdisk
echo ":: Calling mkinitcpio CONFIG=${MKINITCPIO_CONFIG} KERNEL=${VERSION} ..."
echo ":: Creating initramdisk ..."
mkinitcpio -c ${MKINITCPIO_CONFIG} -k ${VERSION} -g ${TEMPDIR}/boot/initrd.img
echo ":: Using ${KERNEL} as image kernel ..."
install -m644 ${KERNEL} ${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
# create image
if ! [ "${TARNAME}" = "" ]; then
echo ":: Creating tar image ..."
[ -e ${TARNAME} ] && rm ${TARNAME}
tar cfv ${TARNAME} ${TEMPDIR} > /dev/null 2>&1 && echo ":: tar Image succesfull created at ${TARNAME}"
fi
# clean /tmp
rm -r ${TEMPDIR}