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 <miguel.bernal.marin@linux.intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This commit is contained in:
Miguel Bernal Marin 2018-09-25 05:38:46 -05:00 committed by wenlingz
parent f3fc857f56
commit b115546b45
4 changed files with 15 additions and 75 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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