git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/createrepo/bin/createrepo-lirionde
blob: e1356dbc28ba642ce9551e718e81dba3253e6fb8 (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
#!/usr/bin/env bash

declare -a REPOS

REPOSDEF=( 'all' 'el' 'suse' )

function hayulp {
	printf 'USAGE: %b [ -r repo [ -r repo ... ] ]\n' "$(basename "$0")"
	printf '\n'
	(
		printf -- '-r,\n'
		printf -- '--repos;Repo to be published.\n'
		printf ';Specify multiple times for multiple repositores.\n'
		printf ';Default: all, el, suse\n'
	)|column -ts\;
}

while [[ $# -gt 0 ]]; do
	case "$1" in
		"-r"|"--repo")
			REPOS+=( "$2" )
			shift # past argument
			shift # past value
		;;
		"-"*)
			hayulp
			printf '\nUnknown option: %b\n' "$1" >&2
			exit 101
		;;
		*)
			hayulp
			printf '\nWrong syntax.\n' "$1" >&2
			exit 101
		;;
	esac
done

if [ "${#REPOS[@]}" -lt 1 ]; then
	REPOS=( "${REPOSDEF[@]}" )
	# if we can't be sure that indexes are sequential ints:
	# for idx in "${!REPOSDEF[@]}"; do REPOS["$idx"]="${REPOSDEF[$idx]}"; done
fi

for repo in "${REPOS[@]}"; do
	faketime "$(date -I) 13:37:08" createrepo_c --update "/var/cache/rpm/$repo" &&\
	rm -vf "/var/cache/rpm/${repo}/repodata/repomd.xml.asc" &&\
	faketime "$(date -I) 13:37:08" gpg --local-user 0x5421594BF1AB46F4 --detach-sign --armour "/var/cache/rpm/${repo}/repodata/repomd.xml"
done