jrwren•

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.

6
debian_miner•

This is a nice contribution. If you were really looking for shell scripting critiques, here it is:

  1. Using "${BASH_SOURCE[0]}" is more reliable than realpath $0. Your current version will fail if used as bash create-iso.sh
  2. "${somevar%/*}" is preferred over dirname
  3. Per convention, all uppercase variables should be reserved for environment variables
  4. [[ is preferred over [ if you are explicitly using bash
  5. The script shouldn't allow for an empty admin password
  6. You should ensure required external programs such as genisoimage exist before trying to use them.
  7. set -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.
4
lamby[DPL]•

"${somevar%/*}" is preferred over dirname

How come?

set -e outside of extremely simple scripts should not be used

Surely the opposite?!! :)

3
debian_miner•

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

2
debian_miner•

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

1
flashbckOP•

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

2
Liorithiel•

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?

3
flashbckOP•

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

2