aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cpt-build2
-rwxr-xr-xsrc/cpt-download2
-rwxr-xr-xsrc/cpt-install2
-rw-r--r--src/cpt-lib.in19
-rwxr-xr-xsrc/cpt-remove2
5 files changed, 17 insertions, 10 deletions
diff --git a/src/cpt-build b/src/cpt-build
index 4eccbd1..03a33b7 100755
--- a/src/cpt-build
+++ b/src/cpt-build
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
create_cache
diff --git a/src/cpt-download b/src/cpt-download
index d2c9aeb..231e4bb 100755
--- a/src/cpt-download
+++ b/src/cpt-download
@@ -9,7 +9,7 @@ case "$1" in
exit 0
;;
--version|-v) version ;;
- '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
+ '') set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH"
esac
create_cache
diff --git a/src/cpt-install b/src/cpt-install
index 7b892ae..50911c8 100755
--- a/src/cpt-install
+++ b/src/cpt-install
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index e975885..da9925b 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -137,7 +137,7 @@ sepchar() {
# processes.
[ "$1" ] || return 0; str=$1; set --
while [ "$str" ]; do
- set -- "$@" "${str%${str#?}}"
+ set -- "$@" "${str%"${str#?}"}"
str=${str#?}
done
printf '%s\n' "$@"
@@ -845,7 +845,7 @@ pkg_extract() {
# VCS Repository
git+*|hg+*|fossil+*)
backend=${src%%+*}
- url=${src##${backend}+} com=${url##*[@#]} com=${com#${url%[@#]*}}
+ url=${src##"${backend}"+} com=${url##*[@#]} com=${com#"${url%[@#]*}"}
log "$1" "Cloning ${url%[#@]*}"
"pkg_vcs_clone_$backend" "${url%[#@]*}" "$com"
@@ -1394,7 +1394,7 @@ pkg_conflicts() {
# Combine the dirname and file values, and print them into the
# temporary manifest to be parsed.
- printf '%s/%s\n' "${dirname#$CPT_ROOT}" "${file##*/}"
+ printf '%s/%s\n' "${dirname#"$CPT_ROOT"}" "${file##*/}"
done < "$tar_dir/$1/$pkg_db/$1/manifest" > "$CPT_TMPDIR/$pid/manifest"
@@ -1516,15 +1516,22 @@ pkg_swap() {
# its manifest file to reflect this. We then resort this file
# so no issues arise when removing packages.
cp -Pf "$CPT_ROOT/$2" "$pkg_owns>${alt#*>}"
- sed "s#^$(regesc "$2")\$#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \
+ sed "s#^$(regesc "$2")\$#${PWD#"$CPT_ROOT"}/$pkg_owns>${alt#*>}#" \
"../installed/$pkg_owns/manifest" |
sort -r -o "../installed/$pkg_owns/manifest"
+ else
+ # If the file doesn't exist, we assume that there was a previous owner,
+ # but the package was then removed. We want the message to be short
+ # and clear, I thought of writing "Swapping [...] from 'null' to '$1'",
+ # but that would probably sound more like a package manager bug. Instead
+ # we are printing the message below which should be informative enough.
+ log "Installing '$2' from '$1'"
fi
# Convert the desired alternative to a real file and rewrite
# the manifest file to reflect this. The reverse of above.
mv -f "$alt" "$CPT_ROOT/$2"
- sed "s#^${PWD#$CPT_ROOT}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" |
+ sed "s#^${PWD#"$CPT_ROOT"}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" |
sort -r -o "../installed/$1/manifest"
}
@@ -1769,7 +1776,7 @@ pkg_repository_update() {
# Function to update the given package repository.
cd "$1"
repo_type=$(pkg_vcs_info)
- repo_root=${repo_type#$PWD:}
+ repo_root=${repo_type#"$PWD":}
repo_type=${repo_type##*:} repo_root=${repo_root%:*}
contains "$repos" "$repo_root" || {
repos="$repos $repo_root "
diff --git a/src/cpt-remove b/src/cpt-remove
index befdfcc..f5a5abf 100755
--- a/src/cpt-remove
+++ b/src/cpt-remove
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"