Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor update-template-ubuntu.sh and add update-template-debian.sh #2731

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

norio-nomura
Copy link
Contributor

@norio-nomura norio-nomura commented Oct 14, 2024

  • Refactor update-template-ubuntu.sh to separate distribution-specific code.
  • Enable support for other distributions.
  • Add a common update-template.sh.
  • Add update-template-debian.sh to handle Debian.

This PR aims to add Debian support as per #1347.
Also fixes: #2756

…ead of tsv

Since `unpacked/SHA256SUMS` has no `Content-Type`, the output of `curl -w` formatted as TSV causes `IFS=$'\t' read -r` to fail during parsing.

Signed-off-by: Norio Nomura <[email protected]>
…info`

that returns the image entry with the kernel info instead of returning the kernel info.

Signed-off-by: Norio Nomura <[email protected]>
Functions in this script assume error handling with 'set -e'.
To ensure 'set -e' works correctly:
- Use 'set +e' before assignments and '$(set -e; <function>)' to capture output without exiting on errors.
- Avoid calling functions directly in conditions to prevent disabling 'set -e'.
- Use 'shopt -s inherit_errexit' (Bash 4.4+) to avoid repeated 'set -e' in all '$(...)'.

Changes:
- Add `error_exit` and more error messages
- Remove `|| return` after `$(...)`
- Use `jq -e`

Signed-off-by: Norio Nomura <[email protected]>
…e adding `.kernel.cmdline`

Signed-off-by: Norio Nomura <[email protected]>
…ud:released:download.json` does not contain a matching image

Signed-off-by: Norio Nomura <[email protected]>
…nel location is not null

Signed-off-by: Norio Nomura <[email protected]>
…tributions

- Move functions common to all distributions here.
- Scripts for specific distributions accept distribution-specific options and perform additional actions.

Signed-off-by: Norio Nomura <[email protected]>
@norio-nomura
Copy link
Contributor Author

Finally, I've laid the groundwork to add code for other distributions. Now, I'll start adding code for Debian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update-template-ubuntu.sh should detect the distro version from the template
1 participant