summaryrefslogtreecommitdiffstats
path: root/bin/psign.sh
blob: f3353c79634737790fe71f5e29327f281e0983d1 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh

set -e

case "$(basename ${0})" in
	p*)
		MODE="progress-linux"
		;;

	b*)
		MODE="bfh"
		;;
esac

for CHANGES in *.changes
do
	if [ ! -e "${CHANGES}" ]
	then
		continue
	fi

	DISTRIBUTION="$(grep -s -m1 '^Distribution: ' ${CHANGES} | awk '{ print $2 }')"

	case "${MODE}" in
		progress-linux)
			case "${DISTRIBUTION}" in
				engywuck*)
					DESCRIPTION="Progress Linux 5 (engywuck) Archive Key"
					KEY="0x03CED5154316222A"
					;;

				fuchur*)
					DESCRIPTION="Progress Linux 6 (fuchur) Archive Key"
					KEY="0x753373FBB95C4EA6"
					;;

				graograman*)
					DESCRIPTION="Progress Linux 7 (graograman) Archive Key"
					KEY="0x076B33250B5DD18B"
					;;

				*)
					# Debian
					DESCRIPTION="Daniel Baumann (2014) Key"
					KEY="55CF1BF986ABB9C7"
					;;
			esac
			;;

		bfh)
			DESCRIPTION="BFH (2018) Key"
			KEY="0xBFEEA48634831878"
			;;
	esac

	echo "Signing ${CHANGES} with: ${DESCRIPTION}"
	debsign -k${KEY} --re-sign ${CHANGES}
done

for DSC in *.dsc
do
	if [ ! -e "${DSC}" ]
	then
		continue
	fi

	#DISTRIBUTION="$(grep -s -m1 '^Distribution: ' $(echo $PWD | sed -e 's|_source|_all|')/*.changes | awk '{ print $2 }')"
	#DISTRIBUTION="${DISTRIBUTION:-$(grep -s -m1 '^Distribution: ' $(echo $PWD | sed -e 's|_source|_amd64|')/*.changes | awk '{ print $2 }')}"
	#DISTRIBUTION="${DISTRIBUTION:-$(grep -s -m1 '^Distribution: ' $(echo $PWD | sed -e 's|_source|_i386|')/*.changes | awk '{ print $2 }')}"
	#DISTRIBUTION="$(echo ${DISTRIBUTION} | awk '{ print $1 }')"

	DISTRIBUTION="$(awk '/^Vcs-Git:/ { print $2 }' *dsc | awk -F/ '{ print $5 }')"

	case "${MODE}" in
		progress-linux)
			case "${DISTRIBUTION}" in
				engywuck*)
					DESCRIPTION="Progress Linux 5 (engywuck) Archive Key"
					KEY="0x03CED5154316222A"
					;;

				fuchur*)
					DESCRIPTION="Progress Linux 6 (fuchur) Archive Key"
					KEY="0x753373FBB95C4EA6"
					;;

				graograman*)
					DESCRIPTION="Progress Linux 7 (graograman) Archive Key"
					KEY="0x076B33250B5DD18B"
					;;

				*)
					# Debian
					DESCRIPTION="Daniel Baumann (2014) Key"
					KEY="55CF1BF986ABB9C7"
					;;
			esac
			;;

		bfh)
			DESCRIPTION="BFH (2018) Key"
			KEY="0xBFEEA48634831878"
			;;
	esac

	echo "Signing ${DSC} with: ${DESCRIPTION}"
	debsign -k${KEY} --re-sign ${DSC}
done