Compare commits

..

7 commits

Author SHA1 Message Date
c9b0d21d95
Merge pull request #6 from delta523/master
Auto-configure reprepro-distributions from environment variables (#5)
2022-04-25 15:10:27 +02:00
delta
6601b0ef35 fixed for loop on initialization 2021-09-01 00:38:54 +08:00
delta
b04d3be756 used bash for reprepro-import 2021-09-01 00:23:09 +08:00
delta
2cb08138b0 added tempating on start command 2021-08-31 22:22:35 +08:00
delta
d4ab97962e used EASYREPO_SUITES variable for repo init 2021-08-31 22:22:07 +08:00
delta
07ecae0c58 added templating to docker build 2021-08-31 22:21:11 +08:00
delta
10d1df039a added templating for distributions 2021-08-31 22:21:02 +08:00
6 changed files with 61 additions and 7 deletions

View file

@ -27,6 +27,11 @@ RUN chmod 755 /usr/local/sbin/reprepro-import
RUN mkdir -p /var/lib/reprepro/conf RUN mkdir -p /var/lib/reprepro/conf
ADD configs/reprepro-distributions /var/lib/reprepro/conf/distributions ADD configs/reprepro-distributions /var/lib/reprepro/conf/distributions
# reprepro config generator
ADD scripts/create-distros.sh /usr/local/sbin/create-distros
RUN chmod 755 /usr/local/sbin/create-distros
ADD configs/reprepro-distributions.temp /etc/reprepro-distributions.temp
# Configure nginx # Configure nginx
RUN echo "daemon off;" >> /etc/nginx/nginx.conf RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm -f /etc/nginx/sites-enabled/default RUN rm -f /etc/nginx/sites-enabled/default

View file

@ -34,7 +34,7 @@ Fill your ``~/.dput.cf`` with the following content :
login = user login = user
incoming = /docker/incoming incoming = /docker/incoming
ssh_config_options = ssh_config_options =
Port 49160 Port 9022
StrictHostKeyChecking no StrictHostKeyChecking no

View file

@ -0,0 +1,8 @@
Origin: {{EASYREPO_ORIGIN}}
Label: {{EASYREPO_LABEL}}
Suite: {{EASYREPO_SUITE}}
Codename: {{EASYREPO_CODENAME}}
Version: 3.1
Architectures: {{EASYREPO_ARCHITECTURES}}
Components: main non-free contrib
Description: {{EASYREPO_DESCRIPTION}}

32
scripts/create-distros.sh Normal file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
REPREPRO_DIST="${REPREPRO_OVERRIDE:-/var/lib/reprepro/conf/distributions}"
# path to template file
REPREPRO_DIST_TEMP="/etc/reprepro-distributions.temp"
# Default results to configs/reprepro-distributions
EASYREPO_SUITES="${EASYREPO_SUITES:-unstable,sid/stable,buster/testing,bullseye}"
EASYREPO_ORIGIN="${EASYREPO_ORIGIN:-Test Origin}"
EASYREPO_LABEL="${EASYREPO_LABEL:-Easy Debian Repository}"
EASYREPO_ARCHITECTURES="${EASYREPO_ARCHITECTURES:-i386 amd64 powerpc source}"
EASYREPO_DESCRIPTION="${EASYREPO_LABEL:-Easy Debian Repository}"
# Empty the file
echo -n > $REPREPRO_DIST
# Slash delimited
for i in $(echo ${EASYREPO_SUITES} | sed "s/\// /g")
do
g=($(echo $i | sed "s/\,/ /g"))
sed -e "s/{{EASYREPO_ORIGIN}}/${EASYREPO_ORIGIN}/" \
-e "s/{{EASYREPO_LABEL}}/${EASYREPO_LABEL}/" \
-e "s/{{EASYREPO_SUITE}}/${g[0]}/" \
-e "s/{{EASYREPO_CODENAME}}/${g[1]}/" \
-e "s/{{EASYREPO_ARCHITECTURES}}/${EASYREPO_ARCHITECTURES}/" \
-e "s/{{EASYREPO_DESCRIPTION}}/${EASYREPO_DESCRIPTION}/" $REPREPRO_DIST_TEMP >> $REPREPRO_DIST
echo "" >> $REPREPRO_DIST
done
# Remove last line
sed -i '$ d' $REPREPRO_DIST

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
BASEDIR=/var/lib/reprepro BASEDIR=/var/lib/reprepro
INCOMING=/docker/incoming INCOMING=/docker/incoming
@ -11,10 +11,17 @@ cd $INCOMING
cd .. cd ..
#set -x #set -x
reprepro -V --basedir $BASEDIR --outdir $OUTDIR createsymlinks stable
reprepro -V --basedir $BASEDIR --outdir $OUTDIR createsymlinks jessie # Check for EASYREPO_SUITES to create symlinks
reprepro -V --basedir $BASEDIR --outdir $OUTDIR createsymlinks unstable EASYREPO_SUITES="${EASYREPO_SUITES:-unstable,sid/stable,buster/testing,bullseye}"
reprepro -V --basedir $BASEDIR --outdir $OUTDIR createsymlinks sid
for k in $(echo ${EASYREPO_SUITES} | sed "s/\// /g")
do
g=($(echo $k | sed "s/\,/ /g"))
reprepro -V --basedir $BASEDIR --outdir $OUTDIR createsymlinks ${g[0]}
done
# #
# See if we found any new packages # See if we found any new packages
# #

View file

@ -22,7 +22,6 @@ rm -f /home/user/.ssh/authorized_keys
for key in /docker/keys/*.pub ; do for key in /docker/keys/*.pub ; do
echo "- adding key $key" echo "- adding key $key"
cat $key >> /home/user/.ssh/authorized_keys cat $key >> /home/user/.ssh/authorized_keys
printf \\\n >> /home/user/.ssh/authorized_keys
done done
chown -R user /home/user/.ssh chown -R user /home/user/.ssh
@ -31,6 +30,9 @@ crontab <<EOF
* * * * * /usr/local/sbin/reprepro-import >> /var/log/reprepro.log * * * * * /usr/local/sbin/reprepro-import >> /var/log/reprepro.log
EOF EOF
# run distro config generator
/usr/local/sbin/create-distros
# run import once, to create the right directory structure # run import once, to create the right directory structure
/usr/local/sbin/reprepro-import /usr/local/sbin/reprepro-import