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