Added a build.py script for compiling and packaging. Added post and pre install scripts to handle installation and upgrades in a cleaner way. Minor fixes to the init script and service unit file.

This commit is contained in:
Ross McDonald
2016-01-08 09:47:09 -06:00
parent fd6daaa73b
commit 07b4a4dbca
7 changed files with 762 additions and 15 deletions

14
scripts/pre-install.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
if [[ -f /etc/opt/telegraf/telegraf.conf ]]; then
# Legacy configuration found
if [[ ! -d /etc/telegraf ]]; then
# New configuration does not exist, move legacy configuration to new location
echo -e "Please note, Telegraf's configuration is now located at '/etc/telegraf' (previously '/etc/opt/telegraf')."
mv /etc/opt/telegraf /etc/telegraf
backup_name="telegraf.conf.$(date +%s).backup"
echo "A backup of your current configuration can be found at: /etc/telegraf/$backup_name"
cp -a /etc/telegraf/telegraf.conf /etc/telegraf/$backup_name
fi
fi