shell-host/containers/portainer.inst

26 lines
636 B
Plaintext
Raw Normal View History

2024-02-27 13:37:33 -08:00
portainer_install () {
local target
local dir="$(dirname $(realpath "${BASH_SOURCE:-$0}"))"
target=${1:-/opt/portainer}
[[ -d $target ]] || mkdir -p $target
echo installing portainer to $target
if /bin/cp -f $dir/portainer/* $target; then
pushd $target || return
echo PORTAINER_DIR=$target >> .env
source .env
mkdir -p ${DATA:-$target/data}
./config
./start
sleep 5
./logs
else
echo unable to copy portainer files to $target, install aborted
fi
popd || return
}
# if script was executed then call the function
(return 0 2>/dev/null) || portainer_install $@