-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathentrypoint.reprepro
executable file
·44 lines (34 loc) · 1.43 KB
/
entrypoint.reprepro
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
#!/bin/bash
set -e -o pipefail
function getConfig
{
grep "^${1}" "${REPREPRO_BASE_DIR}/conf/distributions" | awk '{print $2}'
}
# Configure: reprepro
if [[ ! -e "${EP_RUN}" ]] ; then
log "Configuring $(basename "${0}") for first run ..."
export GNUPGHOME="${REPREPRO_HOME}/.gnupg"
mkdir --parents "${REPREPRO_BASE_DIR}/"{conf,incoming,indices,logs,project,tmp}
for i in distributions incoming options uploaders
do
install --group=reprepro --mode=0644 --owner=reprepro /dev/null "${REPREPRO_BASE_DIR}/conf/${i}"
render_template "/usr/local/share/reprepro/${i}" "${REPREPRO_BASE_DIR}/conf/${i}"
done
log "Writing repository.asc ..."
gpg --armor --export --output="${REPREPRO_BASE_DIR}/repository.asc" --yes
log "Writing repository.list ..."
cat <<-EOF > "${REPREPRO_BASE_DIR}/repository.list"
deb https://${REPREPRO_URL}/ ${REPREPRO_CODENAME} ${REPREPRO_COMPONENTS}
deb-src https://${REPREPRO_URL}/ ${REPREPRO_CODENAME} ${REPREPRO_COMPONENTS}
EOF
log "Creating overrides ..."
for i in DebOverride DscOverride UDebOverride
do
log " ${i}"
touch "${REPREPRO_BASE_DIR}/conf/$(getConfig "${i}")"
done
log "Applying ownership and permissions ..."
find "${REPREPRO_BASE_DIR}" \( \! -user reprepro -o \! -group reprepro \) -exec chown reprepro:reprepro {} \;
find "${REPREPRO_BASE_DIR}/incoming" \( \! -user reprepro -o \! -group contrib \) -exec chown reprepro:contrib {} \;
chmod 0775 "${REPREPRO_BASE_DIR}/incoming"
fi