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

Various fixes and improvements #204

Merged
merged 15 commits into from
Sep 17, 2023
Merged

Various fixes and improvements #204

merged 15 commits into from
Sep 17, 2023

Conversation

umlaeute
Copy link
Contributor

base build system

the make_custom_pi_os script now allows more variants to download directly, namely the non-lite variants of raspios.

the build_custom_os script (and therefore the build_dist script for the various custom distributions) now accepts a few options:

  • -h to print a short help about the script (mostly for documenting the variant argument. i found myself running ./build_dist -h which started a build for some unknown -h variant)
  • -l <logfile> for setting the logfile directly (just because we can)

the custompios scriptlet now checks if sfdisk is available (and required), and aborts early with a warning. (on my Debian system, sfdisk lives in /sbin, which is not in my PATH. oftentimes i accidentally run ./build_dist as an ordinary (non-root) user, which would happily work away only to fail at the end when resizing the image. with this change it now fails after a few seconds, rather than after an hour, and i'm reminded to run through sudo...

in common.sh i've changed most echo invocations to use their colour variants (since the build log is so verbose with all those set -x, i really like the things that the build script wants to tell me to stand out visually).

also in common.sh, i've improved the detach_all_loopback() function, to test possible loop-devices for being a block device rather than a regular file.

modules

the pkgupgrade module now uses apt-get instead of apt

to quote from man apt:

SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS

The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward compatibility this is not guaranteed either if a change seems beneficial for interactive
use.

All features of apt(8) are available in dedicated APT tools like apt‐get(8) and apt‐cache(8) as well. apt(8) just changes the default value of some options (see apt.conf(5) and specifically the Binary scope). So you should
prefer using these commands (potentially with some additional options enabled) in your scripts as they keep backward compatibility as much as possible.

there's a new PKGUPGRADE_CLEANUP variable that can be set to n (or really: anything except the default y), in which case the apt-cache is not cleaned up. this is cool if you do not want to download the tons of deb packages for each build without setting up an apt-cacher.

minor stuff

i've added a few .gitignore files to the dist_example, in order to make sure that image-files are not accidentally committed to my precious git repository.

i've also run codespell over the sources and fixed spelling errors.

finally, the build process now shows the date when the build was started resp. finished. i find it nice to see how long it took, even when not closely watching the script)

feel free to cherry pick, or just merge the whole bunch.

IOhannes m zmölnig and others added 15 commits September 12, 2023 11:30
so on rebuild, we do not have to download all the packages

Closes: #3
'apt' does not provide a stable interface (and warns us about this, when using in a script)

also, 'apt' automatically removes downloaded packages after a (successful) installation,
but we want to be able to control this with 'PKGUPGRADE_CLEANUP'
to explain what this script is doing (and what the args are for)

this is inherited by <customos>/src/build_dist

Closes: #6
so we can log to another file

Closes: #4
(somewhat)
a /dev/loop* is not a *file*, hence 'test -f' does not work.
it is a block-device, so use 'test -b'

for compat, we leave the 'test -f' intact

Closes: guysoft#203
this is mostly to prevent errors like
> .../src/config: line 28: [: !=: unary operator expected

which happens if BUILD_VARIANT is unset and you call
> if [ $BUILD_VARIANT != 'default' ]; then


while being there i also quoted the other variables,
which should make *this* part of the code more resilient against whitespace paths
with our extra escaping, passing an empty BUILD_VARIANT is not longer
detected as 'default'.

this is now fixed.
@umlaeute
Copy link
Contributor Author

is there anything i can do to improve this PR in order to get it accepted? (like squashing commits that really belong together, e.g. 8535e22+ca61833, c1b3e5a+f5c58bd, or b10ed77+25bff8b)?

@guysoft
Copy link
Owner

guysoft commented Sep 17, 2023

Hey,
I just need to find time to go over it. I just have a lot of family stuff going on the past few days. did not forget you.

Also - what did you use to detect all the spelling errors? :)

@guysoft guysoft merged commit 8a3a002 into guysoft:devel Sep 17, 2023
@umlaeute
Copy link
Contributor Author

umlaeute commented Sep 18, 2023 via email

@umlaeute
Copy link
Contributor Author

Also - what did you use to detect all the spelling errors? :)

apt-get install codespell
codespell .

@umlaeute umlaeute deleted the fixes branch September 18, 2023 09:43
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.

dangling files after build eat diskspace.
2 participants