Skip to content

Instantly share code, notes, and snippets.

@moolen
Last active April 13, 2018 07:14
Show Gist options
  • Save moolen/540a190c26ce44eb0b317af75a0098cd to your computer and use it in GitHub Desktop.
Save moolen/540a190c26ce44eb0b317af75a0098cd to your computer and use it in GitHub Desktop.
remaster archlinux ISO
#!/bin/bash
set -x
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MNT=/mnt/archiso
ISO=${ISO:-/path/to/my/archlinux-2017.10.01-x86_64.iso}
TMP_DIR=/mnt/customiso
rm -rf $TMP_DIR
rm $DIR/arch-custom.iso
mkdir $MNT
mkdir $TMP_DIR
mount -t iso9660 -o loop $ISO $MNT
set -e
cp -a $MNT/* $TMP_DIR
cd $TMP_DIR/arch/x86_64
unsquashfs airootfs.sfs
# this is the important part
# copy your files over to $TMP_DIR/arch/x86_64/squashfs-root
# my installer should be at /root
cp $DIR/installer.sh $TMP_DIR/arch/x86_64/squashfs-root/root
rm airootfs.sfs
mksquashfs squashfs-root airootfs.sfs
rm -r squashfs-root
md5sum airootfs.sfs > airootfs.md5
cd $TMP_DIR
# !important
# The ISO label must remain the same as the original label (in this case ARCH_201209) for the image to boot successfully
# You can check the label with `strings <iso> | grep ARCH_
genisoimage -l -r -J -V "ARCH_201710" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -o $DIR/arch-custom.iso ./
umount $MNT
rm -rf $TMP_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment