1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-24 16:10:05 -07:00

kiss: Added user repository support.

This commit is contained in:
Dylan Araps 2019-06-13 19:40:50 +03:00
parent 8a1f9bfadf
commit 9f58e43220

32
kiss
View File

@ -18,8 +18,21 @@ source_type() {
[ -z "${1##*://*}" ] && return 5 [ -z "${1##*://*}" ] && return 5
} }
pkg_search() {
set -f
# shellcheck disable=2086,2046
set -- "$1" $(IFS=: find $KISS_PATH -maxdepth 1 -name "$1")
set +f
[ -z "$2" ] && die "Package '$1' not in any repository."
rep_dir=${2%/$1}
}
pkg_setup() { pkg_setup() {
cd "$rep_dir/$1" || die "Package '$1' not in repository." pkg_search "$1"
cd "$rep_dir/$1" || die "'$rep_dir/$1' not accessible"
[ -f sources ] || die "Sources file not found." [ -f sources ] || die "Sources file not found."
[ -x build ] || die "Build file not found or not executable." [ -x build ] || die "Build file not found or not executable."
@ -101,8 +114,6 @@ pkg_strip() {
esac esac
strip "$strip_opts" "$binary" strip "$strip_opts" "$binary"
echo "${binary##*/}: $(stat -c %f "$binary"): $strip_opts: $(file -bi "$binary")"
sleep 1
done done
} }
@ -183,7 +194,7 @@ args() {
r*) pkg_remove || die "Package '$name' not installed" ;; r*) pkg_remove || die "Package '$name' not installed" ;;
u*) pkg_updates ;; u*) pkg_updates ;;
*) log "$0 [b|c|i|l|r|u] [pkg]" \ *) log "${0##*/} [b|c|i|l|r|u] [pkg]" \
"build: Build a package." \ "build: Build a package." \
"checksum: Generate checksums." \ "checksum: Generate checksums." \
"install: Install a package (Runs build when needed)." \ "install: Install a package (Runs build when needed)." \
@ -198,13 +209,12 @@ main() {
[ -z "$KISS_PATH" ] && die "Set \$KISS_PATH to a repository location." [ -z "$KISS_PATH" ] && die "Set \$KISS_PATH to a repository location."
# mkdir -p "${src_dir:=$PWD/sources}" \ mkdir -p "${cac_dir:=${XDG_CACHE_HOME:=$HOME/.cache}/${0##*/}}" \
# "${mak_dir:=$PWD/build}" \ "${src_dir:=$cac_dir/sources}" \
# "${pkg_db:=${pkg_dir:=$PWD/pkg}/var/db/$0}" \ "${mak_dir:=$cac_dir/build}" \
# "${sys_db:=${sys_dir:=$KISS_ROOT}/var/db/$0}" \ "${bin_dir:=$cac_dir/bin}" \
# "${bin_dir:=$PWD/bin}" \ "${pkg_db:=${pkg_dir:=$cac_dir/pkg}/var/db/${0##*/}}" \
# "${rep_dir:=$PWD/repo}" || "${sys_db:=${sys_dir:=$KISS_ROOT}/var/db/${0##*/}}"
# die "Couldn't create directories at $PWD."
args "$@" args "$@"
} }