From 473268a10fd27e644919818a6576f2ed00ff5f2f Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 8 Jul 2024 00:13:04 +0200 Subject: [PATCH] Add variable to stop creation of admin account (#7580) --- contrib/packager.io/functions.sh | 6 +++++- contrib/packager.io/postinstall.sh | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/contrib/packager.io/functions.sh b/contrib/packager.io/functions.sh index b9d9d5bfa0..9087e1e0aa 100755 --- a/contrib/packager.io/functions.sh +++ b/contrib/packager.io/functions.sh @@ -246,7 +246,11 @@ function create_initscripts() { } function create_admin() { - # Create data for admin user + # Create data for admin users - stop with setting SETUP_ADMIN_NOCREATION to true + if [ "${SETUP_ADMIN_NOCREATION}" == "true" ]; then + echo "# Admin creation is disabled - skipping" + return + fi if test -f "${SETUP_ADMIN_PASSWORD_FILE}"; then echo "# Admin data already exists - skipping" diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 297f332ec7..fd1e85a4b1 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -11,7 +11,7 @@ PATH=${APP_HOME}/env/bin:${APP_HOME}/:/sbin:/bin:/usr/sbin:/usr/bin: . ${APP_HOME}/contrib/packager.io/functions.sh # Envs that should be passed to setup commands -export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON +export SETUP_ENVS=PATH,APP_HOME,INVENTREE_MEDIA_ROOT,INVENTREE_STATIC_ROOT,INVENTREE_BACKUP_DIR,INVENTREE_PLUGINS_ENABLED,INVENTREE_PLUGIN_FILE,INVENTREE_CONFIG_FILE,INVENTREE_SECRET_KEY_FILE,INVENTREE_DB_ENGINE,INVENTREE_DB_NAME,INVENTREE_DB_USER,INVENTREE_DB_PASSWORD,INVENTREE_DB_HOST,INVENTREE_DB_PORT,INVENTREE_ADMIN_USER,INVENTREE_ADMIN_EMAIL,INVENTREE_ADMIN_PASSWORD,SETUP_NGINX_FILE,SETUP_ADMIN_PASSWORD_FILE,SETUP_NO_CALLS,SETUP_DEBUG,SETUP_EXTRA_PIP,SETUP_PYTHON,SETUP_ADMIN_NOCREATION # Get the envs detect_local_env @@ -24,6 +24,7 @@ export SETUP_NGINX_FILE=${SETUP_NGINX_FILE:-/etc/nginx/sites-enabled/inventree.c export SETUP_ADMIN_PASSWORD_FILE=${CONF_DIR}/admin_password.txt export SETUP_NO_CALLS=${SETUP_NO_CALLS:-false} export SETUP_PYTHON=${SETUP_PYTHON:-python3.9} +export SETUP_ADMIN_NOCREATION=${SETUP_ADMIN_NOCREATION:-false} # SETUP_DEBUG can be set to get debug info # SETUP_EXTRA_PIP can be set to install extra pip packages # SETUP_PYTHON can be set to use a different python version