hooks

my cpt hooks
git clone git://git.ckyln.com/hooks
Log | Files | Refs | README

commit 272825edf536efc4ccf7c0f59e69a3fd880b7a0b
Author: Cem Keylan <cem@ckyln.com>
Date:   Wed, 12 Aug 2020 11:24:41 +0300

initial commit

Diffstat:
A.gitignore | 1+
Abuild-fail | 1+
Alib | 25+++++++++++++++++++++++++
Apost-build/bash | 1+
Apost-build/less | 4++++
Apost-build/picom | 1+
Apost-build/post-build | 13+++++++++++++
Apost-install/linux | 4++++
Apost-install/post-install | 4++++
Apre-build/bash | 21+++++++++++++++++++++
Apre-build/calcurse | 1+
Apre-build/less | 1+
Apre-build/pinentry | 17+++++++++++++++++
Apre-build/pre-build | 8++++++++
Apre-fetch | 1+
Apre-install/linux | 4++++
Apre-install/pre-install | 5+++++
17 files changed, 112 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +cpt-hook diff --git a/build-fail b/build-fail @@ -0,0 +1 @@ +build_end failed diff --git a/lib b/lib @@ -0,0 +1,25 @@ +# -*- mode: sh -*- + +getrdname() { + # Retrieve the kernel name to generate appropriate ramfs image + while read -r file; do + case "$file" in /boot/vmlinuz*) ;; *) continue; esac + file=${file##/boot/vmlinuz-} + printf '/boot/initrd-%s.img\n' "$file" + done < "/var/db/kiss/installed/$PKG/manifest" +} + +build_end() { + IFS=. read -r end _ < /proc/uptime + ( + second=$(( end - start )) + buildtime=$(printf '%02d:%02d:%02d' \ + "$(( second / 3600 ))" \ + "$(( second % 3600 / 60 ))" \ + "$(( second % 60 ))") + + log "$PKG" "Build $1 in $buildtime" + ) +} + +printf 'TYPE=%s PKG=%s DEST=%s\n' "$TYPE" "$PKG" "$DEST" diff --git a/post-build/bash b/post-build/bash @@ -0,0 +1 @@ +rm -rf "$DEST/usr/share/doc" "$DEST/usr/share/info" "$DEST/usr/lib" diff --git a/post-build/less b/post-build/less @@ -0,0 +1,4 @@ +# -*- mode: sh -*- + +mv "$DEST/usr/bin/less" "$DEST/usr/bin/gless" +ln -sf gless "$DEST/usr/bin/less" diff --git a/post-build/picom b/post-build/picom @@ -0,0 +1 @@ +rm -rf "$DEST/usr/share" diff --git a/post-build/post-build b/post-build/post-build @@ -0,0 +1,13 @@ +# -*- mode: sh -*- +build_end finished + +rm -rf "$DEST/usr/share/gettext" \ + "$DEST/usr/share/gtk-doc" + +[ -d "$DEST/usr/share/man" ] && + find "$DEST/usr/share/man" -type d ! -name 'man*' -exec rm -rf {} + + +# Restore any previous flags +export CFLAGS="$oCFLAGS" +export CXXFLAGS="$oCXXFLAGS" +export LDFLAGS="$oLDFLAGS" diff --git a/post-install/linux b/post-install/linux @@ -0,0 +1,4 @@ +# -*- mode: sh -*- + +log "$PKG" "Regenerating grub configuration" +grub-mkconfig -o /boot/grub/grub.cfg diff --git a/post-install/post-install b/post-install/post-install @@ -0,0 +1,4 @@ +# -*- mode: sh -*- + +# Run the 'linux' script for potential kernel packages. +case "$PKG" in linux-[4-9].[0-9]*) . "$KISS_HOOK_DIR/post-install/linux"; esac diff --git a/pre-build/bash b/pre-build/bash @@ -0,0 +1,21 @@ +cat <<EOF> .build.cpt +#!/bin/sh -e + +for patch in bash50-0??; do + patch -p0 < "\$patch" +done + +export LDFLAGS=-static + +./configure \ + --prefix=/usr \ + --without-bash-malloc \ + --disable-nls + +export MAKEFLAGS="TERMCAP_LIB=/usr/lib/libncursesw.a $MAKEFLAGS" + +make +make DESTDIR="\$1" install + +ln -s bash "\$1/usr/bin/sh" +EOF diff --git a/pre-build/calcurse b/pre-build/calcurse @@ -0,0 +1 @@ +export LDFLAGS=-static diff --git a/pre-build/less b/pre-build/less @@ -0,0 +1 @@ +export LDFLAGS="$LDFLAGS -static" diff --git a/pre-build/pinentry b/pre-build/pinentry @@ -0,0 +1,17 @@ +cat <<EOF> .build.cpt +#!/bin/sh -e + +./configure \ + --prefix=/usr \ + --enable-fallback-curses \ + --enable-pinentry-emacs \ + --disable-libsecret \ + --disable-pinentry-gtk2 \ + --without-libcap \ + --disable-rpath \ + --enable-pinentry-tty \ + --enable-pinentry-curses + +make +make DESTDIR="\$1" install +EOF diff --git a/pre-build/pre-build b/pre-build/pre-build @@ -0,0 +1,8 @@ +# -*- mode: sh -*- + +IFS=. read -r start _ < /proc/uptime + +# Record flags so we can restore them after the build is finished. +oCFLAGS="$CFLAGS" +oCXXFLAGS="$CXXFLAGS" +oLDFLAGS="$LDFLAGS" diff --git a/pre-fetch b/pre-fetch @@ -0,0 +1 @@ +git -C "$HOME/.local/repositories/community" checkout master >/dev/null 2>&1 ||: diff --git a/pre-install/linux b/pre-install/linux @@ -0,0 +1,4 @@ +# -*- mode: sh -*- + +# Remove previously installed ramdisk image +rm -f "$(getrdname)" diff --git a/pre-install/pre-install b/pre-install/pre-install @@ -0,0 +1,4 @@ +# -*- mode: sh -*- + +# Run the 'linux' script for potential kernel packages. +case "$PKG" in linux-[4-9].[0-9]*) . "$KISS_HOOK_DIR/post-install/linux"; esac+ \ No newline at end of file