Skip to content

Commit f109066

Browse files
authored
fix: fix Linux package scripts (#800)
* reload systemd daemon to make it aware of an updated service file after package update * restart service to use the new binary after a package update * don't stop and disable service after rpm package update fixes #799
1 parent 6d091db commit f109066

File tree

7 files changed

+46
-12
lines changed

7 files changed

+46
-12
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
7+
component: packaging
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Fix Linux package scripts
11+
12+
# One or more tracking issues or pull requests related to the change
13+
issues: [799]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
# Default: '[user]'
25+
change_logs: []

distributions/otelcol-contrib/postinstall.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18+
systemctl daemon-reload
1819
systemctl enable otelcol-contrib.service
1920
if [ -f /etc/otelcol-contrib/config.yaml ]; then
20-
systemctl start otelcol-contrib.service
21+
systemctl restart otelcol-contrib.service
2122
fi
2223
fi

distributions/otelcol-contrib/preremove.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl stop otelcol-contrib.service
19-
systemctl disable otelcol-contrib.service
17+
if [ "$1" != "1" ]; then
18+
if command -v systemctl >/dev/null 2>&1; then
19+
systemctl stop otelcol-contrib.service
20+
systemctl disable otelcol-contrib.service
21+
fi
2022
fi

distributions/otelcol-otlp/postinstall.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18+
systemctl daemon-reload
1819
systemctl enable otelcol-otlp.service
1920
if [ -f /etc/otelcol-otlp/config.yaml ]; then
20-
systemctl start otelcol-otlp.service
21+
systemctl restart otelcol-otlp.service
2122
else
2223
echo "Make sure to configure otelcol-otlp by creating /etc/otelcol-otlp/config.yaml"
2324
fi

distributions/otelcol-otlp/preremove.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl stop otelcol-otlp.service
19-
systemctl disable otelcol-otlp.service
17+
if [ "$1" != "1" ]; then
18+
if command -v systemctl >/dev/null 2>&1; then
19+
systemctl stop otelcol-otlp.service
20+
systemctl disable otelcol-otlp.service
21+
fi
2022
fi

distributions/otelcol/postinstall.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
# limitations under the License.
1616

1717
if command -v systemctl >/dev/null 2>&1; then
18+
systemctl daemon-reload
1819
systemctl enable otelcol.service
1920
if [ -f /etc/otelcol/config.yaml ]; then
20-
systemctl start otelcol.service
21+
systemctl restart otelcol.service
2122
fi
2223
fi

distributions/otelcol/preremove.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
if command -v systemctl >/dev/null 2>&1; then
18-
systemctl stop otelcol.service
19-
systemctl disable otelcol.service
17+
if [ "$1" != "1" ]; then
18+
if command -v systemctl >/dev/null 2>&1; then
19+
systemctl stop otelcol.service
20+
systemctl disable otelcol.service
21+
fi
2022
fi

0 commit comments

Comments
 (0)