aboutsummaryrefslogtreecommitdiff
path: root/src/cpt-lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpt-lib')
-rw-r--r--src/cpt-lib35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/cpt-lib b/src/cpt-lib
index eaf87cc..9f1a5b8 100644
--- a/src/cpt-lib
+++ b/src/cpt-lib
@@ -1420,6 +1420,25 @@ pkg_clean() {
"$CPT_TMPDIR/$pid-c" "$CPT_TMPDIR/$pid-m"
}
+create_cache() {
+ # A temporary directory can be specified apart from the cache
+ # directory in order to build in a user specified directory.
+ # /tmp could be used in order to build on ram, useful on SSDs.
+ # The user can specify CPT_TMPDIR for this.
+ #
+ # 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}" \
+ "${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
@@ -1489,22 +1508,6 @@ main() {
# Set a value for CPT_COMPRESS if it isn't set.
: "${CPT_COMPRESS:=gz}"
- # A temporary directory can be specified apart from the cache
- # directory in order to build in a user specified directory.
- # /tmp could be used in order to build on ram, useful on SSDs.
- # The user can specify CPT_TMPDIR for this.
- #
- # 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}" \
- "${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 "$@"