Skip to content

Commit bc0766b

Browse files
lavarouZNeumann
andauthored
fix: install correctly on bare bones OSs (#913)
Some OSs stripped down to bare bones (like base OS container images) don't have all directories needed by the installer (e.g. /etc/init.d). Package installers simply create these directories. Make tarball installer behave similar to package installer and create required directories. --------- Co-authored-by: Zach Neumann <[email protected]>
1 parent 68046f3 commit bc0766b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

agent/newrelic-install.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,8 @@ disp_get_php_list() {
852852

853853
set_osdifile() {
854854
osdifile=
855-
if [ -n "${NR_INSTALL_INITFILE}" ]; then
856-
osdifile="${NR_INSTALL_INITFILE}"
855+
if [ -n "${NR_INSTALL_INITSCRIPT}" ]; then
856+
osdifile="${NR_INSTALL_INITSCRIPT}"
857857
fi
858858
if [ "${ostype}" = "darwin" ]; then
859859
: ${osdifile:=/usr/bin/newrelic-daemon-service}
@@ -1780,6 +1780,10 @@ EOF
17801780
set_osdifile
17811781

17821782
if [ -z "${ispkg}" ]; then
1783+
# ensure target directory exists
1784+
if [ ! -d "$(dirname ${osdifile})" ]; then
1785+
logcmd mkdir -p -m 0755 "$(dirname ${osdifile})"
1786+
fi
17831787
if logcmd cp -f "${ilibdir}/scripts/init.${ostype}" "${osdifile}"; then
17841788
logcmd chmod 755 "${osdifile}" || {
17851789
fatal "failed to set permissions on ${osdifile}"
@@ -1798,6 +1802,10 @@ EOF
17981802
fi
17991803

18001804
if [ -n "${sysconf}" -a ! -f "${sysconf}" ]; then
1805+
# ensure target directory exists
1806+
if [ ! -d "$(dirname ${sysconf})" ]; then
1807+
logcmd mkdir -p -m 0755 "$(dirname ${sysconf})"
1808+
fi
18011809
if logcmd cp -f "${ilibdir}/scripts/newrelic.sysconfig" "${sysconf}"; then
18021810
logcmd chmod 755 "${sysconf}" || {
18031811
fatal "failed to set permissions on ${sysconf}"

0 commit comments

Comments
 (0)