commit 0441520cd16c831d9c6d9924ec78197431590d79 Author: sparklyballs Date: Fri Aug 19 20:23:53 2016 +0100 first save up diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..83ec29f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +FROM lsiobase/alpine +MAINTAINER sparklyballs + +# package version +ARG RDIFF_VER="1.2.8" + +# environment settings +ENV S6_BEHAVIOUR_IF_STAGE2_FAILS="2" + +# copy patches +COPY patches/ /tmp/patches/ + +# install build packages +RUN \ + apk add --no-cache --virtual=build-dependencies \ + curl \ + g++ \ + gcc \ + librsync-dev \ + python-dev \ + tar && \ + +# install runtime packages + apk add --no-cache \ + openssh && \ + +# build rdiff-backup + mkdir -p \ + /tmp/rdiff-src && \ + curl -o \ + /tmp/rdiff.tar.gz -L \ + "http://savannah.nongnu.org/download/rdiff-backup/rdiff-backup-${RDIFF_VER}.tar.gz" && \ + tar xf /tmp/rdiff.tar.gz -C \ + /tmp/rdiff-src --strip-components=1 && \ + cd /tmp/rdiff-src && \ + patch -p1 -i /tmp/patches/rdiff-backup-1.2.8-librsync-1.0.0.patch && \ + python \ + setup.py build && \ + python \ + setup.py install --prefix=/usr --root=/ && \ + +# cleanup + apk del --purge \ + build-dependencies && \ + rm -rf \ + /tmp/* + +# copy local files +COPY root/ / + +# ports and volumes +VOLUME /backup /config diff --git a/patches/rdiff-backup-1.2.8-librsync-1.0.0.patch b/patches/rdiff-backup-1.2.8-librsync-1.0.0.patch new file mode 100644 index 0000000..2513b23 --- /dev/null +++ b/patches/rdiff-backup-1.2.8-librsync-1.0.0.patch @@ -0,0 +1,21 @@ +Patch by Roman Tereshonkov and Kari Hautio for rdiff-backup <= 1.2.8 to avoid a build failure with +librsync >= 1.0.0 (which is a security bugfix release). The discussion and solution finding can be +found at https://bugs.launchpad.net/duplicity/+bug/1416344 (for duplicity). + +--- a/_librsyncmodule.c 2009-03-16 15:36:21.000000000 +0100 ++++ b/_librsyncmodule.c 2015-03-02 00:54:24.000000000 +0100 +@@ -59,8 +59,13 @@ + if (sm == NULL) return NULL; + sm->x_attr = NULL; + ++#ifdef RS_DEFAULT_STRONG_LEN + sm->sig_job = rs_sig_begin((size_t)blocklen, + (size_t)RS_DEFAULT_STRONG_LEN); ++#else ++ sm->sig_job = rs_sig_begin((size_t)blocklen, ++ (size_t)8, RS_MD4_SIG_MAGIC); ++#endif + return (PyObject*)sm; + } + + diff --git a/root/etc/cont-init.d/30-config b/root/etc/cont-init.d/30-config new file mode 100644 index 0000000..fe232ba --- /dev/null +++ b/root/etc/cont-init.d/30-config @@ -0,0 +1,29 @@ +#!/usr/bin/with-contenv bash + +# make folders +mkdir -p \ + /config/ssh \ + /config/cron \ + /root/.ssh + +# check for required config files, exit if not found +[[ ! -e /config/ssh/id_rsa.pub ]] || \ +[[ ! -e /config/ssh/id_rsa ]] || \ +[[ ! -e /config/ssh/config ]] || \ +[[ ! -e /config/ssh/known_hosts ]] || \ +[[ ! -e /config/cron/jobs ]] && \ +( echo "required config not found" && exit 1) + +# copy config +cp -pr /config/ssh/* /root/.ssh/ + +# set cron +crontab /config/cron/jobs + +# permissions +chown -R abc:abc \ + /config +chown -R root:root \ + /root/.ssh +chmod -R 600 \ + /root/.ssh/* diff --git a/root/etc/services.d/cron/run b/root/etc/services.d/cron/run new file mode 100644 index 0000000..9d6dfe3 --- /dev/null +++ b/root/etc/services.d/cron/run @@ -0,0 +1,4 @@ +#!/usr/bin/with-contenv bash + +/usr/sbin/crond -f -S -l 0 -c /etc/crontabs +