A script to generate a debian 9 iso with a preseed.cfg for semi-automated installs. Please share any suggestions/critiques.
github.com/douglasmiller/debian-9-iso-creatorPosted Mar 13, 2018, 8:53 PM UTC
Posted Mar 13, 2018, 8:53 PM UTC
This is a nice contribution. If you were really looking for shell scripting critiques, here it is:
realpath $0. Your current version will fail if used as bash create-iso.sh[[ is preferred over [ if you are explicitly using bashset -e outside of extremely simple scripts should not be used as it often results in unexpected behavior. e.g. set -e; x=0; (( x++ )); echo "$x" will exit the program before printing 1."${somevar%/*}" is preferred over dirname
How come?
set -eoutside of extremely simple scripts should not be used
Surely the opposite?!! :)
The use of dirname isn't really a huge deal. It's the difference of running an external command vs using the shell's built-in string manipulation features. For more unexpected behavior of set -e, see: http://mywiki.wooledge.org/BashFAQ/105
The use of dirname isn't really a huge deal. It's the difference of running an external command vs using the shell's built-in string manipulation features. For more unexpected behavior of set -e, see: http://mywiki.wooledge.org/BashFAQ/105
Ah thanks. I can always use more work on my bash scripting. I'll take note of these changes for future scripts.
My problem is that I so rarely write shell scripts that o heavily depend on shellcheck to guide me
Note that there are already several tools that either prepare ISO images for automatic installation, or a VM image with an already installed system. The ones I know of are bootstrap-vz, debos, Simple-CDD, vmdb/vmdb2. Are you sure you don't want to use one of them?
I'll have to look into those. I needed to start up around 5 vms and wanted a minimal install so that I could configure them further with ansible.
I basically just took a preseed from an old packer build I used to use for aws and repurposed it. I really just made this script to share with anyone else doing the same
https://fai-project.org from https://wiki.debian.org/FAI from https://wiki.debian.org/Cloud which says
Note that the Cloud team settled on FAI to generate new images in the November 2016 sprint, see Sprints/2016/DebianCloudNov2016 and https://lists.debian.org/debian-cloud/2016/11/msg00100.html for details.