diff --git a/.chloggen/fix_linux_package_scripts.yaml b/.chloggen/fix_linux_package_scripts.yaml new file mode 100644 index 00000000..27852fa9 --- /dev/null +++ b/.chloggen/fix_linux_package_scripts.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: packaging + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix Linux package scripts + +# One or more tracking issues or pull requests related to the change +issues: [799] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/distributions/otelcol-contrib/postinstall.sh b/distributions/otelcol-contrib/postinstall.sh index 3ec790ba..6287fbe2 100755 --- a/distributions/otelcol-contrib/postinstall.sh +++ b/distributions/otelcol-contrib/postinstall.sh @@ -15,8 +15,9 @@ # limitations under the License. if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload systemctl enable otelcol-contrib.service if [ -f /etc/otelcol-contrib/config.yaml ]; then - systemctl start otelcol-contrib.service + systemctl restart otelcol-contrib.service fi fi diff --git a/distributions/otelcol-contrib/preremove.sh b/distributions/otelcol-contrib/preremove.sh index 5739d608..a2d1b799 100755 --- a/distributions/otelcol-contrib/preremove.sh +++ b/distributions/otelcol-contrib/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol-contrib.service - systemctl disable otelcol-contrib.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol-contrib.service + systemctl disable otelcol-contrib.service + fi fi diff --git a/distributions/otelcol-otlp/postinstall.sh b/distributions/otelcol-otlp/postinstall.sh index 27402a41..c847f3ba 100755 --- a/distributions/otelcol-otlp/postinstall.sh +++ b/distributions/otelcol-otlp/postinstall.sh @@ -15,9 +15,10 @@ # limitations under the License. if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload systemctl enable otelcol-otlp.service if [ -f /etc/otelcol-otlp/config.yaml ]; then - systemctl start otelcol-otlp.service + systemctl restart otelcol-otlp.service else echo "Make sure to configure otelcol-otlp by creating /etc/otelcol-otlp/config.yaml" fi diff --git a/distributions/otelcol-otlp/preremove.sh b/distributions/otelcol-otlp/preremove.sh index 1323e27f..8610a35f 100755 --- a/distributions/otelcol-otlp/preremove.sh +++ b/distributions/otelcol-otlp/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol-otlp.service - systemctl disable otelcol-otlp.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol-otlp.service + systemctl disable otelcol-otlp.service + fi fi diff --git a/distributions/otelcol/postinstall.sh b/distributions/otelcol/postinstall.sh index deb601cd..f30895ff 100755 --- a/distributions/otelcol/postinstall.sh +++ b/distributions/otelcol/postinstall.sh @@ -15,8 +15,9 @@ # limitations under the License. if command -v systemctl >/dev/null 2>&1; then + systemctl daemon-reload systemctl enable otelcol.service if [ -f /etc/otelcol/config.yaml ]; then - systemctl start otelcol.service + systemctl restart otelcol.service fi fi diff --git a/distributions/otelcol/preremove.sh b/distributions/otelcol/preremove.sh index 363e4de7..adef459f 100755 --- a/distributions/otelcol/preremove.sh +++ b/distributions/otelcol/preremove.sh @@ -14,7 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -if command -v systemctl >/dev/null 2>&1; then - systemctl stop otelcol.service - systemctl disable otelcol.service +if [ "$1" != "1" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl stop otelcol.service + systemctl disable otelcol.service + fi fi