Skip to content

Commit

Permalink
fix(packaging): don't overwrite existing config on package install (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danxmoran authored Jan 29, 2021
1 parent 552646d commit 58a782a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
9 changes: 8 additions & 1 deletion scripts/post-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ EOF

function init_config {
mkdir -p $(dirname ${INFLUXD_CONFIG_PATH})
cat << EOF > ${INFLUXD_CONFIG_PATH}

local config_path=${INFLUXD_CONFIG_PATH}
if [[ -s ${config_path} ]]; then
config_path=${INFLUXD_CONFIG_PATH}.defaults
echo "Config file ${INFLUXD_CONFIG_PATH} already exists, writing defaults to ${config_path}"
fi

cat << EOF > ${config_path}
bolt-path = "/var/lib/influxdb/influxd.bolt"
engine-path = "/var/lib/influxdb/engine"
EOF
Expand Down
15 changes: 0 additions & 15 deletions scripts/pre-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,3 @@ if [ ! -d "$LOG_DIR" ]; then
mkdir -p $LOG_DIR
chown $USER:$GROUP $DATA_DIR
fi

if [[ -d /etc/opt/influxdb ]]; then
# Legacy configuration found
if [[ ! -d /etc/influxdb ]]; then
# New configuration does not exist, move legacy configuration to new location
echo -e "Please note, InfluxDB's configuration is now located at '/etc/influxdb' (previously '/etc/opt/influxdb')."
mv -vn /etc/opt/influxdb /etc/influxdb

if [[ -f /etc/influxdb/influxdb.conf ]]; then
backup_name="influxdb.conf.$(date +%s).backup"
echo "A backup of your current configuration can be found at: /etc/influxdb/$backup_name"
cp -a /etc/influxdb/influxdb.conf /etc/influxdb/$backup_name
fi
fi
fi

0 comments on commit 58a782a

Please sign in to comment.