From adffb32537d8c1c6057101a34cb33fffc8316d08 Mon Sep 17 00:00:00 2001 From: merakor Date: Fri, 4 Sep 2020 08:00:49 +0000 Subject: src/: prefer the cpt-lib on the current directory. FossilOrigin-Name: ea0a950e2247b056b0594baddb184f99aa8e39f492fa50c968e904b9dd2e2aa7 --- src/cpt-alternatives | 3 +-- src/cpt-build | 3 +-- src/cpt-checksum | 3 +-- src/cpt-download | 3 +-- src/cpt-fetch | 3 +-- src/cpt-install | 1 - src/cpt-lib | 7 ++++++- src/cpt-list | 3 +-- src/cpt-remove | 3 +-- src/cpt-search | 3 +-- src/cpt-update | 3 +-- 11 files changed, 15 insertions(+), 20 deletions(-) diff --git a/src/cpt-alternatives b/src/cpt-alternatives index f0d2be0..e516730 100755 --- a/src/cpt-alternatives +++ b/src/cpt-alternatives @@ -1,8 +1,7 @@ #!/bin/sh -ef # List and swap to alternatives -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi case "$1" in --version|--help|-v|-h|'') ;; *) [ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || { diff --git a/src/cpt-build b/src/cpt-build index 5f73de8..edf59bb 100755 --- a/src/cpt-build +++ b/src/cpt-build @@ -1,8 +1,7 @@ #!/bin/sh # Build a package -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi parser_definition() { setup REST -- "usage: ${0##*/} [pkg...]" diff --git a/src/cpt-checksum b/src/cpt-checksum index 63a567b..0a83ae0 100755 --- a/src/cpt-checksum +++ b/src/cpt-checksum @@ -1,8 +1,7 @@ #!/bin/sh -ef # Generate checksums -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi case "$1" in --help|-h) out "usage: ${0##*/} [pkg...]"; exit 1 ;; diff --git a/src/cpt-download b/src/cpt-download index 19c4732..f558b86 100755 --- a/src/cpt-download +++ b/src/cpt-download @@ -1,8 +1,7 @@ #!/bin/sh -ef # Download sources for the given package -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi case "$1" in --help|-h) diff --git a/src/cpt-fetch b/src/cpt-fetch index 7d5be95..d75edd5 100755 --- a/src/cpt-fetch +++ b/src/cpt-fetch @@ -1,8 +1,7 @@ #!/bin/sh -ef # Fetch repositories -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi case "$1" in --help|-h) out "usage: ${0##*/}"; exit 1 ;; diff --git a/src/cpt-install b/src/cpt-install index 92d8eee..94058d8 100755 --- a/src/cpt-install +++ b/src/cpt-install @@ -1,7 +1,6 @@ #!/bin/sh # Install a package -# shellcheck disable=1091 if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi parser_definition() { diff --git a/src/cpt-lib b/src/cpt-lib index 8ef82c5..0460fcb 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -582,7 +582,7 @@ pkg_extract() { # Comment or blank line. \#*|'') continue ;; - # Only 'tar' an 'zip' archives are currently supported for + # Only 'tar', 'cpio', and 'zip' archives are currently supported for # extraction. Other filetypes are simply copied to '$mak_dir' # which allows for manual extraction. *://*.tar|*://*.tar.??|*://*.tar.???|*://*.tar.????|*://*.tgz|*://*.txz) @@ -639,6 +639,11 @@ pkg_extract() { rm -f .ktar ;; + *://*.cpio|*://*.cpio.??|*://*.cpio.???|*://*.cpio.????) + decompress "$src_dir/$1/${src##*/}" | cpio -i + + ;; + *://*.zip) unzip "$src_dir/$1/${src##*/}" || die "$1" "Couldn't extract ${src##*/}" diff --git a/src/cpt-list b/src/cpt-list index b808e74..5179dc5 100755 --- a/src/cpt-list +++ b/src/cpt-list @@ -1,8 +1,7 @@ #!/bin/sh -ef # List installed packages -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi case "$1" in --help|-h) out "usage: ${0##*/} [pkg...]"; exit 1 ;; diff --git a/src/cpt-remove b/src/cpt-remove index 5462b4b..53f0a1f 100755 --- a/src/cpt-remove +++ b/src/cpt-remove @@ -1,8 +1,7 @@ #!/bin/sh -ef # Remove a package -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi parser_definition() { setup REST -- "usage: ${0##*/} [pkg...]" diff --git a/src/cpt-search b/src/cpt-search index cc37d9a..dbb4eff 100755 --- a/src/cpt-search +++ b/src/cpt-search @@ -1,8 +1,7 @@ #!/bin/sh -ef # Search for a package -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi parser_definition() { setup REST -- "usage: ${0##*/} [pkg...]" diff --git a/src/cpt-update b/src/cpt-update index bbda066..39399c9 100755 --- a/src/cpt-update +++ b/src/cpt-update @@ -1,8 +1,7 @@ #!/bin/sh -ef # Check for updates -# shellcheck disable=1091 -if command -v cpt-lib >/dev/null; then . cpt-lib; else . ./cpt-lib; fi +if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi parser_definition() { setup REST -- "usage: ${0##*/} [options]" -- cgit v1.2.3