Skip to content

Conversation

@KwadFan
Copy link
Contributor

@KwadFan KwadFan commented Oct 19, 2021

  • 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

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

* 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
@KwadFan KwadFan changed the title Added two 'QoL' funtions to common.sh Added two 'QoL' functions to common.sh Oct 19, 2021
@KwadFan KwadFan mentioned this pull request Oct 19, 2021
Forgot to set missing_pkgs Variable to an Array
@guysoft guysoft merged commit 98ec626 into guysoft:devel Oct 20, 2021
@guysoft
Copy link
Owner

guysoft commented Oct 20, 2021

Thanks for your contribution!

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