guysoft / CustomPiOS

A Raspberry Pi and other ARM devices distribution builder
GNU General Public License v3.0
508 stars 146 forks source link

Added two 'QoL' functions to common.sh #146

Closed KwadFan closed 2 years ago

KwadFan commented 2 years ago

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

guysoft commented 2 years ago

Thanks for your contribution!