From 03ada986759549070f55bc6e80d34322f7260db3 Mon Sep 17 00:00:00 2001 From: merakor Date: Fri, 7 Aug 2020 11:36:43 +0000 Subject: cpt-lib: move non-temporary cache directory creation back to main() FossilOrigin-Name: 5a7ee309fea6cb1f8b6b6ce9c1c1e5ee339061153123764a2637f86f6ef535b1 --- src/cpt-lib | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/cpt-lib') diff --git a/src/cpt-lib b/src/cpt-lib index 9f28197..70cf547 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -1433,20 +1433,25 @@ create_cache() { # # Create the required temporary directories and set the variables # which point to them. - mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \ - "${CPT_TMPDIR:=$cac_dir}" \ + mkdir -p "${CPT_TMPDIR:=$cac_dir}" \ "${mak_dir:=$CPT_TMPDIR/build-$pid}" \ "${pkg_dir:=$CPT_TMPDIR/pkg-$pid}" \ "${tar_dir:=$CPT_TMPDIR/extract-$pid}" \ - "${src_dir:=$cac_dir/sources}" \ - "${log_dir:=$cac_dir/logs}" \ - "${bin_dir:=$cac_dir/bin}" } main() { set -ef + # Create the cache directories for CPT and set the variables which point + # to them. This is seperate from temporary directories created in + # create_cache(). That's because we need these variables set on most + # occasions. + mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \ + "${src_dir:=$cac_dir/sources}" \ + "${log_dir:=$cac_dir/logs}" \ + "${bin_dir:=$cac_dir/bin}" + # Die here if the user has no set CPT_PATH. This is a rare occurance # as the environment variable should always be defined. [ "$CPT_PATH" ] || die "\$CPT_PATH needs to be set" -- cgit v1.2.3