chore: Update permissions on new installs (#13778)

This commit is contained in:
Joshua Powers 2023-08-28 13:49:22 -06:00 committed by GitHub
parent 904db01e6b
commit 54028a9184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 8 deletions

View File

@ -356,7 +356,7 @@ $(include_packages):
--url https://github.com/influxdata/telegraf \
--license MIT \
--maintainer support@influxdb.com \
--config-files /etc/telegraf/telegraf.conf \
--config-files /etc/telegraf/telegraf.conf.sample \
--config-files /etc/telegraf/telegraf.d/.ignore \
--config-files /etc/logrotate.d/telegraf \
--after-install scripts/rpm/post-install.sh \
@ -472,6 +472,7 @@ windows_i386.zip windows_amd64.zip windows_arm64.zip: export EXEEXT := .exe
%.deb: export localstatedir := /var
%.rpm: export pkg := rpm
%.rpm: export prefix := /usr
%.rpm: export conf_suffix := .sample
%.rpm: export sysconfdir := /etc
%.rpm: export localstatedir := /var
%.tar.gz: export pkg := tar

View File

@ -1,6 +1,5 @@
#!/bin/bash
LOG_DIR=/var/log/telegraf
SCRIPT_DIR=/usr/lib/telegraf/scripts
function install_init {
@ -45,11 +44,16 @@ fi
# If 'telegraf.conf' is not present use package's sample (fresh install)
if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then
cp /etc/telegraf/telegraf.conf.sample /etc/telegraf/telegraf.conf
chmod 640 /etc/telegraf/telegraf.conf
chmod 750 /etc/telegraf/telegraf.d
fi
test -d $LOG_DIR || mkdir -p $LOG_DIR
chown -R -L telegraf:telegraf $LOG_DIR
chmod 755 $LOG_DIR
LOG_DIR=/var/log/telegraf
test -d $LOG_DIR || {
mkdir -p $LOG_DIR
chown -R -L telegraf:telegraf $LOG_DIR
chmod 755 $LOG_DIR
}
STATE_DIR=/var/lib/telegraf
test -d "$STATE_DIR" || {

View File

@ -22,13 +22,17 @@ fi
# If 'telegraf.conf' is not present use package's sample (fresh install)
if [[ ! -f /etc/telegraf/telegraf.conf ]] && [[ -f /etc/telegraf/telegraf.conf.sample ]]; then
cp /etc/telegraf/telegraf.conf.sample /etc/telegraf/telegraf.conf
chmod 640 /etc/telegraf/telegraf.conf
chmod 750 /etc/telegraf/telegraf.d
fi
# Set up log directories
LOG_DIR=/var/log/telegraf
test -d $LOG_DIR || mkdir -p $LOG_DIR
chown -R -L telegraf:telegraf $LOG_DIR
chmod 755 $LOG_DIR
test -d $LOG_DIR || {
mkdir -p $LOG_DIR
chown -R -L telegraf:telegraf $LOG_DIR
chmod 755 $LOG_DIR
}
STATE_DIR=/var/lib/telegraf
test -d "$STATE_DIR" || {