Skip to content

Instantly share code, notes, and snippets.

@attachmentgenie
Last active August 1, 2022 18:44
Show Gist options
  • Save attachmentgenie/7993410 to your computer and use it in GitHub Desktop.
Save attachmentgenie/7993410 to your computer and use it in GitHub Desktop.
simple script to package files into a bootable iso
<?xml version="1.0" encoding="UTF-8"?>
<project name="Package" default="help" basedir=".">
<!--
Ant Build file to run package tasks.
-->
<property file="config/application.properties"/>
<!--
Help target.
-->
<target name="help"
description="Show help menu.">
<echo message="Use ant -p to see all available targets."/>
</target>
<!--
Create ISO which includes custom preseed file and other modifications.
-->
<target name="iso-create" description="Create ISO which includes custom preseed file.">
<input message="Please enter location of Ubuntu ISO :"
addproperty="iso.package.input.image" />
<input message="Please enter location to mount Ubuntu ISO :"
addproperty="iso.package.input.mount" />
<input message="Please enter location to mount Ubuntu ISO :"
addproperty="iso.package.input.unpack" />
<echo message="Extracting Ubuntu ISO."/>
<exec executable="mount"
dir="${user.dir}/" >
<arg value="-o"/>
<arg value="loop"/>
<arg value="${iso.package.input.image}"/>
<arg value="${iso.package.input.mount}"/>
</exec>
<mkdir dir="${iso.package.input.unpack}"/>
<copy todir="${iso.package.input.unpack}">
<fileset dir="${iso.package.input.mount}" followsymlinks="false"/>
</copy>
<input message="Please enter location of preseed file :"
addproperty="iso.package.input.preseed" />
<input message="Please enter location of modified isolinux folder :"
addproperty="iso.package.input.isolinux" />
<echo message="Aggregating Modifications."/>
<copy file="${iso.package.input.preseed}" tofile="${iso.package.input.unpack}/preseed/custom.seed"/>
<copy file="${iso.package.input.isolinux}/isolinux.cfg" tofile="${iso.package.input.unpack}/isolinux/isolinux.cfg" overwrite="true"/>
<copy file="${iso.package.input.isolinux}/text.cfg" tofile="${iso.package.input.unpack}/isolinux/text.cfg" overwrite="true"/>
<input message="Please enter location were Modified ISO should be stored :"
addproperty="iso.package.output.iso" />
<input message="Please enter name of iso to be displayed when mounted :"
addproperty="iso.package.output.name" />
<echo message="Packaging Modifications."/>
<delete file="${iso.package.output.iso}"/>
<exec executable="./mkisofs.sh" >
<arg value="${iso.package.output.name}"/>
<arg value="${iso.package.output.iso}"/>
<arg value="${iso.package.input.unpack}"/>
</exec>
<echo message="Cleaning up workspace."/>
<delete dir="${iso.package.input.unpack}"/>
<exec executable="umount" dir="${user.dir}/" >
<arg value="${iso.package.input.mount}"/>
</exec>
</target>
</project>
#!/bin/sh
#Build phase
mkisofs -r -V "$1" \
-cache-inodes \
-J -l -b isolinux/isolinux.bin \
-c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \
-o $2 $3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment