certrenew.service/setup.sh

25 lines
677 B
Bash

#!/bin/sh
baseURL=https://raw.githubusercontent.com/sup39/certrenew.service/master
dst=/etc/systemd/system
if [ ! -w "$dst" ]; then
echo "$dst is not writable. Download to /tmp instead"
dst=/tmp
fi
wget -P "$dst" "$baseURL/certrenew.service" "$baseURL/certrenew.timer"
cat <<EOF
Next step:
(1) Edit $dst/certrenew.service
(2) Run the following commands:
sudo systemctl daemon-reload
sudo systemctl enable certrenew.service
sudo systemctl start certrenew.service certrenew.timer
EOF
if [ -z "$EDITOR" ]; then
for EDITOR in vim vi nano ""; do
if command -v "$EDITOR" &>/dev/null; then break; fi
done
fi
[ -z "$EDITOR" ] || "$EDITOR" "$dst/certrenew.service"