Skip to content

Instantly share code, notes, and snippets.

@coughingmouse
Created February 6, 2024 05:00
Show Gist options
  • Save coughingmouse/ab76deae36cf411e96f8010250c55d58 to your computer and use it in GitHub Desktop.
Save coughingmouse/ab76deae36cf411e96f8010250c55d58 to your computer and use it in GitHub Desktop.
Generation of Canonical cloud-utils cloud-localds on macOS with homebrew (OS X)
#!/bin/zsh
brew install cdrtools curl
curl -fsSL https://raw.githubusercontent.com/canonical/cloud-utils/main/bin/cloud-localds -o cloud-localds
sed -i '' -e 's/genisoimage/mkisofs/g' cloud-localds
sed -i '' -e 's/.*confused by additional args/\[ \$\# \-le 9 \] \|\| bad_Usage \"confused by additional args/g' cloud-localds
sed -i '' -e 's/output\=\$1/output\=\$7/' cloud-localds
sed -i '' -e 's/userdata\=$2/userdata\=\$8/' cloud-localds
sed -i '' -e 's/metadata\=$3/metadata\=\$9/' cloud-localds
chmod +x cloud-localds
@coughingmouse
Copy link
Author

ipveesix's comment here helped.

@kwantam
Copy link

kwantam commented Mar 18, 2024

The reason that $# ends up weird is that cloud-localds expects gnu getopt. If you brew install gnu-getopt and then replace the call to getopt (line 70ish) with /opt/homebrew/opt/gnu-getopt/bin/getopt, you can get rid of lines 5-8 of the above script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment