kiss: add options to remove junk files

This commit is contained in:
Dylan Araps 2019-10-07 15:07:26 +03:00
parent daa1b364f7
commit 6e4c8f11ff
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

56
kiss
View File

@ -304,6 +304,61 @@ pkg_fixdeps() {
rm -f depends-copy
}
pkg_junk() (
# Optionally remove "junk" files from packages. This includes 'info'
# files, 'man' pages, gettext files, etc. This is configurable by the
# user to enable choice.
#
# This funcion runs as a sub-shell to avoid having to 'cd' back to the
# prior directory before being able to continue.
cd "$pkg_dir/$1"
# Man pages (kept by default).
[ "${KISS_KEEP_MAN:-1}" = 1 ] || {
log "$1" "Removing man pages"
rm -rf usr/share/man
}
# Info files (deleted by default).
[ "${KISS_KEEP_INFO:-0}" = 1 ] || {
log "$1" "Removing info files"
rm -rf usr/share/info
}
# Intl files (deleted by default).
[ "${KISS_KEEP_INTL:-0}" = 1 ] || {
log "$1" "Removing intl files"
rm -rf usr/share/gettext
rm -rf usr/share/locale
}
# Documentation (deleted by default).
[ "${KISS_KEEP_DOC:-0}" = 1 ] || {
log "$1" "Removing documentation"
rm -rf usr/share/doc
rm -rf usr/share/gtk-doc
}
# Shell completions (deleted by default).
[ "${KISS_KEEP_SHCOMP:-0}" = 1 ] || {
log "$1" "Removing shell completions"
rm -rf etc/bash_completion.d
rm -rf usr/share/zsh
}
# Misc junk (deleted by default).
[ "${KISS_KEEP_JUNK:-0}" = 1 ] || {
log "$1" "Removing junk"
rm -rf usr/share/polkit-1
}
)
pkg_manifest() (
# Generate the package's manifest file. This is a list of each file
# and directory inside the package. The file is used when uninstalling
@ -467,6 +522,7 @@ pkg_build() {
pkg_strip "$pkg"
pkg_fixdeps "$pkg"
pkg_junk "$pkg"
pkg_manifest "$pkg"
pkg_tar "$pkg"