Skip to content

Conversation

whi-tw
Copy link
Contributor

@whi-tw whi-tw commented Feb 17, 2023

Hello!

I have made some improvements to make_custom_pi_os after having some friction getting started on macos:

Improve portability of make_custom_pi_os

  • Use which to check for gsed and use it if available:
    macos ships with BSD sed which doesn't support -i for in-place
    editing
  • get the primary group of the current user with id -gn instead
    of hardcoding it to ${USER} - macos doesn't create a group
    with the same name as the user by default
  • Add quotes around a bunch of variables to prevent globbing /
    word splitting
  • Use set -euo pipefail to make the script fail on errors and
    undefined variables, rather than silently continuing
  • Use '-s' flag with curl to prevent it from printing the download
    progress bar when retrieving version info
  • Check we can retrieve the filename of the latest Raspbian image
    before downloading it
  • Print out the URL of the image we're downloading

Allow specifying variant when creating new custom os

Rather than just the hardcoded raspios_lite_armhf, users can now specify
raspios_lite_armhf or raspios_lite_arm64 with -v/--variant

Guard against space / hyphen in the destination folder

This causes some pain, as the default module uses this directory name for creating variables.
If these characters are just disallowed, this pain goes away

- Use `which` to check for `gsed` and use it if available:
  macos ships with BSD sed which doesn't support `-i` for in-place
  editing
- get the primary group of the current user with `id -gn` instead
  of hardcoding it to `${USER}` - macos doesn't create a group
  with the same name as the user by default
- Add quotes around a bunch of variables to prevent globbing /
  word splitting
- Use `set -euo pipefail` to make the script fail on errors and
  undefined variables, rather than silently continuing
- Use '-s' flag with curl to prevent it from printing the download
  progress bar when retrieving version info
- Check we can retrieve the filename of the latest Raspbian image
  before downloading it
- Print out the URL of the image we're downloading
@guysoft
Copy link
Owner

guysoft commented Feb 21, 2023

Thanks for giving attention to this tool. Hope it would get more people to create more distributions :)

@guysoft guysoft merged commit eeed54b into guysoft:devel Feb 21, 2023
@whi-tw whi-tw deleted the improve_macos_compatibility branch February 21, 2023 20:52
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.

2 participants