mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-22 23:20:06 -07:00
kiss: Unify usage outputs for all contrib scripts.
Seeing as how these utilities are now better integrated, more effort should go into the overall interface between what should be the "benchmark" or example kiss scripts.
This commit is contained in:
parent
fdf2775640
commit
6786d2ca0a
@ -12,7 +12,7 @@ clean() {
|
||||
}
|
||||
|
||||
pid=$$
|
||||
url=https://github.com/kisslinux/repo/releases/download/1.9.0/
|
||||
url=https://github.com/kisslinux/repo/releases/download/1.9.11/
|
||||
|
||||
cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}"
|
||||
|
||||
@ -23,7 +23,7 @@ cd "${cac_dir:=$KISS_ROOT${XDG_CACHE_HOME:-$HOME/.cache}/kiss}"
|
||||
|
||||
[ -d kiss-chroot ] || {
|
||||
log "Extracting chroot"
|
||||
tar xvf kiss-chroot.tar.xz
|
||||
tar xf kiss-chroot.tar.xz
|
||||
}
|
||||
|
||||
log "Creating temporary chroot"
|
||||
|
@ -1,8 +1,11 @@
|
||||
#!/bin/sh -ef
|
||||
# Display a package's dependencies.
|
||||
|
||||
kiss l "${1:-null}" >/dev/null
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-depends [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
|
||||
|
||||
cat "$db_dir/depends" 2>/dev/null
|
||||
cat "$KISS_ROOT/var/db/kiss/installed/$1/depends" 2>/dev/null
|
||||
|
@ -1,7 +1,12 @@
|
||||
#!/bin/sh -e
|
||||
# Find missing dependencies by parsing 'ldd'.
|
||||
|
||||
kiss l "${1:-null}" >/dev/null
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-depends-finder [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
db_dir=$KISS_ROOT/var/db/kiss/installed
|
||||
grep=$(command -v ggrep) || grep='grep'
|
||||
@ -29,7 +34,7 @@ while read -r file; do
|
||||
|
||||
# Skip listing these packages as dependencies.
|
||||
case $pkg in
|
||||
musl|gcc|$1) ;;
|
||||
musl|gcc|"$1") ;;
|
||||
*) printf '%s\n' "$pkg" ;;
|
||||
esac
|
||||
done
|
||||
|
@ -1,11 +1,15 @@
|
||||
#!/bin/sh -ef
|
||||
# Turn an installed package into a KISS tarball.
|
||||
|
||||
kiss l "${1:-null}" >/dev/null
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-export [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Grab the package's version..
|
||||
read -r ver rel 2>/dev/null < \
|
||||
"$KISS_ROOT/var/db/kiss/installed/$1/version"
|
||||
read -r ver rel 2>/dev/null < "$KISS_ROOT/var/db/kiss/installed/$1/version"
|
||||
|
||||
# Reset the argument list.
|
||||
pkg=$1
|
||||
|
@ -1,8 +1,10 @@
|
||||
#!/bin/sh -ef
|
||||
# Copy a package's repository files into the current directory.
|
||||
|
||||
kiss s "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-fork pkg_name\n'
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss s "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-fork [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
#!/bin/sh -ef
|
||||
# Find the maintainer of a package.
|
||||
|
||||
[ "$1" ] || {
|
||||
printf 'usage: kiss-maintainer [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
kiss s "$1" | while read -r repo; do cd "$repo"
|
||||
m=$(git log -1 version 2>/dev/null) ||:
|
||||
m=${m##*Author: }
|
||||
|
@ -1,8 +1,11 @@
|
||||
#!/bin/sh -ef
|
||||
# Display all files owned by a package.
|
||||
|
||||
kiss l "${1:-null}" >/dev/null
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-manifest [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
|
||||
|
||||
cat "$db_dir/manifest" 2>/dev/null
|
||||
cat "$KISS_ROOT/var/db/kiss/installed/$1/manifest" 2>/dev/null
|
||||
|
@ -1,9 +1,12 @@
|
||||
#!/bin/sh -ef
|
||||
# Display all files owned by a package in a tree.
|
||||
|
||||
kiss l "${1:-null}"
|
||||
|
||||
db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-manifest-tree [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
printf '%s\n' "[$1]:"
|
||||
tree -C --fromfile "$db_dir/manifest" | tail -n +2
|
||||
tree -C --fromfile "$KISS_ROOT/var/db/kiss/installed/$1/manifest" | tail -n +2
|
||||
|
@ -5,9 +5,8 @@
|
||||
# follow symlinks.
|
||||
file=$(readlink -f "$KISS_ROOT/${1##$KISS_ROOT}")
|
||||
|
||||
# Check if the file exists and exit if it is not.
|
||||
[ -f "$file" ] || {
|
||||
printf '%s\n' "error: file '$1' doesn't exist." >&2
|
||||
printf 'usage: kiss-owns [/path/to/file]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,11 @@
|
||||
#!/bin/sh
|
||||
# Display a package's original dependencies.
|
||||
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss s "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-repodepends [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
cat "$(kiss s "$1")/depends" 2>/dev/null
|
||||
|
@ -1,6 +1,13 @@
|
||||
#!/bin/sh -e
|
||||
# Display packages which depend on package.
|
||||
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-revdepends [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 'cd' to the database directory as a simple way of
|
||||
# stripping the path and performing a 'basename'.
|
||||
cd "$KISS_ROOT/var/db/kiss/installed"
|
||||
|
@ -1,17 +1,16 @@
|
||||
#!/bin/sh -ef
|
||||
# Show the size on disk for a package.
|
||||
|
||||
db_dir=$KISS_ROOT/var/db/kiss/installed/${1-null}
|
||||
|
||||
# Check if package is installed and exit if it is not.
|
||||
[ -d "$db_dir" ] || {
|
||||
printf '%s\n' "error: '$1' not installed." >&2
|
||||
# Ignore shellcheck as we want the warning's behavior.
|
||||
# shellcheck disable=2015
|
||||
[ "$1" ] && kiss l "${1:-null}" >/dev/null || {
|
||||
printf 'usage: kiss-size [pkg]\n'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Filter directories from manifest and leave only files.
|
||||
# Directories in the manifest end in a trailing '/'.
|
||||
files=$(sed 's|.*/$||' "$db_dir/manifest")
|
||||
files=$(sed 's|.*/$||' "$KISS_ROOT/var/db/kiss/installed/$1/manifest")
|
||||
|
||||
# Send the file list to 'du'.
|
||||
# This unquoted variable is safe as word splitting is intended
|
||||
|
4
kiss
4
kiss
@ -115,7 +115,7 @@ pkg_find() {
|
||||
# Figure out which repository a package belongs to by
|
||||
# searching for directories matching the package name
|
||||
# in $KISS_PATH/*.
|
||||
query=$1 IFS=:; set --
|
||||
query=$1 all=$2 IFS=:; set --
|
||||
|
||||
# Both counts of word-splitting are intentional here.
|
||||
# Firstly to split the repositories and secondly to
|
||||
@ -137,7 +137,7 @@ pkg_find() {
|
||||
|
||||
# Show all search results if called from 'kiss search', else
|
||||
# print only the first match.
|
||||
[ -t 1 ] || [ "$2" ] && printf '%s\n' "$@" || printf '%s\n' "$1"
|
||||
[ -t 1 ] || [ "$all" ] && printf '%s\n' "$@" || printf '%s\n' "$1"
|
||||
}
|
||||
|
||||
pkg_list() {
|
||||
|
Loading…
Reference in New Issue
Block a user