Browse Source

Warn if initrd or kernel is missing

tags/nilmbuntu-5
Jim Paris 7 years ago
parent
commit
24a31b9e6d
1 changed files with 29 additions and 17 deletions
  1. +29
    -17
      buildiso.sh

+ 29
- 17
buildiso.sh View File

@@ -12,26 +12,38 @@ fi
set -x
set -e

if ! [ "$1" == "skip" ] ; then
INITRD=${FS}/initrd.img
VMLINUZ=$(readlink -f ${FS}/vmlinuz)
VMLINUZ_EFI=${VMLINUZ}.efi.signed

# Recompress initrd if changed
if [ ${FS}/initrd.img -nt ${ISO}/casper/initrd.lz ] ; then
sh -c "zcat ${FS}/initrd.img | lzma > ${ISO}/casper/initrd.lz"
fi
# Get kernel and signed EFI kernel
cp $(readlink -f ${FS}/vmlinuz) ${ISO}/casper/vmlinuz
cp $(readlink -f ${FS}/vmlinuz).efi.signed ${ISO}/casper/vmlinuz.efi
if ! [ "$1" == "justiso" ] ; then


if ! [ -r ${INITRD} -a -r ${VMLINUZ} -a -r ${VMLINUZ_EFI} ] ; then
set +x
echo "Missing kernel stuff... Either upgrade or reinstall"
echo "the kernel inside the image to get the right files."
exit 1
fi

# Recompress initrd if changed
if [ ${INITRD} -nt ${ISO}/casper/initrd.lz ] ; then
sh -c "zcat ${INITRD} | lzma > ${ISO}/casper/initrd.lz"
fi
# Get kernel and signed EFI kernel
cp ${VMLINUZ} ${ISO}/casper/vmlinuz
cp ${VMLINUZ_EFI} ${ISO}/casper/vmlinuz.efi

# manifests
chmod +w ${ISO}/casper/filesystem.manifest
chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
| tee ${ISO}/casper/filesystem.manifest >/dev/null
# manifests
chmod +w ${ISO}/casper/filesystem.manifest
chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
| tee ${ISO}/casper/filesystem.manifest >/dev/null

# squashfs
rm -f ${ISO}/casper/filesystem.squashfs
mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
printf $(du -sx --block-size=1 ${FS} | cut -f1) \
| tee ${ISO}/casper/filesystem.size
# squashfs
rm -f ${ISO}/casper/filesystem.squashfs
mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
printf $(du -sx --block-size=1 ${FS} | cut -f1) \
| tee ${ISO}/casper/filesystem.size

fi



Loading…
Cancel
Save