aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cpt-lib15
1 files changed, 10 insertions, 5 deletions
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"