From b115546b45fcc18ecbd0e361220ad9e968804a1c Mon Sep 17 00:00:00 2001 From: Miguel Bernal Marin Date: Tue, 25 Sep 2018 05:38:46 -0500 Subject: [PATCH] crashlog: deprecate acrnprobe_prepare and update Makefile The `crashlogctl` command is replacing acrnprobe_prepare script. So, let's remove from the project, and update the Makefile with the new content. Tracked-On: #1386 Signed-off-by: Miguel Bernal Marin Reviewed-by: Zhi Jin Acked-by: Chen Gang --- tools/acrn-crashlog/Makefile | 20 ++++--- tools/acrn-crashlog/data/acrnprobe_prepare.sh | 56 ------------------- tools/acrn-crashlog/data/crashlogctl | 2 + tools/acrn-crashlog/data/prepare.service | 12 ---- 4 files changed, 15 insertions(+), 75 deletions(-) delete mode 100755 tools/acrn-crashlog/data/acrnprobe_prepare.sh delete mode 100644 tools/acrn-crashlog/data/prepare.service diff --git a/tools/acrn-crashlog/Makefile b/tools/acrn-crashlog/Makefile index f52e27144..3f74c99dc 100644 --- a/tools/acrn-crashlog/Makefile +++ b/tools/acrn-crashlog/Makefile @@ -102,24 +102,27 @@ install: @install -p -D -m 0755 $(BUILDDIR)/usercrash/bin/debugger $(DESTDIR)/usr/bin/ @install -p -D -m 0755 $(BUILDDIR)/usercrash/bin/usercrash_c $(DESTDIR)/usr/bin/ @install -p -D -m 0755 $(BUILDDIR)/usercrash/bin/usercrash_s $(DESTDIR)/usr/bin/ - @install -p -D -m 0755 data/acrnprobe_prepare.sh $(DESTDIR)/usr/bin/ + @install -p -D -m 0755 data/crashlogctl $(DESTDIR)/usr/bin/ @install -p -D -m 0755 data/usercrash-wrapper $(DESTDIR)/usr/bin/ @install -d $(DESTDIR)/usr/share/acrn/crashlog @install -p -D -m 0644 data/40-watchdog.conf $(DESTDIR)/usr/share/acrn/crashlog + @install -p -D -m 0644 data/80-coredump.conf $(DESTDIR)/usr/share/acrn/crashlog @install -d $(DESTDIR)/usr/share/defaults/telemetrics/ @install -p -D -m 0644 data/acrnprobe.xml $(DESTDIR)/usr/share/defaults/telemetrics/ @install -d $(DESTDIR)/usr/lib/systemd/system/ @install -p -D -m 0644 data/acrnprobe.service $(DESTDIR)/usr/lib/systemd/system/ - @install -p -D -m 0644 data/prepare.service $(DESTDIR)/usr/lib/systemd/system/ @install -p -D -m 0644 data/usercrash.service $(DESTDIR)/usr/lib/systemd/system/ + @install -d $(DESTDIR)/usr/lib/tmpfiles.d + @install -p -D -m 0644 data/acrn-crashlog-dirs.conf $(DESTDIR)/usr/lib/tmpfiles.d/ .PHONY:uninstall uninstall: @if [ -e "$(DESTDIR)/usr/bin/acrnprobe" ];then \ $(RM) $(DESTDIR)/usr/bin/acrnprobe; \ fi - @if [ -e "$(DESTDIR)/usr/bin/acrnprobe_prepare.sh" ];then \ - $(RM) $(DESTDIR)/usr/bin/acrnprobe_prepare.sh; \ + @if [ -e "$(DESTDIR)/usr/bin/crashlogctl" ];then \ + $(DESTDIR)/usr/bin/crashlogctl disable && \ + $(RM) $(DESTDIR)/usr/bin/crashlogctl; \ fi @if [ -e "$(DESTDIR)/usr/bin/debugger" ];then \ $(RM) $(DESTDIR)/usr/bin/debugger; \ @@ -136,15 +139,18 @@ uninstall: @if [ -e "$(DESTDIR)/usr/share/acrn/crashlog/40-watchdog.conf" ];then \ $(RM) $(DESTDIR)/usr/share/acrn/crashlog/40-watchdog.conf; \ fi + @if [ -e "$(DESTDIR)/usr/share/acrn/crashlog/80-coredump.conf" ];then \ + $(RM) $(DESTDIR)/usr/share/acrn/crashlog/80-coredump.conf; \ + fi @if [ -e "$(DESTDIR)/usr/share/defaults/telemetrics/acrnprobe.xml" ];then \ $(RM) $(DESTDIR)/usr/share/defaults/telemetrics/acrnprobe.xml; \ fi @if [ -e "$(DESTDIR)/usr/lib/systemd/system/acrnprobe.service" ];then \ $(RM) $(DESTDIR)/usr/lib/systemd/system/acrnprobe.service; \ fi - @if [ -e "$(DESTDIR)/usr/lib/systemd/system/prepare.service" ];then \ - $(RM) $(DESTDIR)/usr/lib/systemd/system/prepare.service; \ - fi @if [ -e "$(DESTDIR)/usr/lib/systemd/system/usercrash.service" ];then \ $(RM) $(DESTDIR)/usr/lib/systemd/system/usercrash.service; \ fi + @if [ -e "$(DESTDIR)/usr/lib/tmpfiles.d/acrn-crashlog-dirs.conf" ];then \ + $(RM) $(DESTDIR)/usr/lib/tmpfiles.d/acrn-crashlog-dirs.conf; \ + fi diff --git a/tools/acrn-crashlog/data/acrnprobe_prepare.sh b/tools/acrn-crashlog/data/acrnprobe_prepare.sh deleted file mode 100755 index a198ee97d..000000000 --- a/tools/acrn-crashlog/data/acrnprobe_prepare.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -# -# Copyright (C) <2018> Intel Corporation -# SPDX-License-Identifier: BSD-3-Clause -# - -core_pattern_conf="/proc/sys/kernel/core_pattern" -crashlog_path="/var/log/crashlog" - -if [ ! -d $crashlog_path ]; then - mkdir -p $crashlog_path -fi - -# backup the default core_pattern -cat $core_pattern_conf > /var/log/crashlog/default_core_pattern - -# update the content of core_pattern, passdown all the parameters -echo "|/usr/bin/usercrash-wrapper %E %P %u %g %s %t %c %h %e %p %i %I %d" > $core_pattern_conf - -default_conf="/usr/share/defaults/telemetrics/telemetrics.conf" -user_conf="/etc/telemetrics/telemetrics.conf" - -grep -q "record_server_delivery_enabled=false" $user_conf -if [ "$?" -eq "0" ];then - exit; -fi - -telemd_services=( -hprobe.timer -telemd-update-trigger.service -pstore-clean.service -pstore-probe.service -oops-probe.service -klogscanner.service -journal-probe.service -bert-probe.service -) - -mkdir -p $(dirname $user_conf) -cp $default_conf $user_conf - -for ((i=0;i<${#telemd_services[*]};i++)) -do - if [ ! -L "/etc/systemd/system/${telemd_services[$i]}" ];then - systemctl mask ${telemd_services[$i]} --now - fi -done - -# modify the configure file - -sed -i "s/server_delivery_enabled=true/server_delivery_enabled=false/g" $user_conf -sed -i "s/record_retention_enabled=false/record_retention_enabled=true/g" $user_conf - -# restart telemd -sleep 3 -systemctl restart telemd.service diff --git a/tools/acrn-crashlog/data/crashlogctl b/tools/acrn-crashlog/data/crashlogctl index 7c30fb5a2..ab84fe766 100755 --- a/tools/acrn-crashlog/data/crashlogctl +++ b/tools/acrn-crashlog/data/crashlogctl @@ -3,6 +3,8 @@ # Copyright (C) <2018> Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # +# crashlogctl is part of acrn-hypervisor. +# declare -a CRASHLOG_SERVICES=( acrnprobe.service diff --git a/tools/acrn-crashlog/data/prepare.service b/tools/acrn-crashlog/data/prepare.service deleted file mode 100644 index 430ba35e5..000000000 --- a/tools/acrn-crashlog/data/prepare.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=ACRN probe prepare -Requires=telemd.service -After=telemd.service -Before=acrnprobe.service - -[Service] -Type=oneshot -ExecStart=/bin/sh /usr/bin/acrnprobe_prepare.sh - -[Install] -WantedBy=multi-user.target