@cryptotaxi247 / netdata-1 / commits / e51e990fe

Preserve all file attributes for config backup

Changed `cp -p` (equivalent to `cp --preserve=mode,ownership,timestamps`) to `cp -a` (equivalent to `cp -dR --preserve=AL`) when backing up user configuration before update. This enables the use and preservation of symlinks.

Niels AD committed Jun 14, 2017 at 11:48 UTC e51e990fefe94c89e55b1ca91ae6affee78554d0
1 file changed +3 -3
netdata-installer.sh
+3 -3
@@ -566,7 +566,7 @@ do
566 then
567 # we don't have md5sum - keep it
568 echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RET}is not known to distribution${TPUT_RESET}. Keeping it."
569 - run cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}"
569 + run cp -a "${x}" "${x}.installer_backup.${installer_backup_suffix}"
570 else
571 # find it relative filename
572 f="${x/*\/etc\/netdata\//}"
@@ -587,7 +587,7 @@ do
587 else
588 # edited by user - keep it
589 echo >&2 "File '${TPUT_CYAN}${x}${TPUT_RESET}' ${TPUT_RED} has been edited by user${TPUT_RESET}. Keeping it."
590 - run cp -p "${x}" "${x}.installer_backup.${installer_backup_suffix}"
590 + run cp -a "${x}" "${x}.installer_backup.${installer_backup_suffix}"
591 fi
592 fi
593
@@ -611,7 +611,7 @@ for x in $(find "${NETDATA_PREFIX}/etc/netdata/" -name '*.conf' -type f)
611 do
612 if [ -f "${x}.installer_backup.${installer_backup_suffix}" ]
613 then
614 - run cp -p "${x}.installer_backup.${installer_backup_suffix}" "${x}" && \
614 + run cp -a "${x}.installer_backup.${installer_backup_suffix}" "${x}" && \
615 run rm -f "${x}.installer_backup.${installer_backup_suffix}"
616 fi
617 done