-
Notifications
You must be signed in to change notification settings - Fork 151
Common.sh functions
CustomPiOS comes with a set of common functions that you can use to do common things in an image
call like this: gitclone OCTOPI_OCTOPRINT_REPO someDirectory -- this will do:
sudo -u "${BASE_USER}" git clone -b $OCTOPI_OCTOPRINT_REPO_BRANCH --depth $OCTOPI_OCTOPRINT_REPO_DEPTH $OCTOPI_OCTOPRINT_REPO_BUILD someDirectory
and if $OCTOPI_OCTOPRINT_REPO_BUILD != $OCTOPI_OCTOPRINT_REPO_SHIP also:
pushd someDirectory
sudo -u "${BASE_USER}" git remote set-url origin $OCTOPI_OCTOPRINT_REPO_SHIP
popd
if second parameter is not provided last URL segment of the BUILD repo URL minus the optional .git postfix will be used
call like this:
unpack /path/to/source /target user
this will copy all files & folders from source to target, preserving mode and timestamps and chown to user. If user is not provided, no chown will be performed
## is_installed
checks if a package is installed, returns 1 if installed and 0 if not.
usage:
is_installed <package_name>
checks if a systemctl exists
Export files in the image to an archive in the workspace folder Usage:
custompios_export [archive name] [files]
Will copy like cp, and then save it for export Usage:
copy_and_export tar_file_name source(s) destination
Will copy a folder, and then save it for export, similar to copy_and_export Usage:
copy_and_export_folder tar_file_name source destination
Set a value for a specific variable in /boot/config.txt See https://github.com/RPi-Distro/raspi-config/blob/master/raspi-config#L231
Let you update apt-get update only of the cache is older than an hour. To save time updating only once in a build