~nabijaczleweli/klapki.deb

7fdadd86d73a4f1b3ab23cac588f1bac5865a2db — наб 1 year, 26 days ago 3c3cdb2 debian/0.1.0-1
Initial packaging
A debian/changelog => debian/changelog +5 -0
@@ 0,0 1,5 @@
klapki (0.1.0-1) unstable; urgency=medium

  * Initial packaging, upstream version 0.1.0

 -- наб <nabijaczleweli@nabijaczleweli.xyz>  Sat, 26 Sep 2020 14:49:11 +0200

A debian/control => debian/control +32 -0
@@ 0,0 1,32 @@
Source: klapki
Section: admin
Priority: optional
Maintainer: наб <nabijaczleweli@nabijaczleweli.xyz>
Standards-Version: 4.5.0
Rules-Requires-Root: no
Vcs-Git: https://git.sr.ht/~nabijaczleweli/klapki.deb
Vcs-Browser: https://git.sr.ht/~nabijaczleweli/klapki.deb
Homepage: https://sr.ht/~nabijaczleweli/klapki.deb
Build-Depends: debhelper,
               debhelper-compat (= 13),
               libfmt-dev,
               libssl-dev,
               libefivar-dev,
               libefiboot-dev,
               ronn (>= 0.9.0),
#              ^ ronn before that fails with regex+locale related errors
               locales,
#              ^ we need to generate some locales for ronn

Package: klapki
Architecture: linux-any
Depends: ${misc:Depends},
         ${shlibs:Depends},
Tag: implemented-in::c++, admin::boot, interface::commandline, role::program,
 scope::utility
Description: EFI boot manager; or, well, an EFI bootorder compiler.
 klapki(8) generates and manages EFI boot entries on compatible platforms,
 with minimal state and no EFI-side code.
 .
 This package also provides integration with the standard Debian bootloader
 hooks.

A debian/copyright => debian/copyright +32 -0
@@ 0,0 1,32 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: klapki
Upstream-Contact:
 https://lists.sr.ht/~nabijaczleweli/klapki
 https://todo.sr.ht/~nabijaczleweli/klapki
Source: https://git.sr.ht/~nabijaczleweli/klapki

Files: *
Copyright: 2020 наб <nabijaczleweli@nabijaczleweli.xyz>
License: Expat

