Merge remote-tracking branch 'refs/remotes/origin/master'
This commit is contained in:
commit
2d8ea1e8ec
25
lehook.sh
25
lehook.sh
|
@ -3,6 +3,17 @@ DIR=$HOME/.lehook
|
||||||
configfile=$DIR/config
|
configfile=$DIR/config
|
||||||
VALIDMODES="deploy|renew|generate|test"
|
VALIDMODES="deploy|renew|generate|test"
|
||||||
|
|
||||||
|
function doinstall() {
|
||||||
|
echo "Creating hardlinks in $DIR..."
|
||||||
|
cp -f $0 $DIR/lehook.sh
|
||||||
|
for x in pre post deploy; do
|
||||||
|
ln -f $DIR/lehook.sh $DIR/lehook-${x}.sh
|
||||||
|
done
|
||||||
|
ln -f $DIR/lehook.sh /usr/local/bin/lehook.sh
|
||||||
|
echo "Install complete. Files are in $DIR."
|
||||||
|
echo "Main binary in /usr/local/bin/lehook.sh."
|
||||||
|
}
|
||||||
|
|
||||||
function doinit() {
|
function doinit() {
|
||||||
mkdir -p $DIR
|
mkdir -p $DIR
|
||||||
if [[ ! -e $configfile ]]; then
|
if [[ ! -e $configfile ]]; then
|
||||||
|
@ -116,7 +127,7 @@ function usage() {
|
||||||
echo
|
echo
|
||||||
echo " -c Cron mode - only output if something is done."
|
echo " -c Cron mode - only output if something is done."
|
||||||
echo " -f Push out certs even if they haven't changed."
|
echo " -f Push out certs even if they haven't changed."
|
||||||
echo " -i Iniitalise new config file in $configfile"
|
echo " -i Install files in $DIR and generate config if it doesn't exist."
|
||||||
echo " -r remotes Only push certs to the given remotes [default: $remotes]"
|
echo " -r remotes Only push certs to the given remotes [default: $remotes]"
|
||||||
echo " -s services Only restart the given services [default: $services]"
|
echo " -s services Only restart the given services [default: $services]"
|
||||||
echo " -d domain Only push cert for given domain [default: $domains]."
|
echo " -d domain Only push cert for given domain [default: $domains]."
|
||||||
|
@ -254,6 +265,15 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
function needsrestart() {
|
||||||
|
local sname rv
|
||||||
|
sname=$1
|
||||||
|
rv=1
|
||||||
|
if [[ $sname == "dovecot" ]]; then
|
||||||
|
rv=0
|
||||||
|
fi
|
||||||
|
return $rv
|
||||||
|
}
|
||||||
|
|
||||||
function wait_for_dns_update() { # wait_for_dns_update domain value
|
function wait_for_dns_update() { # wait_for_dns_update domain value
|
||||||
local ns record
|
local ns record
|
||||||
|
@ -423,6 +443,9 @@ elif [[ $mode == "deploy" ]]; then
|
||||||
for s in $services; do
|
for s in $services; do
|
||||||
if [[ $enabled == *$s* ]]; then
|
if [[ $enabled == *$s* ]]; then
|
||||||
reloadcmd=$(echo "$reloadcmd" | sed -e "s/XX/$s/")
|
reloadcmd=$(echo "$reloadcmd" | sed -e "s/XX/$s/")
|
||||||
|
if needsrestart $s; then
|
||||||
|
reloadcmd=$(echo "$reloadcmd" | sed -e "s/reload/restart/")
|
||||||
|
fi
|
||||||
dossh $r $s "$reloadcmd"
|
dossh $r $s "$reloadcmd"
|
||||||
thisrv=$?
|
thisrv=$?
|
||||||
rv=$((rv + $thisrv))
|
rv=$((rv + $thisrv))
|
||||||
|
|
Loading…
Reference in New Issue