From 38de2e6d04cdca4c10f6a4a76dbe8bf444488020 Mon Sep 17 00:00:00 2001
From: "dylan.araps@gmail.com" <dylan.araps@gmail.com>
Date: Mon, 7 Oct 2019 12:07:25 +0000
Subject: kiss: add options to remove junk files

FossilOrigin-Name: 2f76d12705ce7d092a95330ee7822c3d3663aab6937076f465a19163dce0753f
---
 kiss | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

(limited to 'kiss')

diff --git a/kiss b/kiss
index 93ba4ed..3d8ac4e 100755
--- a/kiss
+++ b/kiss
@@ -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"
 
-- 
cgit v1.2.3