Dockerfiles/rsync/bootstrap.sh

24 lines
588 B
Bash
Raw Normal View History

2019-12-27 08:57:28 +00:00
#!/bin/sh
if ! [[ -z "${AUTH_PASSWORD}" ]]; then
echo "$AUTH_PASSWORD" > /etc/rsyncd.secret
2019-12-27 10:27:25 +00:00
chmod 600 /etc/rsyncd.secret
2019-12-27 08:57:28 +00:00
if ! [[ -z "${AUTH_USER}" ]]; then
echo "$AUTH_USER:$AUTH_PASSWORD" > /etc/rsyncd.secrets
fi
fi
if [ -d /config/ ]; then
cp /config/rsync* /etc/
fi
2019-12-27 10:27:25 +00:00
chmod 600 /etc/rsyncd.secrets
2019-12-27 08:57:28 +00:00
if ! [[ -z $@ ]]; then
# use eval because commands likes `key=value command` would cause file not found error when using $@, but this eval will ruin current environment
eval $@
else
rsync --daemon --config=/etc/rsyncd.conf
while pgrep rsync > /dev/null; do sleep 1; done
fi