From 7972a0a77563507871720049fb038b167337b8a6 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 18 May 2021 17:43:51 +0200 Subject: [PATCH] Update run --- portainer/rootfs/etc/services.d/portainer/run | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/portainer/rootfs/etc/services.d/portainer/run b/portainer/rootfs/etc/services.d/portainer/run index d4c5cc260..f09fc667a 100644 --- a/portainer/rootfs/etc/services.d/portainer/run +++ b/portainer/rootfs/etc/services.d/portainer/run @@ -15,18 +15,22 @@ bashio::log.info "Starting Portainer..." # SET PASSWORD # ################ +# Set password CURRENTPASSWORD="" PASSWORD=$(bashio::config 'password') - touch "/data/portainer_password" CURRENTPASSWORD=$( cat /data/portainer_password ) -if [ "$CURRENTPASSWORD" != "$PASSWORD" ]; then -rm /data/portainer.db || true -rm data/hidden || true -bashio::log.warning "... password changed, database reseted" +# Reset password if not first run +if bashio::fs.file_exists "/data/hidden"; then + if [ "$CURRENTPASSWORD" != "$PASSWORD" ]; then + rm /data/portainer.db || true + rm data/hidden || true + bashio::log.warning "... password changed, database reseted" + fi fi +# Define option echo -n $PASSWORD > /data/portainer_password options+=(--admin-password-file /data/portainer_password) bashio::log.info "... password set to $PASSWORD"