armbian_build/lib/functions/configuration/package-lists.sh
Igor Pečovnik b7b8eb7b72
Add / modify (c) in bash scripts (#4922)
* Add / modify (c) in bash scripts

Signed-off-by: Igor <igor@armbian.com>

* Add (c) to the source config files

---------

Signed-off-by: Igor <igor@armbian.com>
2023-03-09 18:30:40 +01:00

55 lines
1.9 KiB
Bash

#!/usr/bin/env bash
#
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2013-2023 Igor Pecovnik, igor@armbian.com
#
# This file is a part of the Armbian Build Framework
# https://github.com/armbian/build/
function get_caller_reference() {
# grab the caller function name, its source file and line number
local caller_ref="${FUNCNAME[2]}"
local caller_file="${BASH_SOURCE[2]}"
local caller_line="${BASH_LINENO[1]}"
# the format below must match the parser in parseEnvForList in aggregation.py
declare -g caller_reference="${caller_ref}:${caller_file}:${caller_line}"
}
# Adds to the main package list. Using this causes an immediate miss on any cached/standard rootfs.
function add_packages_to_rootfs() {
get_caller_reference
declare -g -a EXTRA_PACKAGES_ROOTFS=("${EXTRA_PACKAGES_ROOTFS[@]}")
declare -g -a EXTRA_PACKAGES_ROOTFS_REFS=("${EXTRA_PACKAGES_ROOTFS_REFS[@]}")
for package in "${@}"; do
# add package to the list
EXTRA_PACKAGES_ROOTFS+=("${package}")
EXTRA_PACKAGES_ROOTFS_REFS+=("${caller_reference}")
done
}
# Adds to the image package list; they're not cached in the rootfs.
function add_packages_to_image() {
get_caller_reference
declare -g -a EXTRA_PACKAGES_IMAGE=("${EXTRA_PACKAGES_IMAGE[@]}")
declare -g -a EXTRA_PACKAGES_IMAGE_REFS=("${EXTRA_PACKAGES_IMAGE_REFS[@]}")
for package in "${@}"; do
# add package to the list
EXTRA_PACKAGES_IMAGE+=("${package}")
EXTRA_PACKAGES_IMAGE_REFS+=("${caller_reference}")
done
}
# Removes a package from all lists: debootstrap, rootfs, desktop and image.
# Using this causes an immediate miss on any cached/standard rootfs.
function remove_packages() {
get_caller_reference
declare -g -a REMOVE_PACKAGES=("${REMOVE_PACKAGES[@]}")
declare -g -a REMOVE_PACKAGES_REFS=("${REMOVE_PACKAGES_REFS[@]}")
for package in "${@}"; do
# add package to the list
REMOVE_PACKAGES+=("${package}")
REMOVE_PACKAGES_REFS+=("${caller_reference}")
done
}