aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/kiss-cargo-urlgen11
-rwxr-xr-xcontrib/kiss-chroot4
-rwxr-xr-xcontrib/kiss-depends-finder2
-rwxr-xr-xcontrib/kiss-export2
-rwxr-xr-xcontrib/kiss-fork17
-rwxr-xr-xcontrib/kiss-link45
-rwxr-xr-xcontrib/kiss-reset10
7 files changed, 83 insertions, 8 deletions
diff --git a/contrib/kiss-cargo-urlgen b/contrib/kiss-cargo-urlgen
new file mode 100755
index 0000000..ba14aa9
--- /dev/null
+++ b/contrib/kiss-cargo-urlgen
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+[ "$1" ] || {
+ printf 'usage: kiss-carg-urlgen [crate-ver] [crate-ver]\n'
+ exit 1
+}
+
+for crate in "$@"; do
+ printf 'https://static.crates.io/crates/%s/%s.crate vendor\n' \
+ "${crate%-*}" "$crate"
+done
diff --git a/contrib/kiss-chroot b/contrib/kiss-chroot
index c89271a..71bfbb2 100755
--- a/contrib/kiss-chroot
+++ b/contrib/kiss-chroot
@@ -48,8 +48,8 @@ main() {
SHELL=/bin/sh \
USER=root \
KISS_ASROOT=1 \
- CFLAGS="-march=x86-64 -mtune=generic -pipe -Os" \
- CXXFLAGS="-march=x86-64 -mtune=generic -pipe -Os" \
+ CFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
+ CXXFLAGS="${2:--march=x86-64 -mtune=generic -pipe -Os}" \
MAKEFLAGS="-j$(nproc 2>/dev/null || echo 1)" \
/bin/sh -l
}
diff --git a/contrib/kiss-depends-finder b/contrib/kiss-depends-finder
index 32b2b17..432a105 100755
--- a/contrib/kiss-depends-finder
+++ b/contrib/kiss-depends-finder
@@ -9,7 +9,7 @@ grep=$(command -v ggrep) || grep='grep'
printf '=> Detected dependencies:\n'
-while read -r file || [ "$file" ]; do
+while read -r file; do
[ -d "$KISS_ROOT/$file" ] && continue
ldd "$KISS_ROOT/$file" 2>/dev/null | while read -r dep; do
diff --git a/contrib/kiss-export b/contrib/kiss-export
index dd5dedd..f8add7c 100755
--- a/contrib/kiss-export
+++ b/contrib/kiss-export
@@ -13,7 +13,7 @@ pkg=$1
set --
# Construct the argument list using each file.
-while read -r file || [ "$file" ]; do
+while read -r file; do
[ -d "$KISS_ROOT/$file" ] || set -- "$@" ".$file"
done < "$KISS_ROOT/var/db/kiss/installed/$pkg/manifest"
diff --git a/contrib/kiss-fork b/contrib/kiss-fork
new file mode 100755
index 0000000..6e1245c
--- /dev/null
+++ b/contrib/kiss-fork
@@ -0,0 +1,17 @@
+#!/bin/sh -ef
+
+kiss s "${1:-null}" >/dev/null || {
+ printf 'usage: kiss-fork pkg_name\n'
+ exit 1
+}
+
+# Disable this warning as globbing is disabled and word splitting
+# is intentional. This grabs the location of the package's files.
+# shellcheck disable=2046
+(
+ set -- $(kiss s "$1")
+
+ cp -r "$1" .
+)
+
+printf 'forked package to %s\n' "$PWD/$1"
diff --git a/contrib/kiss-link b/contrib/kiss-link
new file mode 100755
index 0000000..9412917
--- /dev/null
+++ b/contrib/kiss-link
@@ -0,0 +1,45 @@
+#!/bin/sh -ef
+
+[ "$1" ] || {
+ printf 'usage: kiss-link file\n'
+ exit 1
+}
+
+[ -f "${file:=$1}" ] || {
+ printf 'file %s does not exist in the current directory\n' "$1"
+ exit 1
+}
+
+oPWD=$PWD
+
+# Check if the package exists in a repository and error out here
+# if it does not. The error message from the package manager will
+# be displayed.
+kiss s "${PWD##*/}" >/dev/null
+
+# Disable this warning as globbing is disabled and word splitting
+# is intentional. This grabs the location of the package's files.
+# shellcheck disable=2046
+{
+ # Generate a list of repositories in which the package
+ # exists. Then 'cd' to the first found directory to do a
+ # comparison.
+ set -- $(kiss s "${PWD##*/}"); cd "$1"
+
+ # Error if the package exists nowhere but the current
+ # directory and this script would create a broken symlink.
+ [ -z "$2" ] && [ "$PWD" = "$oPWD" ] && {
+ printf 'error: cannot symlink file to itself\n'
+ exit 1
+ }
+
+ # If the first repository in '$KISS_PATH' is the current
+ # directory, use the second repository in the list.
+ [ "$PWD" = "$oPWD" ] && shift
+
+ # Finally, make the link to the file in whatever repository
+ # it was found in.
+ ln -sf "$1/$file" "$file"
+}
+
+printf 'linked %s to %s\n' "$file" "$1"
diff --git a/contrib/kiss-reset b/contrib/kiss-reset
index 9845109..aee6547 100755
--- a/contrib/kiss-reset
+++ b/contrib/kiss-reset
@@ -7,15 +7,17 @@
set --
-kiss l | while read -r pkg _; do
+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) ;;
+ gzip|kiss|libressl|linux-headers|m4|make|musl|pkgconf|rsync|\
+ xz|zlib) ;;
*) set -- "$@" "$pkg" ;;
esac
-done
+done <<EOF
+$(kiss l)
+EOF
[ "$1" ] && {
printf 'WARNING: This will remove \033[1m%s\033[m package(s).\n' "$#"