Files: debian/*
Copyright: 2020 наб <nabijaczleweli@nabijaczleweli.xyz>
License: Expat

License: Expat
 Permission is hereby granted, free of charge, to any person obtaining a copy of
 this software and associated documentation files (the "Software"), to deal in
 the Software without restriction, including without limitation the rights to
 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 the Software, and to permit persons to whom the Software is furnished to do so,
 subject to the following conditions:
 .
 The above copyright notice and this permission notice shall be included in all
 copies or substantial portions of the Software.
 .
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

A debian/description => debian/description +6 -0
@@ 0,0 1,6 @@
#!/bin/sh
[ -f "/etc/os-release" ] && . /etc/os-release
[ -z "$PRETTY_NAME" ] && PRETTY_NAME=Debian

echo "$PRETTY_NAME with Linux $1"
[ -z "$2" ] || echo "($2)"

A debian/klapki.install => debian/klapki.install +5 -0
@@ 0,0 1,5 @@
out/klapki                      /usr/sbin/
debian/description              /usr/share/klapki/
debian/post-update.d/zz-klapki  /etc/initramfs/post-update.d
debian/postinst.d/zz-klapki     /etc/kernel/postinst.d
debian/postrm.d/zz-klapki       /etc/kernel/postrm.d

A debian/klapki.manpages => debian/klapki.manpages +1 -0
@@ 0,0 1,1 @@
man/klapki.8

A debian/klapki.postinst => debian/klapki.postinst +38 -0
@@ 0,0 1,38 @@
#!/bin/sh -e
[ -f "/usr/share/debconf/confmodule" ] && . /usr/share/debconf/confmodule || :


mkdir -p /etc/klapki


#DEBHELPER#


[ -z "$2" ] && {
	# First install: write /etc/klapki/cmdline with the current cmdline
	cmdline="$(awk '{gsub(/(initrd|BOOT_IMAGE)=[^ ]+ ?/, ""); print}' /proc/cmdline)"

	echo "Pre-populating /etc/klapki/cmdline with current cmdline: $cmdline" >&2

	{
		echo "#!/bin/sh"
		echo "echo $cmdline"
	} > /etc/klapki/cmdline
	chmod +x /etc/klapki/cmdline
} || :


[ -f "/usr/share/debconf/confmodule" ] && {
	# First install/reconfiguration: prompt for auto-detect
	db_input high klapki/auto-install || :
	db_go || :

	db_get klapki/auto-install
	[ "$RET" = "true" ] && {
		find /boot -maxdepth 1 -name 'vmlinuz-*' | awk '{
			gsub("/boot/vmlinuz-", "");
			has_initrd = (getline _ < ("/boot/initrd.img-" $1)) >= 0;
			print "addkernel " $1 " /boot/vmlinuz-" $1 (has_initrd ? (" /boot/initrd.img-" $1) : "") " \"\""
		}' | xargs klapki >&2
	} || :
} || :

A debian/klapki.postrm => debian/klapki.postrm +27 -0
@@ 0,0 1,27 @@
#!/bin/sh -e
[ -f "/usr/share/debconf/confmodule" ] && . /usr/share/debconf/confmodule || :


#DEBHELPER#


[ "$1" = "purge" ] || exit 0
# Purge: remove our skeleton from /etc/klapki/cmdline and state variable

rm -f /etc/klapki/cmdline
rmdir /etc/klapki

host="$(cat "/etc/machine-id" || hostname)"
[ -d "/boot/efi/klapki/${host}" ] && {
	echo "Cleaning /boot/efi/klapki/${host}" >&2
	rm -rf "/boot/efi/klapki/${host}"
	rmdir "/boot/efi/klapki" 2>/dev/null || :  # We're the last host on the system if this succeeds; if not, doesn't matter
} || :


hostvar="/sys/firmware/efi/efivars/${host}-a8a9ad3a-f831-11ea-946d-674ccd7415cc"
[ -f "$hostvar" ] || exit 0

echo "Purging EFI variable for current host (${host})" >&2
chattr -i "$hostvar"
rm        "$hostvar"

A debian/klapki.templates => debian/klapki.templates +31 -0
@@ 0,0 1,31 @@
Template: klapki/auto-install
Type: boolean
Default: false
Description: Install all current kernels with klapki?
 This is a first installation of klapki, and klapki doesn't know about
 any present kernels.
 .
 If you say Yes here, current kernels will be detected from /boot
 and added with the default configuration, making your system boot with klapki
 by default (see "bootpos" in klapki(8)).
 .
 If you say No here, no changes will be made to your system,
 and you will have to install the first kernel with
 "klapki addkernel" (see klapki(8)).
 .
 As soon as you install a kernel, klapki will start to integrate
 with kernel and initrd install hooks, so no further action will be necessary.
Description-pl: Zainstalować klapkami wszystkie obecne jądra?
 To jest pierwsza instalacja klapek, i nie wiedzą one
 o żadnych obecnyh w systemie jądrach.
 .
 Jeżeli wybierzesz Tak, zostaną one wykryte z /boot
 i dodane z domyślną konfiguracją, przez co system będzie domyślnie wstawał z klapek
 (por. "bootpos" w klapki(8)).
 .
 Jeżeli wybierzesz Nie, system nie zostanie zmieniony,
 i administrator będzie musiał dodać pierwsze jądro poprzez
 "klapki addkernel" (por. klapki(8)).
 .
 klapki zaczną się integrować z automatyzacją instalacji jąder/initramdysków
 przy instalacji pierwszego jądra, więc nie będzie potrzebna dalsza interwencja.

A debian/klapki.ucf => debian/klapki.ucf +1 -0
@@ 0,0 1,1 @@
/usr/share/klapki/description  /etc/klapki/description

A debian/patches/0001-Use-Debian-package-version-for-KLAPKI_VERSION.patch => debian/patches/0001-Use-Debian-package-version-for-KLAPKI_VERSION.patch +26 -0
@@ 0,0 1,26 @@
From c395825522b67e9cb355ae446179d8685e15ba03 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
Date: Sat, 26 Sep 2020 15:56:36 +0200
Subject: [PATCH] Use Debian package version for KLAPKI_VERSION
X-Mutt-PGP: OS

---
 configMakefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configMakefile b/configMakefile
index 7783cda..cb6f7e9 100644
--- a/configMakefile
+++ b/configMakefile
@@ -46,7 +46,7 @@ else
 	LNCXXAR :=
 endif
 
-KLAPKI_VERSION := "$(patsubst v%,%,$(shell git describe))"
+KLAPKI_VERSION := "$(shell awk "{gsub(\"[()]\", \"\", \$$2); print \$$2; exit}" debian/changelog)"
 
 INCCMAKEAR := CXXFLAGS="$(INCCXXAR)"
 LNCMAKEAR := LDFLAGS="$(LNCXXAR)"
-- 
2.20.1


A debian/patches/series => debian/patches/series +1 -0
@@ 0,0 1,1 @@
0001-Use-Debian-package-version-for-KLAPKI_VERSION.patch

A debian/post-update.d/zz-klapki => debian/post-update.d/zz-klapki +10 -0
@@ 0,0 1,10 @@
#!/bin/sh -e

# https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html
exec </dev/null >&2

host="$(cat "/etc/machine-id" || hostname)"
hostvar="/sys/firmware/efi/efivars/${host}-a8a9ad3a-f831-11ea-946d-674ccd7415cc"
[ -f "$hostvar" ] || echo "post-update: klapki not installed; $@"

exec klapki

A debian/postinst.d/zz-klapki => debian/postinst.d/zz-klapki +15 -0
@@ 0,0 1,15 @@
#!/bin/sh -e

# https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html
exec </dev/null >&2

host="$(cat "/etc/machine-id" || hostname)"
hostvar="/sys/firmware/efi/efivars/${host}-a8a9ad3a-f831-11ea-946d-674ccd7415cc"
[ -f "$hostvar" ] || exit 0

image_path="$2"
[ -z "$image_path" ] && image_path="/boot/vmlinuz-$1" || :

[ -f "/boot/initrd.img-$1" ] && initrd_path="/boot/initrd.img-$1" || initrd_path=""

exec klapki addkernel "$1" "$image_path" $initrd_path ""

A debian/postrm.d/zz-klapki => debian/postrm.d/zz-klapki +10 -0
@@ 0,0 1,10 @@
#!/bin/sh -e

# https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html
exec </dev/null >&2

host="$(cat "/etc/machine-id" || hostname)"
hostvar="/sys/firmware/efi/efivars/${host}-a8a9ad3a-f831-11ea-946d-674ccd7415cc"
[ -f "$hostvar" ] || exit 0

exec klapki delkernel "$1"

A debian/rules => debian/rules +34 -0
@@ 0,0 1,34 @@
#!/usr/bin/make -f


include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS := hardening=+all

CXX := $(CXX) $(subst -O2,,$(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get LDFLAGS))
TEMPDIR = $(CURDIR)/debian/tmp/
VERSION = $(shell awk '/^version/ {print $$3}' Cargo.toml | sed 's/"//g')


override_dh_auto_build:
	mkdir -p $(TEMPDIR)
	localedef -i en_GB -c -f UTF-8 -A /usr/share/locale/locale.alias $(TEMPDIR)en_GB.UTF-8
	LOCPATH="$(TEMPDIR)" LC_CTYPE="en_GB.UTF-8" ronn -r --organization="klapki developers" man/*.md
	$(MAKE) build STRIP="echo > /dev/null" CXX="$(CXX)" OS_LD_LIBS="fmt"

# We don't include Catch2, so no tests for us
override_dh_auto_test:

override_dh_auto_clean:
	rm -f $(wildcard man/*.8)
	$(MAKE) clean

override_dh_installdocs:
	dh_installdocs $(wildcard TODO) README.md

override_dh_ucf:
	dh_ucf -A
	sed -i 's/\tucf /\tucf --debconf-ok /' $(foreach l,inst rm,debian/klapki.post$(l).debhelper)

%:
	dh $@

A debian/source/format => debian/source/format +1 -0
@@ 0,0 1,1 @@
3.0 (quilt)

A debian/watch => debian/watch +3 -0
@@ 0,0 1,3 @@
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/klapki-$1\.tar\.gz/ \
  https://git.sr.ht/~nabijaczleweli/klapki/refs .*/v?(\d\S+)\.tar\.gz