24 lines
632 B
Plaintext
Executable File
24 lines
632 B
Plaintext
Executable File
|
|
caddy_install () {
|
|
|
|
local target
|
|
local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
|
|
target=${1:-/opt/caddy}
|
|
[[ -d $target ]] || mkdir -p $target
|
|
echo installing caddy to $target
|
|
if /bin/cp -r -f $dir/caddy/* $target; then
|
|
pushd $target || return
|
|
echo CADDY_DIR=$target >> .env
|
|
cp example.env .env
|
|
source .env
|
|
cp conf/example.conf conf/$CONF.conf
|
|
./config
|
|
else
|
|
echo unable to copy caddy files to $target, install aborted
|
|
fi
|
|
popd || return
|
|
}
|
|
|
|
# if script was executed then call the function
|
|
(return 0 2>/dev/null) || caddy_install $@
|