docker-debian-repository/scripts/start.sh
Nick Andrew 082b56789e Set the crontab directly
Saves a temporary file when the HERE-document is already a temp file.
2014-11-17 01:27:02 +11:00

37 lines
912 B
Bash

#!/bin/sh
# Many thanks to John Fink <john.fink@gmail.com> for the
# inspiration and to his great work on docker-wordpress'
# reset root password
# let's create a user to SSH into
SSH_USERPASS=`pwgen -c -n -1 8`
mkdir /home/user
useradd -G sudo -d /home/user -s /bin/bash user
chown -R user /home/user
chown -R user /docker/incoming
echo "user:$SSH_USERPASS" | chpasswd
echo "ssh user password: $SSH_USERPASS"
# pre-fill with SSH keys
echo "Pre-loading SSH keys from /docker/keys"
mkdir -p /home/user/.ssh
rm -f /home/user/.ssh/authorized_keys
for key in /docker/keys/*.pub ; do
echo "- adding key $key"
cat $key >> /home/user/.ssh/authorized_keys
done
chown -R user /home/user/.ssh
# load crontab for root
crontab <<EOF
* * * * * /usr/local/sbin/reprepro-import >> /var/log/reprepro.log
EOF
# run import once, to create the right directory structure
/usr/local/sbin/reprepro-import
supervisord -n