1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-11-19 13:00:05 -07:00
kiss/contrib/kiss-export
2020-09-09 13:41:58 +03:00

32 lines
696 B
Bash
Executable File

#!/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/"
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 > "$OLDPWD/$pkg#$ver-$rel.tar.${KISS_COMPRESS:-gz}"
printf 'created %s\n' "$OLDPWD/$pkg#$ver-$rel.tar.${KISS_COMPRESS:-gz}"