aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-25 20:56:40 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-02-25 20:56:40 +0000
commit3d8badd82230be192b90b50d6550e5f5cea87487 (patch)
tree16b2d922e0a2c5d7c2e4897077601daded403b7b /contrib
parentdccd4404c4ab677480c0fe0aed0f1d3b82e4210b (diff)
downloadcpt-3d8badd82230be192b90b50d6550e5f5cea87487.tar.gz
contrib: clean up
FossilOrigin-Name: 2ea8ee144f0d0cdaaa8c95a7fedf53d7a3fc8e305ed99d51639a7f4450e475ed
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/kiss-chbuild1
-rwxr-xr-xcontrib/kiss-depends10
-rwxr-xr-xcontrib/kiss-depends-finder46
-rwxr-xr-xcontrib/kiss-export30
-rwxr-xr-xcontrib/kiss-manifest10
-rwxr-xr-xcontrib/kiss-manifest-tree8
-rwxr-xr-xcontrib/kiss-orphans8
-rwxr-xr-xcontrib/kiss-reset19
8 files changed, 40 insertions, 92 deletions
diff --git a/contrib/kiss-chbuild b/contrib/kiss-chbuild
index 9514d29..28a1544 100755
--- a/contrib/kiss-chbuild
+++ b/contrib/kiss-chbuild
@@ -8,6 +8,7 @@ log() {
clean() {
log "Destroying chroot"
+
su -c "rm -rf chroot-$pid" || clean
}
diff --git a/contrib/kiss-depends b/contrib/kiss-depends
index 22a1d4e..185a80b 100755
--- a/contrib/kiss-depends
+++ b/contrib/kiss-depends
@@ -2,12 +2,8 @@
#
# kiss-depends - Display a package's dependencies.
-db_dir=$KISS_ROOT/var/db/kiss/installed/${1-null}
+kiss l "${1:-null}" >/dev/null
-# Check if package is installed and exit if it is not.
-[ -d "$db_dir" ] || {
- printf '%s\n' "error: '$1' not installed." >&2
- exit 1
-}
+db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
-[ -f "$db_dir/depends" ] && cat "$db_dir/depends"
+cat "$db_dir/depends" 2>/dev/null
diff --git a/contrib/kiss-depends-finder b/contrib/kiss-depends-finder
deleted file mode 100755
index 3a7f88b..0000000
--- a/contrib/kiss-depends-finder
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/sh -e
-#
-# Find missing dependencies by parsing 'ldd'.
-
-db_dir=$KISS_ROOT/var/db/kiss/installed
-
-# Check if package is installed and exit if it is not.
-[ -d "$db_dir/${1-null}" ] || {
- printf '%s\n' "error: '$1' not installed." >&2
- exit 1
-}
-
-printf '%s\n' "=> Detected dependencies:"
-
-while read -r file; do
- # Skip directories.
- [ -d "$KISS_ROOT/$file" ] && continue
-
- ldd "$KISS_ROOT/$file" 2>/dev/null | while read -r dep; do
- # Skip lines containing 'ldd'.
- [ "${dep##*ldd*}" ] || continue
-
- # Extract the file path from 'ldd' output.
- dep=${dep#* => }
- dep=${dep% *}
-
- # Traverse symlinks to get the true path to the file.
- pkg=$(readlink -f "$KISS_ROOT/${dep##$KISS_ROOT}")
-
- # Figure out which package owns the file.
- pkg=$(grep -lFx "${pkg##$KISS_ROOT}" "$db_dir/"*/manifest)
- pkg=${pkg%/*}
- pkg=${pkg##*/}
-
- case $pkg in
- # Skip listing these packages as dependencies.
- musl|gcc|$1) ;;
- *) printf '%s\n' "$pkg" ;;
- esac
- done &
-done < "$db_dir/$1/manifest" | sort | uniq
-
-printf '\n%s\n' "=> Package dependencies:"
-
-[ -f "$db_dir/$1/depends" ] &&
- cat "$db_dir/$1/depends"
diff --git a/contrib/kiss-export b/contrib/kiss-export
index e8da80f..dd5dedd 100755
--- a/contrib/kiss-export
+++ b/contrib/kiss-export
@@ -2,16 +2,22 @@
#
# kiss-export - Turn an installed package into a KISS tarball.
-read -r ver rel 2>/dev/null < "$KISS_ROOT/var/db/kiss/installed/$1/version" || {
- printf '%s\n' "error: '$1' is not installed." >&2
- exit 1
-}
+kiss l "${1:-null}" >/dev/null
-# This warning is safe to ignore as globs are disabled and
-# word splitting is intentional.
-# shellcheck disable=2046
-tar czvf "$1#$ver-$rel.tar.gz" -C / -- $(
- while read -r file; do
- [ -d "$KISS_ROOT/$file" ] || printf '%s\n' ".$file"
- done < "$KISS_ROOT/var/db/kiss/installed/$1/manifest"
-)
+# Grab the package's version..
+read -r ver rel 2>/dev/null < \
+ "$KISS_ROOT/var/db/kiss/installed/$1/version"
+
+# Reset the argument list.
+pkg=$1
+set --
+
+# Construct the argument list using each file.
+while read -r file || [ "$file" ]; do
+ [ -d "$KISS_ROOT/$file" ] || set -- "$@" ".$file"
+done < "$KISS_ROOT/var/db/kiss/installed/$pkg/manifest"
+
+# Turn the list of files back into a package.
+tar czf "$pkg#$ver-$rel.tar.gz" -C / -- "$@"
+
+printf 'tarball created in %s\n' "$PWD/$pkg#$ver-$rel.tar.gz"
diff --git a/contrib/kiss-manifest b/contrib/kiss-manifest
index 74cd380..39a01d9 100755
--- a/contrib/kiss-manifest
+++ b/contrib/kiss-manifest
@@ -2,12 +2,8 @@
#
# kiss-manifest - Display all files owned by a package.
-db_dir=$KISS_ROOT/var/db/kiss/installed/${1-null}
+kiss l "${1:-null}" >/dev/null
-# Check if package is installed and exit if it is not.
-[ -d "$db_dir" ] || {
- printf '%s\n' "error: '$1' not installed." >&2
- exit 1
-}
+db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
-cat "$db_dir/manifest"
+cat "$db_dir/manifest" 2>/dev/null
diff --git a/contrib/kiss-manifest-tree b/contrib/kiss-manifest-tree
index 995af9d..7fcfb8c 100755
--- a/contrib/kiss-manifest-tree
+++ b/contrib/kiss-manifest-tree
@@ -2,13 +2,9 @@
#
# kiss-manifest-tree - Display all files owned by a package.
-db_dir=$KISS_ROOT/var/db/kiss/installed/${1-null}
+kiss l "${1:-null}"
-# Check if package is installed and exit if it is not.
-[ -d "$db_dir" ] || {
- printf '%s\n' "error: '$1' not installed." >&2
- exit 1
-}
+db_dir=$KISS_ROOT/var/db/kiss/installed/${1:-null}
printf '%s\n' "[$1]:"
tree -C --fromfile "$db_dir/manifest" | tail -n +2
diff --git a/contrib/kiss-orphans b/contrib/kiss-orphans
index a1f0894..ff9530d 100755
--- a/contrib/kiss-orphans
+++ b/contrib/kiss-orphans
@@ -5,12 +5,10 @@
cd "$KISS_ROOT/var/db/kiss/installed/"
for pkg in *; do
- # Skip these packages.
case $pkg in
- baseinit|baselayout|gcc|pkgconf|e2fsprogs|\
- make|busybox|bzip2|grub|automake)
- continue
- ;;
+ baseinit|baselayout|gcc|pkgconf|e2fsprogs|musl|\
+ make|busybox|bzip2|grub|automake|kiss|rsync|git)
+ continue
esac
grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg"
diff --git a/contrib/kiss-reset b/contrib/kiss-reset
index d3ca11b..9845109 100755
--- a/contrib/kiss-reset
+++ b/contrib/kiss-reset
@@ -5,16 +5,17 @@
#
# kiss-reset: Remove all packages except for the base.
-set -- \
- $(kiss l | while read -r pkg _; do
- case $pkg in
- baselayout|binutils|bison|busybox|bzip2|curl|flex|gcc|git|\
- gzip|kiss|libelf|libressl|linux-headers|m4|make|mandoc|musl|\
- perl|pkgconf|rsync|xz|zlib) ;;
+set --
- *) printf '%s\n' "$pkg" ;;
- esac
- done)
+kiss l | while read -r pkg _; do
+ case $pkg in
+ baselayout|binutils|bison|busybox|bzip2|curl|flex|gcc|git|\
+ gzip|kiss|libelf|libressl|linux-headers|m4|make|musl|perl|\
+ pkgconf|rsync|xz|zlib) ;;
+
+ *) set -- "$@" "$pkg" ;;
+ esac
+done
[ "$1" ] && {
printf 'WARNING: This will remove \033[1m%s\033[m package(s).\n' "$#"