From 5310063612f068ef512a7d15043b08f160f5069c Mon Sep 17 00:00:00 2001 From: Armaan Bhojwani Date: Tue, 6 Jul 2021 16:33:01 -0400 Subject: [PATCH] kiss-hook: add script --- kiss-hook | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 kiss-hook diff --git a/kiss-hook b/kiss-hook new file mode 100755 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 -- 2.39.2