debian: Fix fm bootstrap

This work is part of Debian integration effort.
This fixes issues seen during bootstrap.
This work unifies and enhances:
https://review.opendev.org/c/starlingx/fault/+/833935
https://review.opendev.org/c/starlingx/fault/+/834950

Package binary to correct location.
Fix configuration file ownership.
Let debhelper install the services. Add systemd preset.

Tests on Debian:
PASS: build-pkgs && build-image
PASS: install iso && check the 2 services
PASS: bootstrap with fm workarounds
PASS: unlock

Depends-On: https://review.opendev.org/c/starlingx/fault/+/836660
Story: 2009101
Task: 44321
Co-authored-by: Chuck Short <charles.short@windriver.com>
Co-authored-by: aoliveir <adriano.oliveira@windriver.com>
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I7d460bb7a3ffba429fce42e6dab72fc88e2bc885
This commit is contained in:
Dan Voiculeasa 2022-04-05 14:46:33 +03:00 committed by Bob Church
parent be2ceec7a9
commit 4df485a754
8 changed files with 52 additions and 10 deletions

View File

@ -1,4 +1,3 @@
usr/bin/fmManager
etc/init.d/fminit
etc/logrotate.d/fm.logrotate
usr/lib/systemd/system/fminit.service lib/systemd/system
usr/local/bin/fmManager

View File

@ -0,0 +1,17 @@
[Unit]
Description=StarlingX Fault Management Initialization
After=network.target syslog.target
[Service]
Type=forking
Restart=no
KillMode=process
RemainAfterExit=yes
ExecStart=/etc/init.d/fminit start
ExecStop=/etc/init.d/fminit stop
ExecReload=/etc/init.d/fminit reload
PIDFile=/var/run/fmManager.pid
[Install]
WantedBy=multi-user.target

View File

@ -8,7 +8,10 @@ export ROOT=debian/tmp
override_dh_auto_install:
make DESTDIR=${ROOT} \
BINDIR=/usr/bin \
LIBDIR=/usr/lib \
SYSCONFDIR=/etc \
install
override_dh_installsystemd:
dh_installsystemd --no-enable --name fminit
override_dh_usrlocal:
# Do nothing

View File

@ -0,0 +1,15 @@
[Unit]
Description=Fault Management REST API Service
After=nfscommon.service sw-patch.service
After=network-online.target systemd-udev-settle.service
[Service]
Type=simple
RemainAfterExit=yes
User=root
ExecStart=/etc/init.d/fm-api start
ExecStop=/etc/init.d/fm-api stop
PIDFile=/var/run/fm-api.pid
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,4 @@
debian/systemd/00-fm-rest-api.preset etc/systemd/system-preset
etc/fm/fm.conf
etc/pmon.d/fm-api.conf
etc/init.d
lib/systemd/system
etc/pmon.d/fm-api.conf

View File

@ -0,0 +1,7 @@
#!/bin/sh
set -e
chown fm:fm /etc/fm/fm.conf
#DEBHELPER#

View File

@ -6,14 +6,11 @@ export ROOT=debian/tmp
export FMCONFDIR=$(ROOT)/etc/fm
export PMONDDIR=$(ROOT)/etc/pmon.d
export INITDIR=$(ROOT)/etc/init.d
export UNITDIR=$(ROOT)/lib/systemd/system
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_install:
install -d -m 755 $(UNITDIR)
install -p -D -m 644 scripts/fm-api.service $(UNITDIR)/fm-api.service
install -d -m 755 $(INITDIR)
install -p -D -m 755 scripts/fm-api $(INITDIR)/fm-api
install -d -m 755 $(PMONDDIR)
@ -27,6 +24,9 @@ override_dh_auto_install:
override_dh_fixperms:
dh_fixperms -Xfm.conf
override_dh_installsystemd:
dh_installsystemd --no-enable --name fm-api
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
# (tbogue) FIXME

View File

@ -0,0 +1 @@
enable fm-api.service