3
3
%define debug_package %{nil }
4
4
%define __os_install_post %{_dbpath }/brp-compress
5
5
6
- Name: newrelic-netcore20 -agent
6
+ Name: newrelic-dotnet -agent
7
7
Version: %{getenv:AGENT_VERSION }
8
8
Release: 1
9
9
License: Apache Software License 2.0
10
10
Vendor: New Relic, Inc.
11
11
Group: Development/Languages
12
- Summary: The New Relic .NET agent for .NET Core
12
+ Summary: The New Relic agent for .NET Core
13
+ Obsoletes: newrelic-netcore20-agent
13
14
14
15
URL: http://newrelic.com/
15
16
BuildRoot: %{_tmppath }/%{name }-%{version }-%{release }-root
@@ -19,7 +20,7 @@ SOURCE0: %{name}-%{version}.tar.gz
19
20
20
21
%description
21
22
The New Relic .NET agent monitors applications running
22
- on .NET Core 2.0 +.
23
+ on .NET Core 3.1 +.
23
24
24
25
%prep
25
26
%setup -q
@@ -44,19 +45,43 @@ rm -rf %{buildroot}
44
45
45
46
%post
46
47
NEWRELIC_HOME=/usr/local/%{name }
47
-
48
- # Deprecated instrumentation files to remove post install
49
- rm -f $NEWRELIC_HOME/extensions/NewRelic.Providers.Wrapper.Logging.Instrumentation.xml 2> /dev/null
50
- rm -f $NEWRELIC_HOME/extensions/NewRelic.Providers.Wrapper.Logging.dll 2> /dev/null
48
+ OBSOLETE_PACKAGE_NAME=newrelic-netcore20-agent
49
+ OBSOLETE_NEWRELIC_HOME=/usr/local/${OBSOLETE_PACKAGE_NAME}
51
50
52
51
# create logs dir
53
52
mkdir -p $NEWRELIC_HOME/logs 2> /dev/null
54
53
55
- if [ ! -L /var/log/newrelic/dotnet ]; then
56
- mkdir -p /var/log/newrelic 2> /dev/null
57
- ln -sTf $NEWRELIC_HOME/logs /var/log/newrelic/dotnet 2> /dev/null
54
+ # create symlink to logs dir in /var/log/newrelic
55
+ mkdir -p /var/log/newrelic 2> /dev/null
56
+ ln -sTf $NEWRELIC_HOME/logs /var/log/newrelic/dotnet 2> /dev/null
57
+
58
+ # remove old profile.d file if it exists
59
+ oldHomeDirFile= "/etc/profile.d/${OBSOLETE_PACKAGE_NAME}-path.sh"
60
+ if [ -e $oldHomeDirFile ]; then
61
+ echo "Cleaning up $oldHomeDirFile"
62
+ rm -f $oldHomeDirFile
58
63
fi
59
64
65
+ # migrate data from obsoleted package, if applicable
66
+ if [ -d $OBSOLETE_NEWRELIC_HOME ]; then
67
+ echo "Migrating user data from $OBSOLETE_NEWRELIC_HOME"
68
+
69
+ # migrate config file, backing up original first
70
+ if [ -e $OBSOLETE_NEWRELIC_HOME/newrelic.config ]; then
71
+ mv $NEWRELIC_HOME/newrelic.config $NEWRELIC_HOME/newrelic.config.original
72
+ cp -v $OBSOLETE_NEWRELIC_HOME/newrelic.config $NEWRELIC_HOME/newrelic.config
73
+ fi
74
+
75
+ # migrate any custom instrumentation
76
+ if [ -d $OBSOLETE_NEWRELIC_HOME/extensions ]; then
77
+ cp -nv $OBSOLETE_NEWRELIC_HOME/extensions/*.xml $NEWRELIC_HOME/extensions
78
+ fi
79
+ fi
80
+
81
+ # Deprecated instrumentation files to remove post install
82
+ rm -f $NEWRELIC_HOME/extensions/NewRelic.Providers.Wrapper.Logging.Instrumentation.xml 2> /dev/null
83
+ rm -f $NEWRELIC_HOME/extensions/NewRelic.Providers.Wrapper.Logging.dll 2> /dev/null
84
+
60
85
echo "export CORECLR_NEWRELIC_HOME= ${NEWRELIC_HOME}" > /etc/profile.d/%{name }-path.sh
61
86
source /etc/profile.d/%{name }-path.sh
62
87
0 commit comments