forked from kiss-community/kiss
Compare commits
51 Commits
ehawkvu/ki
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b9a8f9fc28 | ||
|
7740c929a3 | ||
|
9f88746487 | ||
|
584b905d17 | ||
|
37e6a59ed3 | ||
|
a6bb1c5a26 | ||
|
1492cfa0a7 | ||
|
4e809ddf6b | ||
|
5e338034ec | ||
|
9e1394c897 | ||
|
61b24f4d7b | ||
|
b66a2c4203 | ||
|
4f739a6589 | ||
|
38b71d01b2 | ||
|
6a41ce4f7e | ||
|
b04a707130 | ||
|
ed4b6b7534 | ||
|
cbbfd857f0 | ||
|
d240830906 | ||
|
65b5140de5 | ||
|
b71f27c891 | ||
|
fabe05b37d | ||
|
8caca48504 | ||
|
3309146e61 | ||
|
a27fcec564 | ||
|
8a1a88e0d3 | ||
|
58475f7f29 | ||
|
74f78a8529 | ||
|
9c72484a62 | ||
|
b748b87148 | ||
|
2f4fc41582 | ||
|
cb9fe25776 | ||
|
e9c72295d6 | ||
|
2b84ea4563 | ||
|
967f62b3be | ||
|
7de9d70fe4 | ||
|
f50ea0caa5 | ||
|
51768ad4c3 | ||
|
d31dcf585e | ||
|
5f9c2c70fa | ||
|
74313a873c | ||
|
b815b07b7a | ||
|
154dada0df | ||
|
875a574eb7 | ||
|
909ef5ac74 | ||
|
15c89f6423 | ||
|
36df1ae0e5 | ||
|
af2335c55e | ||
|
031179e1b1 | ||
|
fd3fe16812 | ||
|
2afac4e981 |
9
.woodpecker.yml
Normal file
9
.woodpecker.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
steps:
|
||||||
|
build:
|
||||||
|
image: alpine
|
||||||
|
when:
|
||||||
|
branch: [ master ]
|
||||||
|
commands: |
|
||||||
|
apk add --no-cache shellcheck
|
||||||
|
|
||||||
|
shellcheck kiss contrib/*
|
@ -3,16 +3,14 @@
|
|||||||
|
|
||||||
# Use the current directory as the package name if no package is given.
|
# Use the current directory as the package name if no package is given.
|
||||||
[ "$1" ] || {
|
[ "$1" ] || {
|
||||||
export KISS_PATH=${PWD%/*}:$KISS_PATH
|
export KISS_PATH="${PWD%/*}:$KISS_PATH"
|
||||||
set -- "${PWD##*/}"
|
set -- "${PWD##*/}"
|
||||||
}
|
}
|
||||||
|
|
||||||
kiss search "$@" | sort -u | while read -r repo; do cd "$repo"
|
kiss search "$@" | sort -u | while read -r repo; do cd "$repo"
|
||||||
m=$(git log -1 version 2>/dev/null) ||:
|
m=$(git log -1 --format='%an <%ae>' -- version 2>/dev/null) ||:
|
||||||
m=${m##*Author: }
|
|
||||||
m=${m%%>*}
|
|
||||||
|
|
||||||
[ "$m" ] || continue
|
[ "$m" ] || continue
|
||||||
|
|
||||||
printf '=> %s\n%s>\n' "$PWD" "$m"
|
printf '=> %s\n%s\n' "$PWD" "$m"
|
||||||
done
|
done
|
||||||
|
@ -26,14 +26,27 @@ EOF
|
|||||||
)
|
)
|
||||||
|
|
||||||
case $remote in
|
case $remote in
|
||||||
|
age)
|
||||||
|
remote=age-encryption
|
||||||
|
;;
|
||||||
|
|
||||||
baseinit|baselayout|kiss)
|
baseinit|baselayout|kiss)
|
||||||
remote=-
|
remote=-
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
|
bat)
|
||||||
|
remote=bat-cat
|
||||||
|
;;
|
||||||
|
|
||||||
clang)
|
clang)
|
||||||
remote=llvm
|
remote=llvm
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
ctags)
|
||||||
|
remote=exuberant-ctags
|
||||||
|
;;
|
||||||
|
|
||||||
dash)
|
dash)
|
||||||
remote=dash-shell
|
remote=dash-shell
|
||||||
;;
|
;;
|
||||||
@ -46,15 +59,27 @@ EOF
|
|||||||
remote=dsp-audio-processing
|
remote=dsp-audio-processing
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
dust)
|
||||||
|
remote=du-dust
|
||||||
|
;;
|
||||||
|
|
||||||
emacs-nox)
|
emacs-nox)
|
||||||
# TODO [community]: Make default emacs no x11?
|
# TODO [community]: Make default emacs no x11?
|
||||||
remote=emacs
|
remote=emacs
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
go-ipfs)
|
||||||
|
remote=ipfs
|
||||||
|
;;
|
||||||
|
|
||||||
fd)
|
fd)
|
||||||
remote=fd-find
|
remote=fd-find
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
fdm)
|
||||||
|
remote=fdm-email-fetcher
|
||||||
|
;;
|
||||||
|
|
||||||
fetsh)
|
fetsh)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=fet.sh
|
remote=fet.sh
|
||||||
@ -88,7 +113,7 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
gtk+3)
|
gtk+3)
|
||||||
remote=gtk3+classic
|
remote=gtk3-classic
|
||||||
;;
|
;;
|
||||||
|
|
||||||
gst-*)
|
gst-*)
|
||||||
@ -124,15 +149,31 @@ EOF
|
|||||||
remote=fonts:liberation
|
remote=fonts:liberation
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
libjpeg)
|
||||||
|
remote=ijg-libjpeg
|
||||||
|
;;
|
||||||
|
|
||||||
libmupdf | libxaw3d)
|
libmupdf | libxaw3d)
|
||||||
# TODO [community]: Rename packages?
|
# TODO [community]: Rename packages?
|
||||||
remote=${remote##lib}
|
remote=${remote##lib}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
libnghttp2)
|
||||||
|
remote=nghttp2
|
||||||
|
;;
|
||||||
|
|
||||||
|
libportaudio2)
|
||||||
|
remote=portaudio
|
||||||
|
;;
|
||||||
|
|
||||||
libseat)
|
libseat)
|
||||||
remote=seatd
|
remote=seatd
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
libzmq)
|
||||||
|
remote=zeromq
|
||||||
|
;;
|
||||||
|
|
||||||
links2)
|
links2)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=links
|
remote=links
|
||||||
@ -142,6 +183,10 @@ EOF
|
|||||||
remote=linux
|
remote=linux
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
lpeg)
|
||||||
|
remote=lua:lpeg
|
||||||
|
;;
|
||||||
|
|
||||||
lux)
|
lux)
|
||||||
remote=lux-brightness-ventto
|
remote=lux-brightness-ventto
|
||||||
;;
|
;;
|
||||||
@ -157,6 +202,10 @@ EOF
|
|||||||
remote=netsurf
|
remote=netsurf
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
noto-emoji)
|
||||||
|
remote=fonts:noto-emoji
|
||||||
|
;;
|
||||||
|
|
||||||
openjpeg2)
|
openjpeg2)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=openjpeg
|
remote=openjpeg
|
||||||
@ -166,10 +215,22 @@ EOF
|
|||||||
remote=oil-shell
|
remote=oil-shell
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
pass)
|
||||||
|
remote=password-store
|
||||||
|
;;
|
||||||
|
|
||||||
pinentry-dmenu)
|
pinentry-dmenu)
|
||||||
remote=pinentry-dmenu-cemkeylan
|
remote=pinentry-dmenu-cemkeylan
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
pybind11)
|
||||||
|
remote=python:pybind11
|
||||||
|
;;
|
||||||
|
|
||||||
|
python-psutil)
|
||||||
|
remote=python:psutil
|
||||||
|
;;
|
||||||
|
|
||||||
pyqt5)
|
pyqt5)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=python-qt
|
remote=python-qt
|
||||||
@ -179,12 +240,24 @@ EOF
|
|||||||
remote=python
|
remote=python
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
python-docutils)
|
||||||
|
remote=python:docutils
|
||||||
|
;;
|
||||||
|
|
||||||
|
python-mako)
|
||||||
|
remote=python:mako
|
||||||
|
;;
|
||||||
|
|
||||||
|
python-markupsafe)
|
||||||
|
remote=python:markupsafe
|
||||||
|
;;
|
||||||
|
|
||||||
qt5*)
|
qt5*)
|
||||||
remote=qt
|
remote=qt
|
||||||
;;
|
;;
|
||||||
|
|
||||||
rage)
|
rage)
|
||||||
remote=rage-encryption-tool
|
remote=rage-encryption
|
||||||
;;
|
;;
|
||||||
|
|
||||||
sane)
|
sane)
|
||||||
@ -199,6 +272,10 @@ EOF
|
|||||||
remote=fusefs:sshfs
|
remote=fusefs:sshfs
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
slides)
|
||||||
|
remote=slides-presentation-tool
|
||||||
|
;;
|
||||||
|
|
||||||
surf)
|
surf)
|
||||||
remote=surf-browser
|
remote=surf-browser
|
||||||
;;
|
;;
|
||||||
@ -211,18 +288,34 @@ EOF
|
|||||||
remote=sway
|
remote=sway
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
tea)
|
||||||
|
remote=gitea-tea
|
||||||
|
;;
|
||||||
|
|
||||||
terminus-font)
|
terminus-font)
|
||||||
remote=fonts:terminus
|
remote=fonts:terminus
|
||||||
;;
|
;;
|
||||||
|
|
||||||
tiv)
|
tiv)
|
||||||
remote=tiv-unclassified
|
remote=tiv-terminalimageviewer
|
||||||
|
;;
|
||||||
|
|
||||||
|
tree)
|
||||||
|
remote=tree-steve-baker
|
||||||
|
;;
|
||||||
|
|
||||||
|
ttf-font-awesome)
|
||||||
|
remote=font-awesome6
|
||||||
;;
|
;;
|
||||||
|
|
||||||
unifont)
|
unifont)
|
||||||
remote=fonts:unifont
|
remote=fonts:unifont
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
vis)
|
||||||
|
remote=vis-editor
|
||||||
|
;;
|
||||||
|
|
||||||
webkit2gtk)
|
webkit2gtk)
|
||||||
# TODO [community]: Rename package?
|
# TODO [community]: Rename package?
|
||||||
remote=webkitgtk
|
remote=webkitgtk
|
||||||
@ -256,7 +349,7 @@ repo_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_outdated() {
|
get_outdated() {
|
||||||
repo=${repo%%/}
|
repo=${PWD%%/}
|
||||||
printf '\n[Checking Repology for outdated packages in %s]\n\n' "$repo" >&2
|
printf '\n[Checking Repology for outdated packages in %s]\n\n' "$repo" >&2
|
||||||
|
|
||||||
for pkg in */; do
|
for pkg in */; do
|
||||||
@ -281,8 +374,9 @@ get_outdated() {
|
|||||||
repology_name "$pkg"
|
repology_name "$pkg"
|
||||||
repology_version "$remote" || continue
|
repology_version "$remote" || continue
|
||||||
|
|
||||||
case $remote_ver in *", $ver"* | *"$ver,"* | "$ver" | - | '')
|
case $remote_ver in
|
||||||
continue
|
*", $ver"* | *"$ver,"* | "$ver" | '') continue ;;
|
||||||
|
-) printf '%-30s no remote version found\n' "$pkg" >&2; continue ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf '%-30s %s -> %s\n' "$pkg" "$ver" "$remote_ver"
|
printf '%-30s %s -> %s\n' "$pkg" "$ver" "$remote_ver"
|
||||||
@ -292,8 +386,7 @@ get_outdated() {
|
|||||||
main() {
|
main() {
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ "$1" ] ||
|
[ "$1" ] || set -- "$PWD"
|
||||||
die 'usage: kiss [ou]tdated /path/to/repo...'
|
|
||||||
|
|
||||||
mkdir -p "${tmp:=${XDG_CACHE_HOME:-"$HOME/.cache"}/kiss/repology}"
|
mkdir -p "${tmp:=${XDG_CACHE_HOME:-"$HOME/.cache"}/kiss/repology}"
|
||||||
|
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
# Follow symlinks to any paths.
|
# Follow symlinks to any paths.
|
||||||
case $1 in
|
case $1 in
|
||||||
/*)
|
/*)
|
||||||
cd -P "$KISS_ROOT${1%/*}"
|
cd -P "${KISS_ROOT:-/}${1%/*}"
|
||||||
|
[ "$PWD" = / ] && KISS_ROOT=
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*/*)
|
*/*)
|
||||||
@ -24,7 +25,7 @@ esac
|
|||||||
# Print the full path to the manifest file which contains
|
# Print the full path to the manifest file which contains
|
||||||
# the match to our search.
|
# the match to our search.
|
||||||
pkg_owns=$(grep -lFx \
|
pkg_owns=$(grep -lFx \
|
||||||
"$PWD/${1##*/}" \
|
"${PWD#"$KISS_ROOT"}/${1##*/}" \
|
||||||
"$KISS_ROOT/var/db/kiss/installed/"*/manifest)
|
"$KISS_ROOT/var/db/kiss/installed/"*/manifest)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
#!/bin/sh -e
|
|
||||||
# Lists the owners of all files with conflicts
|
|
||||||
|
|
||||||
kiss a | while read -r _ path; do
|
|
||||||
if owner=$(kiss owns "$path" 2>/dev/null) && [ "$owner" ]; then
|
|
||||||
printf '%s %s\n' "$owner" "$path"
|
|
||||||
|
|
||||||
else
|
|
||||||
printf 'warning: %s has no owner\n' "$path" >&2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
16
contrib/kiss-repodepends
Executable file
16
contrib/kiss-repodepends
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/sh -ef
|
||||||
|
# Display a package's dependencies in repositories
|
||||||
|
|
||||||
|
pkg=${1:-"${PWD##*/}"}
|
||||||
|
|
||||||
|
kiss search "$pkg" >/dev/null || {
|
||||||
|
printf 'usage: kiss-depends [pkg]\n' >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
kiss search "$pkg" | while read -r pkgpath; do
|
||||||
|
printf '=> %s\n' "$pkgpath"
|
||||||
|
while read -r dep mak || [ "$dep" ]; do
|
||||||
|
printf '%s%s\n' "$dep" "${mak:+ "$mak"}"
|
||||||
|
done 2>/dev/null < "$pkgpath/depends"
|
||||||
|
done
|
19
contrib/kiss-reporevdepends
Executable file
19
contrib/kiss-reporevdepends
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Display packages in all repositories which depend on a package
|
||||||
|
|
||||||
|
[ "$1" ] || set -- "${PWD##*/}"
|
||||||
|
|
||||||
|
suffix () {
|
||||||
|
case "$1" in *"$2") return 0; esac; return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
IFS=:
|
||||||
|
for repo in $KISS_PATH; do
|
||||||
|
# remove trailing slashes
|
||||||
|
while suffix "$repo" /; do repo="${repo%/}"; done
|
||||||
|
gitdir="$(git -C "$repo" rev-parse --show-toplevel 2>/dev/null || echo "$repo")"
|
||||||
|
case "$gitdir" in "$repo") unset prefix ;; *) prefix="${repo##*/}/" ;; esac
|
||||||
|
|
||||||
|
cd "$gitdir/.." || continue
|
||||||
|
grep -E "^$1([[:space:]]|$)" -- "${gitdir##*/}/$prefix"*/depends 2>/dev/null ||:
|
||||||
|
done
|
376
kiss
376
kiss
@ -94,9 +94,7 @@ prompt() {
|
|||||||
null "$1" || log "$1"
|
null "$1" || log "$1"
|
||||||
|
|
||||||
log "Continue?: Press Enter to continue or Ctrl+C to abort"
|
log "Continue?: Press Enter to continue or Ctrl+C to abort"
|
||||||
|
equ "$KISS_PROMPT" 0 || dd bs=1 count=1 >/dev/null 2>&1 || exit 1
|
||||||
# korn-shell does not exit on interrupt of read.
|
|
||||||
equ "$KISS_PROMPT" 0 || read -r _ || exit 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mkcd() {
|
mkcd() {
|
||||||
@ -177,27 +175,81 @@ run_hook() {
|
|||||||
|
|
||||||
run_hook_pkg() {
|
run_hook_pkg() {
|
||||||
# Run a hook from the package's database files.
|
# Run a hook from the package's database files.
|
||||||
if [ -x "$sys_db/$2/$1" ]; then
|
hook_path="$sys_db/$2/$1"
|
||||||
|
if [ -x "$hook_path" ]; then
|
||||||
log "$2" "Running $1 hook"
|
log "$2" "Running $1 hook"
|
||||||
"$sys_db/$2/$1"
|
|
||||||
|
|
||||||
elif [ -f "$sys_db/$2/$1" ]; then
|
user=root
|
||||||
|
|
||||||
|
set --
|
||||||
|
equ "$LOGNAME" "$user" || set -- as_user
|
||||||
|
|
||||||
|
"$@" env KISS_ROOT='' \
|
||||||
|
chroot "${KISS_ROOT:-/}" "${hook_path#"$KISS_ROOT"}"
|
||||||
|
|
||||||
|
elif [ -f "$hook_path" ]; then
|
||||||
war "$2" "skipping $1 hook: not executable"
|
war "$2" "skipping $1 hook: not executable"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compress() {
|
||||||
|
case $KISS_COMPRESS in
|
||||||
|
bz2) bzip2 -c ;;
|
||||||
|
gz) gzip -c ;;
|
||||||
|
lz) lzip -c ;;
|
||||||
|
lzma) lzma -cT0 ;;
|
||||||
|
xz) xz -cT0 ;;
|
||||||
|
zst) zstd -cT0 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
decompress() {
|
decompress() {
|
||||||
case $1 in
|
case $1 in
|
||||||
*.tbz|*.bz2) bzip2 -d ;;
|
*.tar) cat ;;
|
||||||
*.lzma) lzma -dc ;;
|
*.tbz|*.bz2) bzip2 -dc ;;
|
||||||
*.lz) lzip -dc ;;
|
*.lz) lzip -dc ;;
|
||||||
*.tar) cat ;;
|
*.tgz|*.gz) gzip -dc ;;
|
||||||
*.tgz|*.gz) gzip -d ;;
|
*.lzma) lzma -dcT0 ;;
|
||||||
*.xz|*.txz) xz -dc ;;
|
*.xz|*.txz) xz -dcT0 ;;
|
||||||
*.zst) zstd -dc ;;
|
*.zst) zstd -dcT0 ;;
|
||||||
esac < "$1"
|
esac < "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b3() {
|
||||||
|
# Higher level blake3 function which filters out non-existent
|
||||||
|
# files (and also directories).
|
||||||
|
for f do shift
|
||||||
|
[ -d "$f" ] || [ ! -e "$f" ] || set -- "$@" "$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
_b3 "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_b3() {
|
||||||
|
unset hash
|
||||||
|
|
||||||
|
# Skip generation if no arguments.
|
||||||
|
! equ "$#" 0 || return 0
|
||||||
|
|
||||||
|
IFS=$newline
|
||||||
|
|
||||||
|
# Generate checksums for all input files. This is a single
|
||||||
|
# call to the utility rather than one per file.
|
||||||
|
#
|
||||||
|
# The length of the checksum is set to 33 bytes to
|
||||||
|
# differentiate it from sha256 checksums.
|
||||||
|
_hash=$("$cmd_b3" -l 33 "$@") || die "Failed to generate checksums"
|
||||||
|
|
||||||
|
# Strip the filename from each element.
|
||||||
|
# '<checksum> ?<file>' -> '<checksum>'
|
||||||
|
for sum in $_hash; do
|
||||||
|
hash=$hash${hash:+"$newline"}${sum%% *}
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '%s\n' "$hash"
|
||||||
|
unset IFS
|
||||||
|
}
|
||||||
|
|
||||||
sh256() {
|
sh256() {
|
||||||
# Higher level sh256 function which filters out non-existent
|
# Higher level sh256 function which filters out non-existent
|
||||||
# files (and also directories).
|
# files (and also directories).
|
||||||
@ -262,15 +314,6 @@ pkg_find_version() {
|
|||||||
die "$pkg" "Build file not found or not executable"
|
die "$pkg" "Build file not found or not executable"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_find_version_split() {
|
|
||||||
pkg_find_version "$@"
|
|
||||||
|
|
||||||
# Split the version on '.+-_' to obtain individual components.
|
|
||||||
IFS=.+-_ read -r repo_major repo_minor repo_patch repo_ident <<EOF
|
|
||||||
$repo_ver
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_find() {
|
pkg_find() {
|
||||||
_pkg_find "$@" || die "'$1' not found"
|
_pkg_find "$@" || die "'$1' not found"
|
||||||
}
|
}
|
||||||
@ -285,6 +328,7 @@ _pkg_find() {
|
|||||||
# Intentional.
|
# Intentional.
|
||||||
# shellcheck disable=2086
|
# shellcheck disable=2086
|
||||||
for _find_path in $4 "${3:-$sys_db}"; do set +f
|
for _find_path in $4 "${3:-$sys_db}"; do set +f
|
||||||
|
ok "$_find_path" || continue
|
||||||
for _find_pkg in "$_find_path/"$1; do
|
for _find_pkg in "$_find_path/"$1; do
|
||||||
test "${3:--d}" "$_find_pkg" && set -f -- "$@" "$_find_pkg"
|
test "${3:--d}" "$_find_pkg" && set -f -- "$@" "$_find_pkg"
|
||||||
done
|
done
|
||||||
@ -335,24 +379,11 @@ pkg_cache() {
|
|||||||
pkg_source_resolve() {
|
pkg_source_resolve() {
|
||||||
# Given a line of input from the sources file, return an absolute
|
# Given a line of input from the sources file, return an absolute
|
||||||
# path to the source if it already exists, error if not.
|
# path to the source if it already exists, error if not.
|
||||||
unset _res _des _fnr
|
unset _res _des
|
||||||
|
|
||||||
ok "${2##\#*}" || return 0
|
ok "${2##\#*}" || return 0
|
||||||
|
|
||||||
# Surround each replacement with substitutions to handled escaped markers.
|
set -- "$1" "$2" "${3%"${3##*[!/]}"}" "$4"
|
||||||
# First substitution turns '\MARKER' into ' ' (can't appear in sources as
|
|
||||||
# they're already split on whitespace), second replaces 'MARKER' with its
|
|
||||||
# value and the third, turns ' ' into 'MARKER' (dropping \\).
|
|
||||||
fnr "${2%"${2##*[!/]}"}" \
|
|
||||||
\\VERSION \ VERSION "$repo_ver" \ VERSION \
|
|
||||||
\\RELEASE \ RELEASE "$repo_rel" \ RELEASE \
|
|
||||||
\\MAJOR \ MAJOR "$repo_major" \ MAJOR \
|
|
||||||
\\MINOR \ MINOR "$repo_minor" \ MINOR \
|
|
||||||
\\PATCH \ PATCH "$repo_patch" \ PATCH \
|
|
||||||
\\IDENT \ IDENT "$repo_ident" \ IDENT \
|
|
||||||
\\PACKAGE \ PACKAGE "$repo_name" \ PACKAGE
|
|
||||||
|
|
||||||
set -- "$1" "$_fnr" "${3%"${3##*[!/]}"}" "$4"
|
|
||||||
|
|
||||||
# Git repository.
|
# Git repository.
|
||||||
if null "${2##git+*}"; then
|
if null "${2##git+*}"; then
|
||||||
@ -360,14 +391,18 @@ pkg_source_resolve() {
|
|||||||
_des=$src_dir/$1/${3:+"$3/"}${2##*/}
|
_des=$src_dir/$1/${3:+"$3/"}${2##*/}
|
||||||
_des=${_des%[@#]*}/
|
_des=${_des%[@#]*}/
|
||||||
|
|
||||||
# Remote source (cached).
|
|
||||||
elif [ -f "$src_dir/$1/${3:+"$3/"}${2##*/}" ]; then
|
|
||||||
_res=$src_dir/$1/${3:+"$3/"}${2##*/}
|
|
||||||
|
|
||||||
# Remote source.
|
# Remote source.
|
||||||
elif null "${2##*://*}"; then
|
elif null "${2##*://*}"; then
|
||||||
_res=url+$2
|
# Remote source (cached).
|
||||||
_des=$src_dir/$1/${3:+"$3/"}${2##*/}
|
# Only check if we detect a remote source to avoid
|
||||||
|
# masking local paths like 'files/test' as cached
|
||||||
|
# if '$src_dir/$1/test' is present
|
||||||
|
if [ -f "$src_dir/$1/${3:+"$3/"}${2##*/}" ]; then
|
||||||
|
_res=$src_dir/$1/${3:+"$3/"}${2##*/}
|
||||||
|
else
|
||||||
|
_res=url+$2
|
||||||
|
_des=$src_dir/$1/${3:+"$3/"}${2##*/}
|
||||||
|
fi
|
||||||
|
|
||||||
# Local relative dir.
|
# Local relative dir.
|
||||||
elif [ -d "$repo_dir/$2" ]; then
|
elif [ -d "$repo_dir/$2" ]; then
|
||||||
@ -395,7 +430,7 @@ pkg_source_resolve() {
|
|||||||
pkg_source() {
|
pkg_source() {
|
||||||
# Download any remote package sources. The existence of local files is
|
# Download any remote package sources. The existence of local files is
|
||||||
# also checked.
|
# also checked.
|
||||||
pkg_find_version_split "$1"
|
pkg_find_version "$1"
|
||||||
|
|
||||||
# Support packages without sources. Simply do nothing.
|
# Support packages without sources. Simply do nothing.
|
||||||
[ -f "$repo_dir/sources" ] || return 0
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
@ -407,9 +442,8 @@ pkg_source() {
|
|||||||
|
|
||||||
# arg1: pre-source
|
# arg1: pre-source
|
||||||
# arg2: package name
|
# arg2: package name
|
||||||
# arg3: verbatim source
|
# arg3: source
|
||||||
# arg4: resolved source
|
run_hook pre-source "$1" "$src"
|
||||||
run_hook pre-source "$1" "$src" "$_fnr"
|
|
||||||
|
|
||||||
# '$2' is set when this function is called from 'kiss c' and it is used
|
# '$2' is set when this function is called from 'kiss c' and it is used
|
||||||
# here to skip calling the Git code.
|
# here to skip calling the Git code.
|
||||||
@ -420,8 +454,8 @@ pkg_source() {
|
|||||||
|
|
||||||
# arg1: post-source
|
# arg1: post-source
|
||||||
# arg2: package name
|
# arg2: package name
|
||||||
# arg3: verbatim source
|
# arg3: source
|
||||||
# arg4: resolved source
|
# arg4: destination
|
||||||
run_hook post-source "$1" "$src" "${_des:-"$_res"}"
|
run_hook post-source "$1" "$src" "${_des:-"$_res"}"
|
||||||
done < "$repo_dir/sources"
|
done < "$repo_dir/sources"
|
||||||
}
|
}
|
||||||
@ -429,6 +463,17 @@ pkg_source() {
|
|||||||
pkg_source_url() {
|
pkg_source_url() {
|
||||||
log "$repo_name" "Downloading $2"
|
log "$repo_name" "Downloading $2"
|
||||||
|
|
||||||
|
# Download to a temporary file and only move it to the destination if
|
||||||
|
# everything completed successfully, to avoid leaving incomplete downloads
|
||||||
|
# in the cache if it is interrupted.
|
||||||
|
download_source=$2
|
||||||
|
download_dest=$1
|
||||||
|
tmp_file "${1##*/}" download
|
||||||
|
shift
|
||||||
|
|
||||||
|
set -- "$_tmp_file" "$@"
|
||||||
|
rm -f "$_tmp_file"
|
||||||
|
|
||||||
# Set the arguments based on found download utility.
|
# Set the arguments based on found download utility.
|
||||||
case ${cmd_get##*/} in
|
case ${cmd_get##*/} in
|
||||||
aria2c) set -- -d / -o "$@" ;;
|
aria2c) set -- -d / -o "$@" ;;
|
||||||
@ -438,14 +483,16 @@ pkg_source_url() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
"$cmd_get" "$@" || {
|
"$cmd_get" "$@" || {
|
||||||
rm -f "$2"
|
rm -f "$_tmp_file"
|
||||||
die "$repo_name" "Failed to download $3"
|
die "$repo_name" "Failed to download $download_source"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mv "$_tmp_file" "$download_dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_source_git() {
|
pkg_source_git() {
|
||||||
com=${2##*[@#]}
|
com=${2##*[@#]}
|
||||||
com=${com#${2%[#@]*}}
|
com=${com#"${2%[#@]*}"}
|
||||||
|
|
||||||
log "$repo_name" "Checking out ${com:-FETCH_HEAD}"
|
log "$repo_name" "Checking out ${com:-FETCH_HEAD}"
|
||||||
|
|
||||||
@ -647,6 +694,25 @@ pkg_strip() {
|
|||||||
esac done < "$pkg_dir/$1/$pkg_db/$1/manifest" || :
|
esac done < "$pkg_dir/$1/$pkg_db/$1/manifest" || :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
should_ignore_rpath() {
|
||||||
|
# Intentional, globbing disabled.
|
||||||
|
# shellcheck disable=2086
|
||||||
|
{ IFS=:; set -- $1; unset IFS; }
|
||||||
|
|
||||||
|
for path do
|
||||||
|
# TODO maybe check if the RPATH is set to a redundant value
|
||||||
|
# like /lib or /usr/lib ?
|
||||||
|
# ORIGIN is relative - no need to ignore it.
|
||||||
|
# Library rpath: [$ORIGIN/../lib]
|
||||||
|
# shellcheck disable=2016
|
||||||
|
case $path in '$ORIGIN'*|'${ORIGIN}'*) continue; esac
|
||||||
|
# Non-relative path, should be ignored.
|
||||||
|
return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
pkg_fix_deps() {
|
pkg_fix_deps() {
|
||||||
# Dynamically look for missing runtime dependencies by checking each
|
# Dynamically look for missing runtime dependencies by checking each
|
||||||
# binary and library with 'ldd'. This catches any extra libraries and or
|
# binary and library with 'ldd'. This catches any extra libraries and or
|
||||||
@ -670,28 +736,71 @@ pkg_fix_deps() {
|
|||||||
*/sbin/?*[!/]|*/bin/?*[!/]|*/lib/?*[!/]|\
|
*/sbin/?*[!/]|*/bin/?*[!/]|*/lib/?*[!/]|\
|
||||||
*/lib??/?*[!/]|*/lib???/?*[!/]|*/lib????/?*[!/])
|
*/lib??/?*[!/]|*/lib???/?*[!/]|*/lib????/?*[!/])
|
||||||
|
|
||||||
# The readelf mode requires ldd's output to resolve the library
|
unset elf
|
||||||
# path for a given file. If ldd fails, silently skip the file.
|
|
||||||
ldd=$(ldd -- "$pkg_dir/$repo_name$_file" 2>/dev/null) || continue
|
|
||||||
|
|
||||||
# Attempt to get information from readelf. If this fails (or we
|
# Attempt to get information from readelf. If this fails (or we
|
||||||
# are in ldd mode), do full ldd mode (which has the downside of
|
# are in ldd mode), do full ldd mode (which has the downside of
|
||||||
# listing dependencies of dependencies (and so on)).
|
# listing dependencies of dependencies (and so on)).
|
||||||
elf=$("$cmd_elf" -d "$pkg_dir/$repo_name$_file" 2>/dev/null) || elf=$ldd
|
case $cmd_elf in *readelf)
|
||||||
|
elf=$("$cmd_elf" -d "$pkg_dir/$repo_name$_file" 2>/dev/null) ||:
|
||||||
|
esac
|
||||||
|
|
||||||
|
# RPATH/RUNPATH allows the binary to set a relative path for the
|
||||||
|
# dynamic loader that might not be present on the rootfs at the time
|
||||||
|
# of installation. So, ignoring it can cause the dependency detector to
|
||||||
|
# wrongly add packages. The problem also exists in reverse when the
|
||||||
|
# package links to a library bundled inside it and present in system paths
|
||||||
|
# aswell, and a package update unbundles it - the package gets a dependency
|
||||||
|
# on itself due to RPATH causing ldd to find the bundled lib.
|
||||||
|
# Example: libnss3.so exists in /usr/lib at the time of installation
|
||||||
|
# But the package links to libnss3 in /usr/lib/PKG/libnss3.so, which is
|
||||||
|
# present only in the build dir. So, KISS wrongly adds the installed nss
|
||||||
|
# as a dependency.
|
||||||
|
# To avoid dealing with this, we just ignore any libraries with RPATH set.
|
||||||
|
# A solution to this could be to just get the NEEDED libs and RPATH with
|
||||||
|
# readelf and resolve the paths ourselves - with adhoc logic for RPATH and
|
||||||
|
# the build dir.
|
||||||
|
# Another solution could be to resolve the dependencies after installation,
|
||||||
|
# but that can cause issues with reinstalling that tarball later on.
|
||||||
|
# https://github.com/kiss-community/kiss/issues/64
|
||||||
|
# https://github.com/kiss-community/repo/issues/97
|
||||||
|
while read -r _ entry_type value; do
|
||||||
|
# Technically RUNPATH is supposed to have a higher priority
|
||||||
|
# than RPATH but a binary that has both RPATH and RUNPATH set,
|
||||||
|
# each with unique values is probably broken...
|
||||||
|
case $entry_type in '(RPATH)'|'(RUNPATH)')
|
||||||
|
value=${value##*\[}
|
||||||
|
value=${value%%\]*}
|
||||||
|
|
||||||
|
should_ignore_rpath "$value" && continue 2
|
||||||
|
# Found RPATH which shouldn't be ignored
|
||||||
|
break
|
||||||
|
esac
|
||||||
|
done <<EOF
|
||||||
|
$elf
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# The readelf mode requires ldd's output to resolve the library
|
||||||
|
# path for a given file. If ldd fails, silently skip the file.
|
||||||
|
ldd=$(ldd -- "$pkg_dir/$repo_name$_file" 2>/dev/null) || continue
|
||||||
|
ok "$elf" || elf=$ldd
|
||||||
|
|
||||||
# Iterate over the output of readelf or ldd, extract file names,
|
# Iterate over the output of readelf or ldd, extract file names,
|
||||||
# resolve their paths and finally, figure out their owner.
|
# resolve their paths and finally, figure out their owner.
|
||||||
while read -r lib; do case $lib in *NEEDED*\[*\]|*'=>'*)
|
while read -r _ entry_type lib; do case $entry_type in '(NEEDED)'|'=>')
|
||||||
# readelf: 0x0000 (NEEDED) Shared library: [libjson-c.so.5]
|
# readelf: 0x0000 (NEEDED) Shared library: [libjson-c.so.5]
|
||||||
lib=${lib##*\[}
|
lib=${lib##*\[}
|
||||||
lib=${lib%%\]*}
|
lib=${lib%%\]*}
|
||||||
|
|
||||||
# Resolve library path.
|
# Resolve library path. It is already resolved for ldd in the 'lib' field
|
||||||
# ldd: libjson-c.so.5 => /lib/libjson-c.so.5 ...
|
# ldd: libjson-c.so.5 => /lib/libjson-c.so.5 ...
|
||||||
case $cmd_elf in
|
case $cmd_elf in *readelf)
|
||||||
*readelf) lib=${ldd#*" $lib => "} ;;
|
lib=${ldd#*" $lib => "}
|
||||||
*) lib=${lib##*=> } ;;
|
# Remove prefix, else the file will not be owned by any
|
||||||
|
# package in the pkg_owner check below
|
||||||
|
lib=${lib#"$pkg_dir/$repo_name"}
|
||||||
esac
|
esac
|
||||||
|
|
||||||
lib=${lib%% *}
|
lib=${lib%% *}
|
||||||
|
|
||||||
# Skip files owned by libc, libc++ and POSIX.
|
# Skip files owned by libc, libc++ and POSIX.
|
||||||
@ -789,16 +898,17 @@ pkg_manifest_validate() {
|
|||||||
# NOTE: _pkg comes from caller.
|
# NOTE: _pkg comes from caller.
|
||||||
log "$_pkg" "Checking if manifest valid"
|
log "$_pkg" "Checking if manifest valid"
|
||||||
|
|
||||||
|
cnt=0
|
||||||
|
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
[ -e "$tar_dir/$_pkg$line" ] || [ -h "$tar_dir/$_pkg$line" ] || {
|
[ -e "$tar_dir/$_pkg$line" ] || [ -h "$tar_dir/$_pkg$line" ] || {
|
||||||
printf '%s\n' "$line"
|
printf '%s\n' "$line"
|
||||||
set -- "$@" "$line"
|
: $((cnt += 1))
|
||||||
}
|
}
|
||||||
done < "$pkg_db/$_pkg/manifest"
|
done < "$pkg_db/$_pkg/manifest"
|
||||||
|
|
||||||
for f do
|
equ "$cnt" 0 ||
|
||||||
die "$_pkg" "manifest contains $# non-existent files"
|
die "$_pkg" "manifest contains $cnt non-existent files"
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_manifest_replace() {
|
pkg_manifest_replace() {
|
||||||
@ -825,12 +935,19 @@ pkg_etcsums() {
|
|||||||
# Minor optimization - skip packages without /etc/.
|
# Minor optimization - skip packages without /etc/.
|
||||||
[ -d "$pkg_dir/$repo_name/etc" ] || return 0
|
[ -d "$pkg_dir/$repo_name/etc" ] || return 0
|
||||||
|
|
||||||
# Create a list of all files in etc but do it in reverse.
|
|
||||||
while read -r etc; do case $etc in /etc/*[!/])
|
while read -r etc; do case $etc in /etc/*[!/])
|
||||||
set -- "$pkg_dir/$repo_name/$etc" "$@"
|
etc="$pkg_dir/$repo_name/$etc"
|
||||||
|
# Always use hash of /dev/null as the hash for symlinks as it's
|
||||||
|
# possible that they can never be resolved/hashed
|
||||||
|
# (eg. directory, non-existent path, ...)
|
||||||
|
# So they leave missing lines in etcsums which breaks removal of all
|
||||||
|
# other unmodified files in /etc aswell
|
||||||
|
[ -h "$etc" ] && etc=/dev/null
|
||||||
|
|
||||||
|
set -- "$@" "$etc"
|
||||||
esac done < manifest
|
esac done < manifest
|
||||||
|
|
||||||
sh256 "$@" > etcsums
|
b3 "$@" > etcsums
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_tar() {
|
pkg_tar() {
|
||||||
@ -847,14 +964,7 @@ pkg_tar() {
|
|||||||
cd "$pkg_dir/$1"
|
cd "$pkg_dir/$1"
|
||||||
|
|
||||||
# Create a tarball from the contents of the built package.
|
# Create a tarball from the contents of the built package.
|
||||||
tar cf - . | case $KISS_COMPRESS in
|
tar cf - . | compress > "$_tar_file"
|
||||||
bz2) bzip2 -z ;;
|
|
||||||
gz) gzip -6 ;;
|
|
||||||
lzma) lzma -z ;;
|
|
||||||
lz) lzip -z ;;
|
|
||||||
xz) xz -z ;;
|
|
||||||
zst) zstd -z ;;
|
|
||||||
esac > "$_tar_file"
|
|
||||||
|
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
|
|
||||||
@ -873,7 +983,7 @@ pkg_build_all() {
|
|||||||
# Mark packages passed on the command-line explicit.
|
# Mark packages passed on the command-line explicit.
|
||||||
# Also resolve dependencies for all explicit packages.
|
# Also resolve dependencies for all explicit packages.
|
||||||
for pkg do
|
for pkg do
|
||||||
pkg_depends "$pkg" expl filter
|
equ "$KISS_FORCE" 1 || pkg_depends "$pkg" expl filter
|
||||||
explicit="$explicit $pkg "
|
explicit="$explicit $pkg "
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -929,7 +1039,7 @@ pkg_build_all() {
|
|||||||
for pkg do
|
for pkg do
|
||||||
log "$pkg" "Building package ($((_build_cur+=1))/$#)"
|
log "$pkg" "Building package ($((_build_cur+=1))/$#)"
|
||||||
|
|
||||||
pkg_find_version_split "$pkg"
|
pkg_find_version "$pkg"
|
||||||
|
|
||||||
# arg1: queue-status
|
# arg1: queue-status
|
||||||
# arg2: package name
|
# arg2: package name
|
||||||
@ -987,16 +1097,14 @@ pkg_build() {
|
|||||||
# Give the script a modified environment. Define toolchain program
|
# Give the script a modified environment. Define toolchain program
|
||||||
# environment variables assuming a generic environment by default.
|
# environment variables assuming a generic environment by default.
|
||||||
#
|
#
|
||||||
# Define DESTDIR and GOPATH to sane defaults as their use is mandatory
|
# Define GOPATH to sane defaults as its use is mandatory for Go projects.
|
||||||
# in anything using autotools, meson, cmake, etc. Define KISS_ROOT as
|
# Define KISS_ROOT as the sanitized value used internally by the package
|
||||||
# the sanitized value used internally by the package manager. This is
|
# manager. This is safe to join with other paths.
|
||||||
# safe to join with other paths.
|
|
||||||
AR="${AR:-ar}" \
|
AR="${AR:-ar}" \
|
||||||
CC="${CC:-cc}" \
|
CC="${CC:-cc}" \
|
||||||
CXX="${CXX:-c++}" \
|
CXX="${CXX:-c++}" \
|
||||||
NM="${NM:-nm}" \
|
NM="${NM:-nm}" \
|
||||||
RANLIB="${RANLIB:-ranlib}" \
|
RANLIB="${RANLIB:-ranlib}" \
|
||||||
DESTDIR="$pkg_dir/$1" \
|
|
||||||
RUSTFLAGS="--remap-path-prefix=$PWD=. $RUSTFLAGS" \
|
RUSTFLAGS="--remap-path-prefix=$PWD=. $RUSTFLAGS" \
|
||||||
GOFLAGS="-trimpath -modcacherw $GOFLAGS" \
|
GOFLAGS="-trimpath -modcacherw $GOFLAGS" \
|
||||||
GOPATH="$PWD/go" \
|
GOPATH="$PWD/go" \
|
||||||
@ -1059,7 +1167,7 @@ pkg_checksum_gen() {
|
|||||||
esac
|
esac
|
||||||
done < "$repo_dir/sources"
|
done < "$repo_dir/sources"
|
||||||
|
|
||||||
_sh256 "$@"
|
_b3 "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_verify() {
|
pkg_verify() {
|
||||||
@ -1079,6 +1187,13 @@ pkg_verify() {
|
|||||||
# Check that the first column (separated by whitespace) match in both
|
# Check that the first column (separated by whitespace) match in both
|
||||||
# checksum files. If any part of either file differs, mismatch. Abort.
|
# checksum files. If any part of either file differs, mismatch. Abort.
|
||||||
null "$1" || while read -r chk _ || ok "$1"; do
|
null "$1" || while read -r chk _ || ok "$1"; do
|
||||||
|
equ "${#chk}" 64 && {
|
||||||
|
log "$repo_name" "Detected sha256 checksums." ERROR
|
||||||
|
log "blake3 is the new checksum provider for kiss. Please run"
|
||||||
|
log "'kiss checksum $repo_name' to regenerate the checksums file."
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
printf '%s\n%s\n' "- ${chk:-missing}" "+ ${1:-no source}"
|
printf '%s\n%s\n' "- ${chk:-missing}" "+ ${1:-no source}"
|
||||||
|
|
||||||
equ "$1-${chk:-null}" "$chk-$1" ||
|
equ "$1-${chk:-null}" "$chk-$1" ||
|
||||||
@ -1203,6 +1318,27 @@ pkg_alternatives() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkg_preferred() {
|
||||||
|
cd "$sys_db"
|
||||||
|
|
||||||
|
# We only respect first argument
|
||||||
|
if ok "$1"; then
|
||||||
|
[ -d "$1" ] || die "'$1' not found"
|
||||||
|
set -- "$1/manifest"
|
||||||
|
else
|
||||||
|
set +f; set -f -- */manifest
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Pass /dev/null to grep to always ensure that the file name
|
||||||
|
# is printed even if we have a single file
|
||||||
|
pkg_alternatives |
|
||||||
|
cut -d' ' -f2- |
|
||||||
|
grep -Fxf - "$@" /dev/null |
|
||||||
|
sed 's/\/manifest:/ /'
|
||||||
|
|
||||||
|
cd "$OLDPWD"
|
||||||
|
}
|
||||||
|
|
||||||
pkg_swap() {
|
pkg_swap() {
|
||||||
# Swap between package alternatives.
|
# Swap between package alternatives.
|
||||||
[ -d "$sys_db/$1" ] || die "'$1' not found"
|
[ -d "$sys_db/$1" ] || die "'$1' not found"
|
||||||
@ -1248,6 +1384,10 @@ file_rwx() {
|
|||||||
[st]*) o=$((o + 1)) ;;
|
[st]*) o=$((o + 1)) ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
case $rwx in
|
||||||
|
[tT]*) oct=1$oct
|
||||||
|
esac
|
||||||
|
|
||||||
case $((${c%?} % 3)) in 0)
|
case $((${c%?} % 3)) in 0)
|
||||||
oct=$oct$o
|
oct=$oct$o
|
||||||
o=0
|
o=0
|
||||||
@ -1312,10 +1452,13 @@ pkg_remove_files() {
|
|||||||
# functions allows us to stop duplicating code.
|
# functions allows us to stop duplicating code.
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
case $file in /etc/?*[!/])
|
case $file in /etc/?*[!/])
|
||||||
sh256 "$KISS_ROOT/$file" >/dev/null
|
|
||||||
|
|
||||||
read -r sum_pkg <&3 ||:
|
read -r sum_pkg <&3 ||:
|
||||||
|
|
||||||
|
case "${#sum_pkg}" in
|
||||||
|
64) sh256 "$KISS_ROOT/$file" >/dev/null ;;
|
||||||
|
*) b3 "$KISS_ROOT/$file" >/dev/null ;;
|
||||||
|
esac
|
||||||
|
|
||||||
equ "$hash" "$sum_pkg" || {
|
equ "$hash" "$sum_pkg" || {
|
||||||
printf 'Skipping %s (modified)\n' "$file"
|
printf 'Skipping %s (modified)\n' "$file"
|
||||||
continue
|
continue
|
||||||
@ -1347,13 +1490,16 @@ pkg_remove_files() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pkg_etc() {
|
pkg_etc() {
|
||||||
sh256 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null
|
read -r sum_old <&3 2>/dev/null ||:
|
||||||
|
|
||||||
|
case "${#sum_old}" in
|
||||||
|
64) sh256 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
|
||||||
|
*) b3 "$tar_dir/$_pkg$file" "$KISS_ROOT$file" >/dev/null ;;
|
||||||
|
esac
|
||||||
|
|
||||||
sum_new=${hash%%"$newline"*}
|
sum_new=${hash%%"$newline"*}
|
||||||
sum_sys=${hash#*"$newline"}
|
sum_sys=${hash#*"$newline"}
|
||||||
|
|
||||||
read -r sum_old <&3 2>/dev/null ||:
|
|
||||||
|
|
||||||
# Compare the three checksums to determine what to do.
|
# Compare the three checksums to determine what to do.
|
||||||
case ${sum_old:-null}${sum_sys:-null}${sum_new} in
|
case ${sum_old:-null}${sum_sys:-null}${sum_new} in
|
||||||
# old = Y, sys = X, new = Y
|
# old = Y, sys = X, new = Y
|
||||||
@ -1391,6 +1537,14 @@ pkg_removable() {
|
|||||||
|
|
||||||
set -f
|
set -f
|
||||||
cd "$OLDPWD"
|
cd "$OLDPWD"
|
||||||
|
|
||||||
|
# Check if a package would leave dangling "orphaned" alternatives.
|
||||||
|
tmp_file "$1" owned-conflicts
|
||||||
|
pkg_preferred "$1" | tee "$_tmp_file"
|
||||||
|
|
||||||
|
cnt=$(wc -l < "$_tmp_file")
|
||||||
|
equ "$cnt" 0 ||
|
||||||
|
die "$1" "Not removable, package leaves behind $cnt orphaned alternatives"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_remove() {
|
pkg_remove() {
|
||||||
@ -1596,7 +1750,7 @@ pkg_update() {
|
|||||||
pkg_update_repo
|
pkg_update_repo
|
||||||
done
|
done
|
||||||
|
|
||||||
pkg_upgrade
|
log "Run 'kiss U' to upgrade packages"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_update_repo() {
|
pkg_update_repo() {
|
||||||
@ -1625,6 +1779,11 @@ pkg_update_repo() {
|
|||||||
# arg1: post-update
|
# arg1: post-update
|
||||||
# env: PWD is path to repository
|
# env: PWD is path to repository
|
||||||
run_hook post-update
|
run_hook post-update
|
||||||
|
|
||||||
|
[ ! -r MOTD ] || {
|
||||||
|
log "$PWD" "Printing MOTD"
|
||||||
|
cat MOTD
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1779,7 +1938,7 @@ args() {
|
|||||||
# Ensure that arguments do not contain invalid characters. Wildcards can
|
# Ensure that arguments do not contain invalid characters. Wildcards can
|
||||||
# not be used here as they would conflict with kiss extensions.
|
# not be used here as they would conflict with kiss extensions.
|
||||||
case $action in
|
case $action in
|
||||||
a|alternatives)
|
a|alternatives|p|preferred)
|
||||||
case $1 in *\**|*\!*|*\[*|*\ *|*\]*|*/*|*"$newline"*)
|
case $1 in *\**|*\!*|*\[*|*\ *|*\]*|*/*|*"$newline"*)
|
||||||
die "Invalid argument: '!*[ ]/\\n' ($1)"
|
die "Invalid argument: '!*[ ]/\\n' ($1)"
|
||||||
esac
|
esac
|
||||||
@ -1801,7 +1960,7 @@ args() {
|
|||||||
# of the current directory as the package name and add the parent
|
# of the current directory as the package name and add the parent
|
||||||
# directory to the running process' KISS_PATH.
|
# directory to the running process' KISS_PATH.
|
||||||
case ${action%%"${action#?}"}-$# in [!l]-0)
|
case ${action%%"${action#?}"}-$# in [!l]-0)
|
||||||
export KISS_PATH=${PWD%/*}:$KISS_PATH
|
export KISS_PATH="${PWD%/*}:$KISS_PATH"
|
||||||
set -- "${PWD##*/}"
|
set -- "${PWD##*/}"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -1809,7 +1968,7 @@ args() {
|
|||||||
# files may differ when repositories change. Removal is not dependent on
|
# files may differ when repositories change. Removal is not dependent on
|
||||||
# the state of the repository.
|
# the state of the repository.
|
||||||
case $action in r|remove)
|
case $action in r|remove)
|
||||||
export KISS_PATH=$sys_db:$KISS_PATH
|
export KISS_PATH="$sys_db:$KISS_PATH"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Order the argument list based on dependence.
|
# Order the argument list based on dependence.
|
||||||
@ -1834,18 +1993,21 @@ args() {
|
|||||||
if ok "$1" && ! am_owner "$KISS_ROOT/"; then
|
if ok "$1" && ! am_owner "$KISS_ROOT/"; then
|
||||||
trap_off
|
trap_off
|
||||||
|
|
||||||
|
cd "$ppwd"
|
||||||
as_user env \
|
as_user env \
|
||||||
LOGNAME="$user" \
|
LOGNAME="$user" \
|
||||||
HOME="$HOME" \
|
HOME="$HOME" \
|
||||||
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
|
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
|
||||||
KISS_COMPRESS="$KISS_COMPRESS" \
|
|
||||||
KISS_PATH="$KISS_PATH" \
|
|
||||||
KISS_FORCE="$KISS_FORCE" \
|
|
||||||
KISS_ROOT="$KISS_ROOT" \
|
|
||||||
KISS_CHOICE="$KISS_CHOICE" \
|
KISS_CHOICE="$KISS_CHOICE" \
|
||||||
KISS_COLOR="$KISS_COLOR" \
|
KISS_COLOR="$KISS_COLOR" \
|
||||||
KISS_TMPDIR="$KISS_TMPDIR" \
|
KISS_COMPRESS="$KISS_COMPRESS" \
|
||||||
|
KISS_FORCE="$KISS_FORCE" \
|
||||||
|
KISS_HOOK="$KISS_HOOK" \
|
||||||
|
KISS_PATH="$KISS_PATH" \
|
||||||
KISS_PID="$KISS_PID" \
|
KISS_PID="$KISS_PID" \
|
||||||
|
KISS_ROOT="$KISS_ROOT" \
|
||||||
|
KISS_TMPDIR="$KISS_TMPDIR" \
|
||||||
|
_KISS_DATE="$time" \
|
||||||
_KISS_LVL="$_KISS_LVL" \
|
_KISS_LVL="$_KISS_LVL" \
|
||||||
"$0" "$action" "$@"
|
"$0" "$action" "$@"
|
||||||
|
|
||||||
@ -1864,23 +2026,25 @@ args() {
|
|||||||
H|help-ext) pkg_help_ext "$@" ;;
|
H|help-ext) pkg_help_ext "$@" ;;
|
||||||
i|install) for pkg do pkg_install "$pkg"; done ;;
|
i|install) for pkg do pkg_install "$pkg"; done ;;
|
||||||
l|list) pkg_list_version "$@" ;;
|
l|list) pkg_list_version "$@" ;;
|
||||||
|
p|preferred) pkg_preferred "$@" ;;
|
||||||
r|remove) for pkg in $redro; do pkg_remove "$pkg"; done ;;
|
r|remove) for pkg in $redro; do pkg_remove "$pkg"; done ;;
|
||||||
s|search) for pkg do pkg_find "$pkg" all; done ;;
|
s|search) for pkg do pkg_find "$pkg" all; done ;;
|
||||||
u|update) pkg_update ;;
|
u|update) pkg_update ;;
|
||||||
U|upgrade) pkg_upgrade ;;
|
U|upgrade) pkg_upgrade ;;
|
||||||
v|version) printf '5.5.28\n' ;;
|
v|version) printf '5.6.4\n' ;;
|
||||||
|
|
||||||
'')
|
'')
|
||||||
log 'kiss [a|b|c|d|i|l|r|s|u|U|v] [pkg]...'
|
log 'kiss [a|b|c|d|i|l|p|r|s|u|U|v] [pkg]...'
|
||||||
log 'alternatives List and swap alternatives'
|
log 'alternatives List and swap alternatives'
|
||||||
log 'build Build packages'
|
log 'build Build packages'
|
||||||
log 'checksum Generate checksums'
|
log 'checksum Generate checksums'
|
||||||
log 'download Download sources'
|
log 'download Download sources'
|
||||||
log 'install Install packages'
|
log 'install Install packages'
|
||||||
log 'list List installed packages'
|
log 'list List installed packages'
|
||||||
|
log 'preferred List owners of files with alternatives'
|
||||||
log 'remove Remove packages'
|
log 'remove Remove packages'
|
||||||
log 'search Search for packages'
|
log 'search Search for packages'
|
||||||
log 'update Update the system and repositories'
|
log 'update Update the repositories'
|
||||||
log 'upgrade Update the system'
|
log 'upgrade Update the system'
|
||||||
log 'version Package manager version'
|
log 'version Package manager version'
|
||||||
|
|
||||||
@ -1974,6 +2138,9 @@ main() {
|
|||||||
command -v llvm-readelf
|
command -v llvm-readelf
|
||||||
)"} || cmd_elf=ldd
|
)"} || cmd_elf=ldd
|
||||||
|
|
||||||
|
# b3sum is, for now, the only supported blake3 digest utility.
|
||||||
|
cmd_b3=b3sum
|
||||||
|
|
||||||
# Figure out which sha256 utility is available.
|
# Figure out which sha256 utility is available.
|
||||||
cmd_sha=${KISS_CHK:-"$(
|
cmd_sha=${KISS_CHK:-"$(
|
||||||
command -v openssl ||
|
command -v openssl ||
|
||||||
@ -1981,7 +2148,7 @@ main() {
|
|||||||
command -v sha256 ||
|
command -v sha256 ||
|
||||||
command -v shasum ||
|
command -v shasum ||
|
||||||
command -v digest
|
command -v digest
|
||||||
)"} || die "No sha256 utility found"
|
)"} || war "No sha256 utility found"
|
||||||
|
|
||||||
# Figure out which download utility is available.
|
# Figure out which download utility is available.
|
||||||
cmd_get=${KISS_GET:-"$(
|
cmd_get=${KISS_GET:-"$(
|
||||||
@ -1994,7 +2161,10 @@ main() {
|
|||||||
|
|
||||||
# Store the date and time of script invocation to be used as the name of
|
# Store the date and time of script invocation to be used as the name of
|
||||||
# the log files the package manager creates during builds.
|
# the log files the package manager creates during builds.
|
||||||
time=$(date +%Y-%m-%d-%H:%M)
|
# Accept _KISS_DATE in case this process has been called by a kiss process
|
||||||
|
# started on a different day, which could cause permission issues if we
|
||||||
|
# create log_dir as root.
|
||||||
|
time=${_KISS_DATE:-"$(date +%Y-%m-%d-%H:%M)"}
|
||||||
|
|
||||||
create_tmp_dirs
|
create_tmp_dirs
|
||||||
trap_on
|
trap_on
|
||||||
|
Loading…
Reference in New Issue
Block a user