summaryrefslogtreecommitdiffstats
path: root/mkallrepo
blob: 219c47ab1e855aa07cab0c2828b6c11fb2a28321 (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
#!/bin/sh

TMPSIG=$(mktemp)
TMPLNK=$(mktemp)
TMPSIG2=$(mktemp)

cd /home/rpmbuild/site/rpms

#for dep in *.{i386,ppc,ppc64,x86_64} fedora/*/*/{i386,ppc,ppc64,x86_64}
for dep in fedora/{23,24,25,26}/*/{i386,x86_64} enterprise/{6,7}/*/{i386,x86_64}
do
	arch=${dep##*/}

	LST=""
	if [ -d $dep/repodata -a $dep -nt $dep/repodata -a ! -f $dep/.closed ]
	then	echo "== Nouveaux RPM dans $dep =="
		if [ $arch = x86_64 ]
		then
			find $dep -name \*.rpm -a -newer $dep/repodata -print >>$TMPSIG
		else
			find $dep -name \*.noarch.rpm -a -newer $dep/repodata -print >>$TMPLNK
			find $dep -name \*.i?86.rpm -a -newer $dep/repodata -print  >>$TMPSIG
		fi
		
	fi
	
done
find SRPMS -name \*.rpm -a -newer SRPMS/repodata -print >>$TMPSIG


if [ -s $TMPSIG ]; then
    echo "À signer:"; sort < $TMPSIG

    grep fc26    $TMPSIG  > $TMPSIG2
    grep src.rpm $TMPSIG >> $TMPSIG2
    if [ -s $TMPSIG2 ]; then
		echo "== Signature des $(cat $TMPSIG2 | wc -l) nouveaux RPM (new) =="
		if rpmsign --define '_gpg_path /home/remi/.gnupg2017' --define "_gpg_name Remi's RPM repository" --addsign $(cat $TMPSIG2)
		then	echo done.
		else 	exit 1
		fi
	fi

	grep -v fc26 $TMPSIG | grep -v src.rpm > $TMPSIG2
    if [ -s $TMPSIG2 ]; then
		echo "== Signature des $(cat $TMPSIG2 | wc -l) nouveaux RPM (old) =="
		if rpmsign --define '_gpg_path /home/remi/.gnupgrpm' --define "_gpg_name Remi Collet" --addsign $(cat $TMPSIG2)
		then	echo done.
		else 	exit 1
		fi
	fi
else 	echo "Rien à signer."
fi

if [ -s $TMPLNK ]
then	echo "== Création des liens (noarch) =="
	cat $TMPLNK | while read dest
	do
		srce=${dest/\/ppc64/\/x86_64}
		srce=${srce/\/ppc/\/x86_64}
		srce=${srce/\/i386/\/x86_64}

		ln -f $srce $dest && echo $dest
	done
else 	echo "Rien à lier."
fi

#for dep in *.{i386,ppc,ppc64,x86_64} fedora/*/*/{i386,ppc,ppc64,x86_64}
for dep in SRPMS fedora/{23,24,25,26}/*/{i386,x86_64} enterprise/{6,7}/*/{i386,x86_64}
do
	if [ -d $dep/repodata -a $dep -nt $dep/repodata -a ! -f $dep/.closed ]
	then	echo "== Actualisation de $dep =="
		pushd $dep
		mkrepo nocheck
		touch repodata
		popd	
	#else	echo "== $dep est à jour =="
	fi
done