]> git.armaanb.net Git - bin.git/commitdiff
kiss-hook: add script
authorArmaan Bhojwani <me@armaanb.net>
Tue, 6 Jul 2021 20:33:01 +0000 (16:33 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Tue, 6 Jul 2021 20:33:01 +0000 (16:33 -0400)
kiss-hook [new file with mode: 0755]

diff --git a/kiss-hook b/kiss-hook
new file mode 100755 (executable)
index 0000000..c65bff6
--- /dev/null
+++ b/kiss-hook
@@ -0,0 +1,42 @@
+#!/usr/bin/sh -e
+case $TYPE in
+    pre-extract)
+        [ -t 2 ] && {
+            printf '\033]0;kiss: %s (%d/%d)\a' \
+                "$PKG" "${pkg_cur:-?}" "${pkg_total:-?}" >&2
+        } 
+    ;;
+    pre-build)
+        IFS=. read -r _start_ < /proc/uptime
+    ;;
+
+    post-build)
+        # Ensure that '$DEST' is set.
+        : "${DEST:?DEST is unset}"
+
+        rm -rf "$DEST/usr/share/gettext" \
+               "$DEST/usr/share/polkit-1" \
+               "$DEST/usr/share/locale" \
+               "$DEST/usr/share/info" \
+               "$DEST/usr/lib/charset.alias" \
+               "$DEST/usr/share/icons" \
+               "$DEST/usr/share/zsh" \
+               "$DEST/usr/share/bash-completion" \
+               "$DEST/usr/share/fish" \
+               "$DEST/usr/share/applications" \
+               "$DEST/usr/share/consolefonts" \
+          IFS=. read -r _end _ < /proc/uptime
+
+           (
+               _s=$((_end - _start))
+               _h=$((_s / 60 / 60 % 24))
+               _m=$((_s / 60 % 60))
+
+               [ "$_h" = 0 ] _u="${_u}${_h}h "
+               [ "$_m" = 0 ] _u="${_u}${_m}m "
+
+               log "$PKG" "Build finished in ${_u:-${_s}s}"
+           )   
+    ;;
+esac