mirror of
https://github.com/The-Repo-Club/DotFiles.git
synced 2024-11-28 10:18:46 -05:00
Update Kiss Package Manager
Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
This commit is contained in:
parent
127f414edb
commit
982ca2f2dc
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -ef
|
||||||
# Enter a kiss chroot
|
# Enter a kiss chroot
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
@ -16,8 +16,8 @@ run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clean() {
|
clean() {
|
||||||
log Unmounting host paths; {
|
log Unmounting host filesystems; {
|
||||||
run umount "$1/dev/shm" 2>/dev/null
|
run umount "$1/dev/shm"
|
||||||
run umount "$1/dev/pts"
|
run umount "$1/dev/pts"
|
||||||
run umount "$1/dev"
|
run umount "$1/dev"
|
||||||
run umount "$1/proc"
|
run umount "$1/proc"
|
||||||
@ -25,7 +25,10 @@ clean() {
|
|||||||
run umount "$1/sys/firmware/efi/efivars" 2>/dev/null
|
run umount "$1/sys/firmware/efi/efivars" 2>/dev/null
|
||||||
run umount "$1/sys"
|
run umount "$1/sys"
|
||||||
run umount "$1/tmp"
|
run umount "$1/tmp"
|
||||||
run umount "$1/etc/resolv.conf"
|
}
|
||||||
|
|
||||||
|
log Cleaning leftover host files; {
|
||||||
|
run rm -f "$1/etc/resolv.conf"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,18 +62,19 @@ main() {
|
|||||||
|
|
||||||
trap 'clean "${1%"${1##*[!/]}"}"' EXIT INT
|
trap 'clean "${1%"${1##*[!/]}"}"' EXIT INT
|
||||||
|
|
||||||
log Mounting host paths; {
|
log Mounting host filesystems; {
|
||||||
mmount "$1/dev" -o bind /dev
|
mmount "$1/dev" -o bind /dev
|
||||||
mmount "$1/dev/pts" -o bind /dev/pts
|
mmount "$1/dev/pts" -o bind /dev/pts
|
||||||
mmount "$1/dev/shm" -t tmpfs shmfs 2>/dev/null
|
mmount "$1/dev/shm" -t tmpfs shmfs
|
||||||
mmount "$1/proc" -t proc proc
|
mmount "$1/proc" -t proc proc
|
||||||
mmount "$1/run" -t tmpfs tmpfs
|
mmount "$1/run" -t tmpfs tmpfs
|
||||||
mmount "$1/sys" -t sysfs sys
|
mmount "$1/sys" -t sysfs sys
|
||||||
mmount "$1/sys/firmware/efi/efivars" -t efivarfs efivarfs 2>/dev/null
|
mmount "$1/sys/firmware/efi/efivars" -t efivarfs efivarfs 2>/dev/null
|
||||||
mmount "$1/tmp" -o mode=1777,nosuid,nodev -t tmpfs tmpfs
|
mmount "$1/tmp" -o mode=1777,nosuid,nodev -t tmpfs tmpfs
|
||||||
|
}
|
||||||
|
|
||||||
touch "$1/etc/resolv.conf"
|
log Copying /etc/resolv.conf from host; {
|
||||||
mmount "$1/etc/resolv.conf" -o bind /etc/resolv.conf
|
run cp -f /etc/resolv.conf "$1/etc"
|
||||||
}
|
}
|
||||||
|
|
||||||
log Entering chroot; {
|
log Entering chroot; {
|
||||||
@ -86,7 +90,7 @@ main() {
|
|||||||
CXXFLAGS="${CXXFLAGS:--march=x86-64 -mtune=generic -pipe -O2}" \
|
CXXFLAGS="${CXXFLAGS:--march=x86-64 -mtune=generic -pipe -O2}" \
|
||||||
MAKEFLAGS="${MAKEFLAGS:--j$(nproc 2>/dev/null || echo 1)}" \
|
MAKEFLAGS="${MAKEFLAGS:--j$(nproc 2>/dev/null || echo 1)}" \
|
||||||
/bin/sh -l
|
/bin/sh -l
|
||||||
} || die chroot failed
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$1"
|
main "$1"
|
||||||
|
33
localbin/.local/bin/kiss/kiss-export
Executable file
33
localbin/.local/bin/kiss/kiss-export
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh -ef
|
||||||
|
# Turn an installed package into a KISS tarball
|
||||||
|
|
||||||
|
db=$KISS_ROOT/var/db/kiss/installed
|
||||||
|
pkg=${1:-"${PWD##*/}"}
|
||||||
|
|
||||||
|
kiss list "$pkg" >/dev/null || {
|
||||||
|
printf 'usage: kiss-export [pkg]\n'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
read -r ver rel 2>/dev/null < "$db/$1/version"
|
||||||
|
|
||||||
|
set --
|
||||||
|
|
||||||
|
while read -r file; do
|
||||||
|
[ -d "$KISS_ROOT/$file" ] || set -- "$@" ".$file"
|
||||||
|
done < "$db/$pkg/manifest"
|
||||||
|
|
||||||
|
cd "$KISS_ROOT/"
|
||||||
|
|
||||||
|
dest="$OLDPWD/$pkg@$ver-$rel.tar.${KISS_COMPRESS:-gz}"
|
||||||
|
|
||||||
|
tar cf - "$@" | case ${KISS_COMPRESS:-gz} in
|
||||||
|
bz2) bzip2 -z ;;
|
||||||
|
gz) gzip -6 ;;
|
||||||
|
lzma) lzma -z ;;
|
||||||
|
lz) lzip -z ;;
|
||||||
|
xz) xz -zT 0 ;;
|
||||||
|
zst) zstd -z ;;
|
||||||
|
esac > "$dest"
|
||||||
|
|
||||||
|
printf 'created %s\n' "$dest"
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -ef
|
||||||
# Read KISS documentation
|
# Read KISS documentation
|
||||||
|
|
||||||
cd "$KISS_ROOT/usr/share/doc/kiss" 2>/dev/null || {
|
cd "$KISS_ROOT/usr/share/doc/kiss" 2>/dev/null || {
|
||||||
@ -6,35 +6,23 @@ cd "$KISS_ROOT/usr/share/doc/kiss" 2>/dev/null || {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_q=$1
|
! [ -f "${1:-.}/index.txt" ] || file=./${1:-.}/index.txt
|
||||||
|
! [ -f "${1:-.}.txt" ] || file=./${1:-.}.txt
|
||||||
! [ -f "${_q:-.}/index.txt" ] || file=./${_q:-.}/index.txt
|
! [ -f "${1:-:}" ] || file=./${1:-.}
|
||||||
! [ -f "${_q:-.}.txt" ] || file=./${_q:-.}.txt
|
|
||||||
! [ -f "${_q:-:}" ] || file=./${_q:-.}
|
|
||||||
|
|
||||||
# Fallback to package READMEs.
|
|
||||||
# False positive, intended behavior.
|
|
||||||
# shellcheck disable=2046
|
|
||||||
[ "$file" ] || {
|
|
||||||
set -f
|
|
||||||
set +f -- $(kiss s "${_q##*/}")
|
|
||||||
file=${1:+"$1/README"}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Fallback to search (allows 'kiss help firefox' to work).
|
# Fallback to search (allows 'kiss help firefox' to work).
|
||||||
# False positive, intended behavior.
|
# False positive, intended behavior.
|
||||||
# shellcheck disable=2046
|
# shellcheck disable=2046
|
||||||
[ "$file" ] || {
|
[ "$file" ] || {
|
||||||
set -f
|
set -f
|
||||||
set +f -- $(find . -name "${_q##*/}.txt")
|
set +f -- $(find . -name "${1##*/}.txt")
|
||||||
file=$1
|
file=$1
|
||||||
}
|
}
|
||||||
|
|
||||||
: "${file:=404.txt}"
|
: "${file:=404.txt}"
|
||||||
|
|
||||||
cat <<EOF - "$file" | "${PAGER:-less}"
|
cat <<EOF - "$file" | "${PAGER:-less}"
|
||||||
Reading ${file#./}
|
Reading $PWD/${file#./}
|
||||||
________________________________________________________________________________
|
________________________________________________________________________________
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -ef
|
||||||
# Create a boilerplate package
|
# Create a boilerplate package
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
|
@ -1,41 +1,16 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -ef
|
||||||
# List orphaned packages
|
# List orphaned packages
|
||||||
|
|
||||||
n='
|
cd "$KISS_ROOT/var/db/kiss/installed/"
|
||||||
'
|
|
||||||
|
|
||||||
cd "$KISS_ROOT/var/db/kiss/installed"
|
for pkg in *; do
|
||||||
set -- *
|
case $pkg in
|
||||||
|
# Exemptions for orphans which aren't really
|
||||||
l=$n$(
|
# orphans. Exclude them from the list.
|
||||||
for pkg do shift
|
baseinit|baselayout|gcc|e2fsprogs|musl|\
|
||||||
set -- "$@" -e "$pkg"
|
make|busybox|bzip2|grub|kiss|git)
|
||||||
done
|
continue
|
||||||
|
|
||||||
# Get a list of non-orphans.
|
|
||||||
grep -Fx "$@" -- */depends |
|
|
||||||
|
|
||||||
{
|
|
||||||
# Strip filename.
|
|
||||||
sed s,.\*/depends:,,
|
|
||||||
|
|
||||||
# Exclude packages which are not really orphans.
|
|
||||||
printf '%s\n' baseinit baselayout busybox bzip2 e2fsprogs gcc \
|
|
||||||
git grub kiss make musl
|
|
||||||
} |
|
|
||||||
|
|
||||||
# Remove duplicates.
|
|
||||||
sort -u
|
|
||||||
)$n
|
|
||||||
|
|
||||||
# Generate the list of orphans by finding the inverse of the non-orphan list.
|
|
||||||
for pkg do shift
|
|
||||||
case $l in (*"$n$pkg$n"*)
|
|
||||||
continue
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
set -- "$@" "$pkg"
|
grep -q "^$pkg$" ./*/depends || printf '%s\n' "$pkg"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf '%s\n' "$@"
|
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh -ef
|
||||||
# Check repository for outdated packages
|
# Check repository for outdated packages
|
||||||
|
|
||||||
die() {
|
repology_version() {
|
||||||
printf '%s\n' "$*" >&2
|
# Grab the package's version as known by repology.org by downloading the
|
||||||
exit 1
|
# svg latest-version badge and extracting the version from the xml.
|
||||||
}
|
repology_name "$1"
|
||||||
|
|
||||||
mkcd() {
|
r=$(curl -Ss "https://repology.org/badge/latest-versions/$remote.svg") && {
|
||||||
mkdir -p "$1" && cd "$1"
|
remote_ver=${r%</text>*}
|
||||||
|
remote_ver=${remote_ver##*>}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repology_name() {
|
repology_name() {
|
||||||
@ -17,10 +19,11 @@ repology_name() {
|
|||||||
remote=${1%%-bin}
|
remote=${1%%-bin}
|
||||||
remote=${remote%%-git}
|
remote=${remote%%-git}
|
||||||
|
|
||||||
|
printf %s "$remote" |
|
||||||
|
|
||||||
# Remote names are all lowercase.
|
# Remote names are all lowercase.
|
||||||
tr '[:upper:]' '[:lower:]' <<EOF |
|
tr '[:upper:]' '[:lower:]' |
|
||||||
$remote
|
|
||||||
EOF
|
|
||||||
# Remote always uses -.
|
# Remote always uses -.
|
||||||
tr _ -
|
tr _ -
|
||||||
)
|
)
|
||||||
@ -68,10 +71,6 @@ EOF
|
|||||||
remote=fonts:fontawesome
|
remote=fonts:fontawesome
|
||||||
;;
|
;;
|
||||||
|
|
||||||
foot-pgo)
|
|
||||||
remote=foot
|
|
||||||
;;
|
|
||||||
|
|
||||||
gc)
|
gc)
|
||||||
remote=boehm-gc
|
remote=boehm-gc
|
||||||
;;
|
;;
|
||||||
@ -129,10 +128,6 @@ EOF
|
|||||||
remote=${remote##lib}
|
remote=${remote##lib}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
libseat)
|
|
||||||
remote=seatd
|
|
||||||
;;
|
|
||||||
|
|
||||||
links2)
|
links2)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=links
|
remote=links
|
||||||
@ -207,10 +202,6 @@ EOF
|
|||||||
remote=st-term
|
remote=st-term
|
||||||
;;
|
;;
|
||||||
|
|
||||||
sway-no-seat | sway-tiny)
|
|
||||||
remote=sway
|
|
||||||
;;
|
|
||||||
|
|
||||||
terminus-font)
|
terminus-font)
|
||||||
remote=fonts:terminus
|
remote=fonts:terminus
|
||||||
;;
|
;;
|
||||||
@ -239,70 +230,60 @@ EOF
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
repology_version() {
|
main() {
|
||||||
[ -f "$1.svg" ] || return 1
|
printf '\n[Checking Repology for outdated packages in %s]\n\n' "${1%%/}" >&2
|
||||||
read -r remote_ver < "$1.svg" || :
|
|
||||||
remote_ver=${remote_ver%</text>*}
|
|
||||||
remote_ver=${remote_ver##*>}
|
|
||||||
}
|
|
||||||
|
|
||||||
repo_version() {
|
|
||||||
read -r ver _ 2>/dev/null < "$2/version" || {
|
|
||||||
printf '%-30s local version not found\n' "$1" >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
[ "$ver" != git ]
|
|
||||||
}
|
|
||||||
|
|
||||||
get_outdated() {
|
|
||||||
repo=${repo%%/}
|
|
||||||
printf '\n[Checking Repology for outdated packages in %s]\n\n' "$repo" >&2
|
|
||||||
|
|
||||||
for pkg in */; do
|
for pkg in */; do
|
||||||
pkg=${pkg%%/}
|
pkg=${pkg%%/}
|
||||||
repology_name "${pkg##*/}"
|
|
||||||
|
|
||||||
[ "$remote" = - ] ||
|
read -r ver _ 2>/dev/null < "$pkg/version" || {
|
||||||
set -- "$@" -z "$remote.svg" \
|
printf '%-30s local version not found\n' "$pkg" >&2
|
||||||
"https://repology.org/badge/latest-versions/$remote.svg"
|
|
||||||
done
|
|
||||||
|
|
||||||
mkcd "$tmp/${repo##*/}"
|
|
||||||
|
|
||||||
curl -SsZ --parallel-max 16 --remote-name-all "$@" ||
|
|
||||||
die 'fatal: network error'
|
|
||||||
|
|
||||||
for _pkg in "$OLDPWD"/*/; do
|
|
||||||
pkg=${_pkg%%/}
|
|
||||||
pkg=${pkg##*/}
|
|
||||||
|
|
||||||
repo_version "$pkg" "$_pkg" || continue
|
|
||||||
repology_name "$pkg"
|
|
||||||
repology_version "$remote" || continue
|
|
||||||
|
|
||||||
case $remote_ver in *", $ver"* | *"$ver,"* | "$ver" | - | '')
|
|
||||||
continue
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
[ "$ver" = git ] &&
|
||||||
|
continue
|
||||||
|
|
||||||
|
repology_version "$pkg" || {
|
||||||
|
printf '%-30s network error\n' "$pkg" >&2
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
case $remote_ver in
|
||||||
|
*", $ver"* | *"$ver,"* | "$ver")
|
||||||
|
# Package up-to-date, do nothing.
|
||||||
|
;;
|
||||||
|
|
||||||
|
'' | ' ')
|
||||||
|
printf '\n%s: empty response\n' "$pkg" >&2
|
||||||
|
printf 'possible causes:\n' >&2
|
||||||
|
printf ' package name differs from repology name,\n' >&2
|
||||||
|
printf ' package not tracked by repology,\n' >&2
|
||||||
|
printf ' network error\n\n' >&2
|
||||||
|
;;
|
||||||
|
|
||||||
|
'-')
|
||||||
|
# No version scheme, do nothing.
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
printf '%-30s %s -> %s\n' "$pkg" "$ver" "$remote_ver"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf '%-30s %s -> %s\n' "$pkg" "$ver" "$remote_ver"
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
for repo do
|
||||||
set -e
|
[ "$repo" ] || {
|
||||||
|
printf 'usage: kiss outdated /path/to/repo\n' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
[ "$1" ] ||
|
cd "$repo" 2>/dev/null || {
|
||||||
die 'usage: kiss [ou]tdated /path/to/repo...'
|
printf 'repository %s is inaccessible\n' "$repo" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -p "${tmp:=${XDG_CACHE_HOME:-"$HOME/.cache"}/kiss/repology}"
|
main "$repo"
|
||||||
|
cd "$OLDPWD" || exit 1
|
||||||
for repo do
|
done
|
||||||
old_pwd=$PWD
|
|
||||||
cd "$repo"
|
|
||||||
get_outdated
|
|
||||||
cd "$old_pwd"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -ef
|
||||||
# Check which package owns a file
|
# Check which package owns a file
|
||||||
|
|
||||||
# Follow symlinks to any paths.
|
# Follow symlinks to any paths.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -ef
|
||||||
# Lists the owners of all files with conflicts
|
# Lists the owners of all files with conflicts
|
||||||
|
|
||||||
kiss a | while read -r _ path; do
|
kiss a | while read -r _ path; do
|
||||||
|
20
localbin/.local/bin/kiss/kiss-repo-orphans
Executable file
20
localbin/.local/bin/kiss/kiss-repo-orphans
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh -ef
|
||||||
|
# List packages which aren't present in any repository.
|
||||||
|
|
||||||
|
cd "$KISS_ROOT/var/db/kiss/installed"
|
||||||
|
|
||||||
|
kiss s ./* | while IFS=/ read -r _ path; do
|
||||||
|
pkg=${path##*/}
|
||||||
|
|
||||||
|
case $seen in *" $pkg "*)
|
||||||
|
continue
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $path in "$PWD/$pkg")
|
||||||
|
printf '%s\n' "$pkg"
|
||||||
|
esac
|
||||||
|
|
||||||
|
seen="$seen $pkg "
|
||||||
|
done
|
||||||
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
|||||||
#!/bin/sh -e
|
#!/bin/sh -ef
|
||||||
# Display packages which depend on package
|
# Display packages which depend on package
|
||||||
|
|
||||||
[ "$1" ] || set -- "${PWD##*/}"
|
[ "$1" ] || set -- "${PWD##*/}"
|
||||||
|
|
||||||
cd "$KISS_ROOT/var/db/kiss/installed"
|
cd "$KISS_ROOT/var/db/kiss/installed"
|
||||||
|
|
||||||
grep -E "^$1( |$)" -- */depends
|
grep "^$1" -- */depends
|
||||||
|
|
||||||
|
@ -27,11 +27,14 @@ kiss list "${1:-null}" >/dev/null || {
|
|||||||
|
|
||||||
# Filter directories from manifest and leave only files.
|
# Filter directories from manifest and leave only files.
|
||||||
# Directories in the manifest end in a trailing '/'.
|
# Directories in the manifest end in a trailing '/'.
|
||||||
# Send the file list to 'xargs' to run through 'du',
|
files=$(sed -e "s|^|$KISS_ROOT|" -e 's|.*/$||' \
|
||||||
# this prevents du from exiting due to too many arguments
|
"$KISS_ROOT/var/db/kiss/installed/$1/manifest")
|
||||||
sed -e "s|^|$KISS_ROOT|" -e 's|.*/$||' \
|
|
||||||
"$KISS_ROOT/var/db/kiss/installed/$1/manifest" \
|
# Send the file list to 'du'.
|
||||||
| xargs du -sk -- 2>/dev/null |
|
# This unquoted variable is safe as word splitting is intended
|
||||||
|
# and globbing is globally disabled in this script.
|
||||||
|
# shellcheck disable=2086
|
||||||
|
du -sk -- $files 2>/dev/null |
|
||||||
|
|
||||||
# Iterate over each line and convert the byte output to human
|
# Iterate over each line and convert the byte output to human
|
||||||
# readable (MB, KB, GB, etc).
|
# readable (MB, KB, GB, etc).
|
||||||
|
Loading…
Reference in New Issue
Block a user