Skip to content

Commit 1b1740d

Browse files
authored
Config packaging with nfpm (#13)
This is the final configuration and scripts from this blogpost: https://keith.gaughan.ie/creating-a-signed-rpm-with-nfpm-and-gnupg.html
1 parent d04ced1 commit 1b1740d

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,8 @@ ENV/
101101

102102
# mypy
103103
/.*_cache/
104+
105+
*.rpm
106+
*.deb
107+
*.apk
108+
*.gpg

nfpm.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: socketmap-sql
2+
arch: all
3+
version: $VERSION
4+
depends:
5+
- python3
6+
maintainer: "Keith Gaughan <k@stereochro.me>"
7+
description: |
8+
A socketmap script for interfacing with an SQL database.
9+
homepage: "https://github.com/kgaughan/socketmap-sql/"
10+
license: "MIT"
11+
12+
contents:
13+
- src: ./socketmapsql.py
14+
dst: /usr/libexec/socketmap-sql
15+
file_info:
16+
mode: 0755
17+
18+
rpm:
19+
signature:
20+
key_file: signing.gpg

package.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
usage () {
6+
cat <<FIN
7+
Usage:
8+
$0 [-P]
9+
$0 -h
10+
11+
Flags:
12+
-h show this help
13+
-P prompt for a passphrase; setting NFPM_PASSPHRASE makes this a no-op
14+
15+
FIN
16+
}
17+
18+
while getopts "hP" opt; do
19+
case "$opt" in
20+
h)
21+
usage
22+
exit 0
23+
;;
24+
P)
25+
prompt=1
26+
;;
27+
*)
28+
usage >&2
29+
exit 1
30+
;;
31+
esac
32+
done
33+
34+
if test "${prompt:-}" = "1" && test -z "${NFPM_PASSPHRASE:-}"; then
35+
orig_stty="$(stty -g)"
36+
trap 'stty "$orig_stty"' INT TERM EXIT
37+
stty -echo
38+
printf "passphrase> "
39+
read -r NFPM_PASSPHRASE
40+
stty "$orig_stty"
41+
trap - INT TERM EXIT
42+
echo
43+
export NFPM_PASSPHRASE
44+
fi
45+
46+
VERSION="$(git describe --tags --abbrev=0 || echo "v0.0.0")"
47+
SOURCE_DATE_EPOCH="$(git log -1 --pretty=%ct)"
48+
export VERSION SOURCE_DATE_EPOCH
49+
50+
nfpm package --packager rpm

0 commit comments

Comments
 (0)