Added two 'QoL' functions to common.sh#146
Merged
guysoft merged 2 commits intoguysoft:develfrom Oct 20, 2021
KwadFan:devel
Merged
Added two 'QoL' functions to common.sh#146guysoft merged 2 commits intoguysoft:develfrom KwadFan:devel
guysoft merged 2 commits intoguysoft:develfrom
KwadFan:devel
Conversation
* check_install_pkgs - check if pkgs is installed if not installs it. * apt_update_skip - Skips 'apt update' if cache not older than one Hour
Closed
Forgot to set missing_pkgs Variable to an Array
Owner
|
Thanks for your contribution! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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