aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-12-21 09:49:03 +0000
committermerakor <cem@ckyln.com>2020-12-21 09:49:03 +0000
commit14233491c517f1d6e2456d29b35ae99db76a23ac (patch)
treef261183924bdf570b21d579d74b8a72d11763f33
parent1d9328af944d2f28978b8076709c7cf8e7e71703 (diff)
downloadcpt-14233491c517f1d6e2456d29b35ae99db76a23ac.tar.gz
create_cache(): new variable and argument changes
- If an argument is supplied to create_cache(), it will not create the default subdirectories (build/pkg/export). - create_cache() now also globally sets the $tmp_dir variable, which is the default directory + $pid variable Changes above do not affect the previous usage of the function, so it is not considered a breaking change. FossilOrigin-Name: 2eb5bc89e2e1c688186667af0d5177a1cdc3dc2e83e28e134752955c68a5c4e0
-rw-r--r--src/cpt-lib10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cpt-lib b/src/cpt-lib
index c75fbcf..8e4ef87 100644
--- a/src/cpt-lib
+++ b/src/cpt-lib
@@ -1763,10 +1763,12 @@ create_cache() {
#
# Create the required temporary directories and set the variables
# which point to them.
- mkdir -p "${CPT_TMPDIR:=$cac_dir/proc}" \
- "${mak_dir:=$CPT_TMPDIR/$pid/build}" \
- "${pkg_dir:=$CPT_TMPDIR/$pid/pkg}" \
- "${tar_dir:=$CPT_TMPDIR/$pid/export}"
+ mkdir -p "${tmp_dir:=${CPT_TMPDIR:=$cac_dir/proc}/$pid}"
+
+ # If an argument is given, skip the creation of other cache directories
+ [ "$1" ] || mkdir -p "${mak_dir:=$tmp_dir/build}" \
+ "${pkg_dir:=$tmp_dir/pkg}" \
+ "${tar_dir:=$tmp_dir/export}"
}