install: only write initial config for first time installs

This prevents an upgrade from unintentionally populating
the config directory when a legacy install exists.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2022-10-06 10:30:41 -04:00 committed by Eric Callahan
parent 9021fbea48
commit 485c723a3c
1 changed files with 5 additions and 2 deletions

View File

@ -80,7 +80,8 @@ init_data_path()
[ ! -e "${logs_dir}" ] && mkdir ${logs_dir}
[ ! -e "${env_dir}" ] && mkdir ${env_dir}
[ -n "${CONFIG_PATH}" ] && config_file=${CONFIG_PATH}
if [ ! -e "${config_file}" ]; then
# Write initial configuration for first time installs
if [ ! -f $SERVICE_FILE ] && [ ! -e "${config_file}" ]; then
report_status "Writing Config File ${config_file}:\n"
/bin/sh -c "cat > ${config_file}" << EOF
# Moonraker Configuration File
@ -105,7 +106,6 @@ install_script()
{
# Create systemd service file
ENV_FILE="${DATA_PATH}/systemd/moonraker.env"
SERVICE_FILE="${SYSTEMDDIR}/${INSTANCE_ALIAS}.service"
if [ ! -f $ENV_FILE ] || [ $FORCE_DEFAULTS = "y" ]; then
rm -f $ENV_FILE
args="MOONRAKER_ARGS=\"${SRCDIR}/moonraker/moonraker.py"
@ -236,6 +236,9 @@ if [ -z "${DATA_PATH}" ]; then
fi
fi
fi
SERVICE_FILE="${SYSTEMDDIR}/${INSTANCE_ALIAS}.service"
# Run installation steps defined above
verify_ready
cleanup_legacy