Skip to content

Commit

Permalink
letsencrypt: revert pip.conf pre-workaround, tweak cron
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jan 10, 2018
1 parent db322f2 commit 7d105f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion etc/nextcloudpi-config.d/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ configure()
sed -i "/DocumentRoot/aServerName $DOMAIN_" $VHOSTCFG

/etc/letsencrypt/letsencrypt-auto certonly -n --no-self-upgrade --webroot -w $NCDIR --hsts --agree-tos -m $EMAIL_ -d $DOMAIN_ && {
echo "* 1 * * 1 root /etc/letsencrypt/certbot-auto renew --quiet" > /etc/cron.d/letsencrypt-ncp
cat > /etc/cron.weekly/letsencrypt-ncp <<EOF
#!/bin/bash
/etc/letsencrypt/certbot-auto renew --quiet
EOF
chmod +x /etc/cron.weekly/letsencrypt-ncp

sed -i "s|SSLCertificateFile.*|SSLCertificateFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/fullchain.pem|" $VHOSTCFG
sed -i "s|SSLCertificateKeyFile.*|SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN_LOWERCASE/privkey.pem|" $VHOSTCFG
Expand Down
15 changes: 15 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ EOF
grep -q '^ACTIVE_=yes$' nc-backup-auto.sh && activate_script nc-backup-auto.sh
cd - &>/dev/null

# restore pip.conf after workaround
cat > /etc/pip.conf <<EOF
[global]
extra-index-url=https://www.piwheels.hostedpi.com/simple
EOF

# update cron letsencrypt
[[ -f /etc/cron.d/letsencrypt-ncp ]] && rm -f /etc/cron.d/letsencrypt-ncp && {
cat > /etc/cron.weekly/letsencrypt-ncp <<EOF
#!/bin/bash
/etc/letsencrypt/certbot-auto renew --quiet
EOF
chmod +x /etc/cron.weekly/letsencrypt-ncp
}

} # end - only live updates

exit 0
Expand Down

0 comments on commit 7d105f8

Please sign in to comment.