Added two 'QoL' functions to common.sh #146
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
check_install_pkgs accepts multiple words in Variable.
As example:
Your module needs many dependencies.
Place an Variable in your config file like:
[ -n "$KLIPPER_DEPS" ] || KLIPPER_DEPS="wget git gpiod
virtualenv python-dev
libffi-dev build-essential
libncurses-dev libusb-dev
avrdude gcc-avr binutils-avr avr-libc
stm32flash dfu-util libnewlib-arm-none-eabi
gcc-arm-none-eabi binutils-arm-none-eabi libusb-1.0-0"
in your start_chroot_script, you can use:
apt_update_skip
check_install_pkgs $KLIPPER_DEPS
This will check your apt cache is present and if, then its time since last 'apt update'
If it is older than 1 Hour it will run 'apt update'
After that it checks for your set Packages if is one or more missing it will install them.
This could be Handy if you use multiple Modules with similar Dependencies.
Regards