From 736488f9ea9fe8b4c83a56ed229cf41534b3fd66 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Fri, 16 Sep 2022 22:57:41 +0100 Subject: [PATCH] Use PKG_CONFIG_ARCHIVE not BUILD_CONFIG_ARCHIVE, and save to /data/slackware. --- source/buildconf | 3 +++ templates/template.SlackBuild | 17 ++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/source/buildconf b/source/buildconf index 8972e24..4941159 100644 --- a/source/buildconf +++ b/source/buildconf @@ -8,3 +8,6 @@ unset CCACHE # Override default package store location. PKG_STORE='/data/slackware/repo/$DIST_OS_ID-$DIST_OS_VERSION_ID' + +# Put config backups from the packages here. +PKG_CONFIG_ARCHIVE="/data/slackware/repo/config-archive" diff --git a/templates/template.SlackBuild b/templates/template.SlackBuild index 68c89c2..ddeec05 100755 --- a/templates/template.SlackBuild +++ b/templates/template.SlackBuild @@ -48,6 +48,9 @@ cd "$(cd "${BASH_SOURCE[0]%/*}"; pwd -P)" # shellcheck disable=SC2016 [[ -z "$PKG_STORE" ]] && PKG_STORE='/tmp/pkg-store/$DIST_OS_ID-$DIST_OS_VERSION_ID' +# Package configuration archive path. +[[ -z "$PKG_CONFIG_ARCHIVE" ]] && PKG_CONFIG_ARCHIVE="/tmp/pkg-config-archive" + # Parse command line options. while (( $# > 0 )); do if [[ "$1" =~ ^-(-)?f(orce)?$ ]]; then @@ -93,7 +96,6 @@ unset DIST_OS_VERSION_CODENAME # Build environment. BUILD_WORKDIR="${BUILD_WORKDIR:-/tmp/pkg-build}" BUILD_ROOT="$BUILD_WORKDIR/pkg-$PKG_NAME" -BUILD_CONFIG_ARCHIVE="${BUILD_CONFIG_ARCHIVE:-/tmp/pkg-config-archive}" BUILD_PREFIX="${BUILD_PREFIX:-/opt}" BUILD_ALTCC="${BUILD_ALTCC:-}" BUILD_ALTCXX="${BUILD_ALTCXX:-}" @@ -144,8 +146,8 @@ case "${BUILD_ARCH:=$(uname -m)}" in ;; esac -# Now all possible changes to variables in PKG_STORE are complete, expand out the embedded variables. -eval "$(declare -p PKG_STORE | sed -re 's/\\\$/$/g')" +# Now all possible changes to variables in PKG_STORE and PKG_CONFIG_ARCHIVE are complete, expand out the embedded variables. +eval "$(declare -p PKG_STORE PKG_CONFIG_ARCHIVE | sed -re 's/\\\$/$/g')" # Sanity. SRC_DIR="$(pwd)" @@ -230,10 +232,11 @@ done # Move the package configuration files into the archive. [[ -e "$BUILD_ROOT/etc/$PKG_NAME" ]] && { (( ${BUILD_KEEPCONFIGS:-0} == 0 )) && { - rm -rf "$BUILD_CONFIG_ARCHIVE/$PKG_NAME-$PKG_VERSION" - mkdir -p -m 755 "$BUILD_CONFIG_ARCHIVE/$PKG_NAME-$PKG_VERSION/etc/$PKG_NAME" || \ - die "Failed to create directory: $BUILD_CONFIG_ARCHIVE/$PKG_NAME-$PKG_VERSION/etc/$PKG_NAME" - mv "$BUILD_ROOT/etc/$PKG_NAME"/* "$BUILD_CONFIG_ARCHIVE/$PKG_NAME-$PKG_VERSION/etc/$PKG_NAME" || die "Failed to move configuration files to archive" + rm -rf "$PKG_CONFIG_ARCHIVE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}" + mkdir -p -m 755 "$PKG_CONFIG_ARCHIVE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}/etc/$PKG_NAME" || \ + die "Failed to create directory: $PKG_CONFIG_ARCHIVE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}/etc/$PKG_NAME" + mv "$BUILD_ROOT/etc/$PKG_NAME"/* "$PKG_CONFIG_ARCHIVE/$PKG_NAME-${PKG_VERSION//-/_}-$PKG_ARCH-$PKG_BUILD${PKG_TAG//-/_}/etc/$PKG_NAME" || \ + die "Failed to move configuration files to archive" } }