summaryrefslogtreecommitdiffstats
path: root/bin/reprepro_init.sh
blob: 1dc48b5fb3755e9fca1c164729206eed2a076e5b (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
#!/bin/sh

set -e

REPOSITORY="/srv/$(hostname -f)/packages"
VENDOR="$(hostname -d | awk -F. '{ print $1 }')"

if [ ! -e "${REPOSITORY}/conf" ]
then
	mkdir -p "${REPOSITORY}"

#	git clone reprepro "${REPOSITORY}/conf"
fi

cd "${REPOSITORY}"

for FILE in conf/distributions conf/uploaders
do
	if [ -e "${FILE}" ] || [ ! -e "${FILE}.${VENDOR}" ]
	then
		continue
	fi

	cp "${FILE}.${VENDOR}" "${FILE}"
done

reprepro -b "${REPOSITORY}" --delete createsymlinks

for DIRECTORY in db conf
do
	if [ ! -e "${DIRECTORY}" ]
	then
		continue
	fi

	chmod 0700 "${DIRECTORY}"
done