From 340e5b79732774231e1aa0c21b41a24c98e6a3ca Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sat, 10 Jul 2021 21:01:43 +1000 Subject: [PATCH] Clarify that -i can be used to update script links, not jistmake a new config. --- lehook.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lehook.sh b/lehook.sh index fec8bbb..02d10d8 100755 --- a/lehook.sh +++ b/lehook.sh @@ -3,6 +3,17 @@ DIR=$HOME/.lehook configfile=$DIR/config 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() { mkdir -p $DIR if [[ ! -e $configfile ]]; then @@ -29,14 +40,8 @@ EOF else echo "$configfile already exists." fi - 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 "Init complete. Files are in $DIR." - echo "Main binary in /usr/local/bin/lehook.sh." + doinstall + echo "Init complete" } function out() { @@ -99,7 +104,7 @@ function usage() { echo echo " -c Cron mode - only output if something is done." 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 " -s services Only restart the given services [default: $services]" echo " -d domain Only push cert for given domain [default: $domains]."