summaryrefslogtreecommitdiffstats
path: root/bin/reprepro_init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/reprepro_init.sh')
-rwxr-xr-xbin/reprepro_init.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/reprepro_init.sh b/bin/reprepro_init.sh
new file mode 100755
index 0000000..1dc48b5
--- /dev/null
+++ b/bin/reprepro_init.sh
@@ -0,0 +1,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