Reorganize system directory to better reflect what files are actually used for. (#14544)
* Move systemd-specific system files to their own directory. * Move non-systemd init scripts to individual subdirectories. * Move cron files to their own directory. * Move logrotate config to it’s own directory. * Fix typos in Makefile.am. * Fix Debian package builds. * Fixed issues reported by @andrewm4894.
This commit is contained in:
parent
732654d592
commit
8b93deb7b0
|
@ -115,19 +115,19 @@ web/gui/version.txt
|
|||
/node_modules/
|
||||
/coverage/
|
||||
|
||||
system/netdata-lsb
|
||||
system/netdata-openrc
|
||||
system/netdata-init-d
|
||||
system/netdata.logrotate
|
||||
system/netdata.service
|
||||
system/netdata.service.*
|
||||
system/netdata-updater.service
|
||||
!system/netdata.service.in
|
||||
!system/netdata.service.*.in
|
||||
system/netdata.plist
|
||||
system/netdata-freebsd
|
||||
system/netdata.crontab
|
||||
system/install-service.sh
|
||||
system/netdata.logrotate
|
||||
system/cron/netdata-updater-daily
|
||||
system/freebsd/rc.d/netdata
|
||||
system/initd/init.d/netdata
|
||||
system/launchd/netdata.plist
|
||||
system/lsb/init.d/netdata
|
||||
system/openrc/init.d/netdata
|
||||
system/systemd/netdata.service
|
||||
system/systemd/netdata.service.*
|
||||
system/systemd/netdata-updater.service
|
||||
!system/systemd/netdata.service.in
|
||||
!system/systemd/netdata.service.*.in
|
||||
|
||||
daemon/anonymous-statistics.sh
|
||||
daemon/get-kubernetes-labels.sh
|
||||
|
|
|
@ -10,9 +10,9 @@ BASE_CONFIG = system/netdata.conf
|
|||
SYSTEMD_VERSION = $(shell /bin/sh -c "systemd --version 2>&1 | head -n 1 | cut -f 2 -d ' '")
|
||||
|
||||
ifeq ($(shell test $(SYSTEMD_VERSION) -ge 235 && echo "1"), 1)
|
||||
SYSTEMD_UNIT = system/netdata.service.v235
|
||||
SYSTEMD_UNIT = system/systemd/netdata.service.v235
|
||||
else
|
||||
SYSTEMD_UNIT = system/netdata.service
|
||||
SYSTEMD_UNIT = system/systemd/netdata.service
|
||||
endif
|
||||
|
||||
ifeq ($(shell test `uname -m` != "x86_64" && echo "1"), 1)
|
||||
|
@ -124,7 +124,7 @@ override_dh_fixperms:
|
|||
chmod 4750 $(TOP)-plugin-freeipmi/usr/libexec/netdata/plugins.d/freeipmi.plugin
|
||||
|
||||
override_dh_installlogrotate:
|
||||
cp system/netdata.logrotate debian/netdata.logrotate
|
||||
cp system/logrotate/netdata debian/netdata.logrotate
|
||||
dh_installlogrotate
|
||||
|
||||
override_dh_clean:
|
||||
|
|
|
@ -1059,7 +1059,7 @@ fi
|
|||
# -----------------------------------------------------------------------------
|
||||
progress "Fix generated files permissions"
|
||||
|
||||
run find ./system/ -type f -a \! -name \*.in -a \! -name Makefile\* -a \! -name \*.conf -a \! -name \*.service -a \! -name \*.timer -a \! -name \*.logrotate -a \! -name \.install-type -exec chmod 755 {} \;
|
||||
run chmod 755 ./system/*/init.d/netdata ./system/*/rc.d/netdata ./system/install-service.sh
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
progress "Creating standard user and groups for netdata"
|
||||
|
|
|
@ -287,7 +287,7 @@ install -m 755 -p packaging/installer/netdata-updater.sh "${RPM_BUILD_ROOT}%{_li
|
|||
# ###########################################################
|
||||
# logrotate settings
|
||||
install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
|
||||
install -m 644 -p system/netdata.logrotate "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
|
||||
install -m 644 -p system/logrotate/netdata "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}"
|
||||
|
||||
# ###########################################################
|
||||
# Install freeipmi
|
||||
|
@ -330,11 +330,11 @@ install -m 755 -d "${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{name}/registry"
|
|||
# Install netdata service
|
||||
%if %{with systemd}
|
||||
install -m 755 -d "${RPM_BUILD_ROOT}%{_unitdir}"
|
||||
install -m 644 -p system/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
|
||||
install -m 644 -p system/systemd/netdata.service "${RPM_BUILD_ROOT}%{_unitdir}/netdata.service"
|
||||
%else
|
||||
# install SYSV init stuff
|
||||
install -d "${RPM_BUILD_ROOT}/etc/rc.d/init.d"
|
||||
install -m 755 system/netdata-init-d \
|
||||
install -m 755 system/initd/init.d/netdata \
|
||||
"${RPM_BUILD_ROOT}/etc/rc.d/init.d/netdata"
|
||||
%endif
|
||||
|
||||
|
|
|
@ -470,21 +470,21 @@ install_non_systemd_init() {
|
|||
if [ -d /etc/init.d ] && [ ! -f /etc/init.d/netdata ]; then
|
||||
if expr "${key}" : "^(gentoo|alpine).*"; then
|
||||
echo >&2 "Installing OpenRC init file..."
|
||||
run cp system/netdata-openrc /etc/init.d/netdata &&
|
||||
run cp system/openrc/init.d/netdata /etc/init.d/netdata &&
|
||||
run chmod 755 /etc/init.d/netdata &&
|
||||
run rc-update add netdata default &&
|
||||
return 0
|
||||
|
||||
elif expr "${key}" : "^devuan*" || [ "${key}" = "debian-7" ] || [ "${key}" = "ubuntu-12.04" ] || [ "${key}" = "ubuntu-14.04" ]; then
|
||||
echo >&2 "Installing LSB init file..."
|
||||
run cp system/netdata-lsb /etc/init.d/netdata &&
|
||||
run cp system/lsb/init.d/netdata /etc/init.d/netdata &&
|
||||
run chmod 755 /etc/init.d/netdata &&
|
||||
run update-rc.d netdata defaults &&
|
||||
run update-rc.d netdata enable &&
|
||||
return 0
|
||||
elif expr "${key}" : "^(amzn-201[5678]|ol|CentOS release 6|Red Hat Enterprise Linux Server release 6|Scientific Linux CERN SLC release 6|CloudLinux Server release 6).*"; then
|
||||
echo >&2 "Installing init.d file..."
|
||||
run cp system/netdata-init-d /etc/init.d/netdata &&
|
||||
run cp system/initd/init.d/netdata /etc/init.d/netdata &&
|
||||
run chmod 755 /etc/init.d/netdata &&
|
||||
run chkconfig netdata on &&
|
||||
return 0
|
||||
|
@ -582,7 +582,7 @@ install_netdata_service() {
|
|||
echo >&2 "Installing MacOS X plist file..."
|
||||
# This is used by netdata-installer.sh
|
||||
# shellcheck disable=SC2034
|
||||
run cp system/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist &&
|
||||
run cp system/launchd/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist &&
|
||||
run launchctl load /Library/LaunchDaemons/com.github.netdata.plist &&
|
||||
NETDATA_START_CMD="launchctl start com.github.netdata" &&
|
||||
NETDATA_STOP_CMD="launchctl stop com.github.netdata"
|
||||
|
@ -592,7 +592,7 @@ install_netdata_service() {
|
|||
elif [ "${uname}" = "FreeBSD" ]; then
|
||||
# This is used by netdata-installer.sh
|
||||
# shellcheck disable=SC2034
|
||||
run cp system/netdata-freebsd /etc/rc.d/netdata && NETDATA_START_CMD="service netdata start" &&
|
||||
run cp system/freebsd/rc.d/netdata /etc/rc.d/netdata && NETDATA_START_CMD="service netdata start" &&
|
||||
NETDATA_STOP_CMD="service netdata stop" &&
|
||||
NETDATA_INSTALLER_START_CMD="service netdata onestart" &&
|
||||
myret=$?
|
||||
|
@ -621,7 +621,7 @@ install_netdata_service() {
|
|||
fi
|
||||
|
||||
echo >&2 "Installing systemd service..."
|
||||
run cp system/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" &&
|
||||
run cp system/systemd/netdata.service "${SYSTEMD_DIRECTORY}/netdata.service" &&
|
||||
run systemctl daemon-reload &&
|
||||
${ENABLE_NETDATA_IF_PREVIOUSLY_ENABLED} &&
|
||||
return 0
|
||||
|
@ -848,7 +848,7 @@ install_netdata_logrotate() {
|
|||
if [ "${UID}" -eq 0 ]; then
|
||||
if [ -d /etc/logrotate.d ]; then
|
||||
if [ ! -f /etc/logrotate.d/netdata ]; then
|
||||
run cp system/netdata.logrotate /etc/logrotate.d/netdata
|
||||
run cp system/logrotate/netdata /etc/logrotate.d/netdata
|
||||
fi
|
||||
|
||||
if [ -f /etc/logrotate.d/netdata ]; then
|
||||
|
@ -1076,8 +1076,8 @@ install_netdata_updater() {
|
|||
fi
|
||||
|
||||
if issystemd && [ -n "$(get_systemd_service_dir)" ]; then
|
||||
cat "${NETDATA_SOURCE_DIR}/system/netdata-updater.timer" > "$(get_systemd_service_dir)/netdata-updater.timer"
|
||||
cat "${NETDATA_SOURCE_DIR}/system/netdata-updater.service" > "$(get_systemd_service_dir)/netdata-updater.service"
|
||||
cat "${NETDATA_SOURCE_DIR}/system/systemd/netdata-updater.timer" > "$(get_systemd_service_dir)/netdata-updater.timer"
|
||||
cat "${NETDATA_SOURCE_DIR}/system/systemd/netdata-updater.service" > "$(get_systemd_service_dir)/netdata-updater.service"
|
||||
fi
|
||||
|
||||
sed -i -e "s|THIS_SHOULD_BE_REPLACED_BY_INSTALLER_SCRIPT|${NETDATA_USER_CONFIG_DIR}/.environment|" "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1
|
||||
|
|
|
@ -29,11 +29,7 @@ run cp \
|
|||
packaging/makeself/install-or-update.sh \
|
||||
packaging/installer/functions.sh \
|
||||
configs.signatures \
|
||||
system/netdata-init-d \
|
||||
system/netdata-lsb \
|
||||
system/netdata-openrc \
|
||||
system/netdata.logrotate \
|
||||
system/netdata.service \
|
||||
system/logrotate/netdata \
|
||||
"${NETDATA_INSTALL_PATH}/system/"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
|
||||
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
|
||||
CLEANFILES = \
|
||||
netdata-openrc \
|
||||
netdata.logrotate \
|
||||
netdata.service \
|
||||
netdata.service.v235 \
|
||||
netdata-init-d \
|
||||
netdata-lsb \
|
||||
netdata-freebsd \
|
||||
netdata.plist \
|
||||
netdata.crontab \
|
||||
netdata-updater.service \
|
||||
cron/netdata-updater-daily \
|
||||
freebsd/rc.d/netdata \
|
||||
initd/init.d/netdata \
|
||||
launchd/netdata.plist \
|
||||
logrotate/netdata \
|
||||
lsb/init.d/netdata \
|
||||
openrc/init.d/netdata \
|
||||
systemd/netdata.service \
|
||||
systemd/netdata.service.v235 \
|
||||
systemd/netdata-updater.service \
|
||||
$(NULL)
|
||||
|
||||
include $(top_srcdir)/build/subst.inc
|
||||
|
@ -26,44 +26,86 @@ dist_config_DATA = \
|
|||
.install-type \
|
||||
$(NULL)
|
||||
|
||||
libsyscrondir=$(libsysdir)/cron
|
||||
libsysfreebsddir=$(libsysdir)/freebsd
|
||||
libsysfreebsdrcddir=$(libsysfreebsddir)/rc.d
|
||||
libsysinitddir=$(libsysdir)/initd
|
||||
libsysinitdinitddir=$(libsysinitddir)/init.d
|
||||
libsyslaunchddir=$(libsysdir)/launchd
|
||||
libsyslogrotatedir=$(libsysdir)/logrotate
|
||||
libsyslsbdir=$(libsysdir)/lsb
|
||||
libsyslsbinitddir=$(libsyslsbdir)/init.d
|
||||
libsysopenrcdir=$(libsysdir)/openrc
|
||||
libsysopenrcinitddir=$(libsysopenrcdir)/init.d
|
||||
libsyssystemddir=$(libsysdir)/systemd
|
||||
|
||||
# Explicitly install directories to avoid permission issues due to umask
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(configdir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsysdir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsyscrondir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsysfreebsdrcddir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsysinitdinitddir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsyslaunchddir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsyslogrotatedir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsyslsbinitddir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsyssystemddir)
|
||||
$(INSTALL) -d $(DESTDIR)$(libsysopenrcinitddir)
|
||||
|
||||
libexecnetdatadir=$(libexecdir)/netdata
|
||||
nodist_libexecnetdata_SCRIPTS = \
|
||||
install-service.sh \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsys_DATA = \
|
||||
netdata-openrc \
|
||||
netdata.logrotate \
|
||||
netdata.service \
|
||||
netdata.service.v235 \
|
||||
netdata-init-d \
|
||||
netdata-lsb \
|
||||
netdata-freebsd \
|
||||
netdata.plist \
|
||||
netdata.crontab \
|
||||
netdata-updater.service \
|
||||
nodist_libsyscron_DATA = \
|
||||
cron/netdata-updater-daily \
|
||||
$(NULL)
|
||||
|
||||
dist_libsys_DATA = \
|
||||
netdata-updater.timer \
|
||||
nodist_libsysfreebsdrcd_DATA = \
|
||||
freebsd/rc.d/netdata \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsysinitdinitd_DATA = \
|
||||
initd/init.d/netdata \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsyslaunchd_DATA = \
|
||||
launchd/netdata.plist \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsyslogrotate_DATA = \
|
||||
logrotate/netdata \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsyslsbinitd_DATA = \
|
||||
lsb/init.d/netdata \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsysopenrcinitd_DATA = \
|
||||
openrc/init.d/netdata \
|
||||
$(NULL)
|
||||
|
||||
nodist_libsyssystemd_DATA = \
|
||||
systemd/netdata.service \
|
||||
systemd/netdata.service.v235 \
|
||||
systemd/netdata-updater.service \
|
||||
$(NULL)
|
||||
|
||||
dist_libsyssystemd_DATA = \
|
||||
systemd/netdata-updater.timer \
|
||||
$(NULL)
|
||||
|
||||
dist_noinst_DATA = \
|
||||
install-service.sh.in \
|
||||
netdata-openrc.in \
|
||||
netdata.logrotate.in \
|
||||
netdata.service.in \
|
||||
netdata.service.v235.in \
|
||||
netdata-init-d.in \
|
||||
netdata-lsb.in \
|
||||
netdata-freebsd.in \
|
||||
netdata.plist.in \
|
||||
netdata.conf \
|
||||
netdata.crontab.in \
|
||||
netdata-updater.service.in \
|
||||
cron/netdata-updater-daily.in \
|
||||
freebsd/rc.d/netdata.in \
|
||||
initd/init.d/netdata.in \
|
||||
launchd/netdata.plist.in \
|
||||
logrotate/netdata.in \
|
||||
lsb/init.d/netdata.in \
|
||||
openrc/init.d/netdata.in \
|
||||
systemd/netdata.service.in \
|
||||
systemd/netdata.service.v235.in \
|
||||
systemd/netdata-updater.service.in \
|
||||
$(NULL)
|
||||
|
|
|
@ -102,7 +102,7 @@ valid_types() {
|
|||
}
|
||||
|
||||
install_generic_service() {
|
||||
svc_type="${1}"
|
||||
svc_path="${1}"
|
||||
svc_type_name="${2}"
|
||||
svc_file="${3}"
|
||||
svc_enable_hook="${4}"
|
||||
|
@ -113,7 +113,7 @@ install_generic_service() {
|
|||
ENABLE="enable"
|
||||
fi
|
||||
|
||||
if ! install -p -m 0755 -o 0 -g 0 "${SVC_SOURCE}/netdata-${svc_type}" "${svc_file}"; then
|
||||
if ! install -p -m 0755 -o 0 -g 0 "${SVC_SOURCE}/${svc_path}/netdata" "${svc_file}"; then
|
||||
error "Failed to install service file."
|
||||
exit 4
|
||||
fi
|
||||
|
@ -236,10 +236,10 @@ get_systemd_service_dir() {
|
|||
}
|
||||
|
||||
install_systemd_service() {
|
||||
SRCFILE="${SVC_SOURCE}/netdata.service"
|
||||
SRCFILE="${SVC_SOURCE}/systemd/netdata.service"
|
||||
|
||||
if [ "$(systemctl --version | head -n 1 | cut -f 2 -d ' ')" -le 235 ]; then
|
||||
SRCFILE="${SVC_SOURCE}/netdata.service.v235"
|
||||
SRCFILE="${SVC_SOURCE}/systemd/netdata.service.v235"
|
||||
fi
|
||||
|
||||
if [ "${ENABLE}" = "auto" ]; then
|
||||
|
@ -341,7 +341,7 @@ disable_openrc() {
|
|||
}
|
||||
|
||||
install_openrc_service() {
|
||||
install_generic_service openrc OpenRC /etc/init.d/netdata enable_openrc disable_openrc
|
||||
install_generic_service openrc/init.d OpenRC /etc/init.d/netdata enable_openrc disable_openrc
|
||||
}
|
||||
|
||||
openrc_cmds() {
|
||||
|
@ -399,7 +399,7 @@ disable_lsb() {
|
|||
}
|
||||
|
||||
install_lsb_service() {
|
||||
install_generic_service lsb LSB /etc/init.d/netdata enable_lsb disable_lsb
|
||||
install_generic_service lsb/init.d LSB /etc/init.d/netdata enable_lsb disable_lsb
|
||||
}
|
||||
|
||||
lsb_cmds() {
|
||||
|
@ -454,7 +454,7 @@ disable_initd() {
|
|||
}
|
||||
|
||||
install_initd_service() {
|
||||
install_generic_service init-d init.d /etc/init.d/netdata enable_initd disable_initd
|
||||
install_generic_service initd/init.d init.d /etc/init.d/netdata enable_initd disable_initd
|
||||
}
|
||||
|
||||
initd_cmds() {
|
||||
|
@ -552,7 +552,7 @@ disable_freebsd() {
|
|||
}
|
||||
|
||||
install_freebsd_service() {
|
||||
install_generic_service freebsd "FreeBSD rc.d" /usr/local/etc/rc.d/netdata enable_freebsd disable_freebsd
|
||||
install_generic_service freebsd/rc.d "FreeBSD rc.d" /usr/local/etc/rc.d/netdata enable_freebsd disable_freebsd
|
||||
}
|
||||
|
||||
freebsd_cmds() {
|
||||
|
@ -566,7 +566,7 @@ freebsd_cmds() {
|
|||
|
||||
install_darwin_service() {
|
||||
info "Installing macOS plist file for launchd."
|
||||
if ! install -C -S -p -m 0644 -o 0 -g 0 system/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist; then
|
||||
if ! install -C -S -p -m 0644 -o 0 -g 0 system/launchd/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist; then
|
||||
error "Failed to copy plist file."
|
||||
exit 4
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue