Avoid systemd at build

OBS-URL: https://build.opensuse.org/package/show/Base:System/blog?expand=0&rev=49
This commit is contained in:
Dr. Werner Fink 2021-12-03 08:19:58 +00:00 committed by Git OBS Bridge
parent 29d84c4400
commit 75b70c3749
4 changed files with 15 additions and 115 deletions

View File

@ -17,7 +17,7 @@
Name: blog
Version: 2.24
Version: 2.26
%define sonum 2
Release: 0
Summary: Boot logging
@ -26,12 +26,9 @@ Group: System/Base
URL: https://github.com/bitstreamout/showconsole
Source: https://github.com/bitstreamout/showconsole/archive/v%{version}.tar.gz#/showconsole-%{version}.tar.gz
Source1: blog-rpmlintrc
Patch0: fcb9e0c2.patch
#!BuildIgnore: bash-sh
BuildRequires: suse-module-tools
BuildRequires: systemd
Requires(post): coreutils
Requires: systemd
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: sysvinit-tools:/sbin/blogd
Suggests: blog-plymouth = %{version}
@ -83,7 +80,6 @@ the LSB startproc command.
%prep
%setup -q -n showconsole-%version
%patch0
%build
make %{?_smp_mflags} CC="%__cc" \
@ -106,17 +102,20 @@ make %{?_smp_mflags} CC="%__cc" \
BOOT_LOGFILE=%{_localstatedir}/log/boot.log \
BOOT_OLDLOGFILE=%{_localstatedir}/log/boot.old
%post
%{?regenerate_initrd_post}
test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%postun
test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || :
rm -vf %{buildroot}%{_unitdir}/systemd-ask-password-blog.service.wants/systemd-vconsole-setup.service
%post -n libblogger%{sonum} -p /sbin/ldconfig
%postun -n libblogger%{sonum} -p /sbin/ldconfig
%posttrans
%post plymouth
ln -sf ../systemd-vconsole-setup.service %{_unitdir}/systemd-ask-password-blog.service.wants/
test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%{?regenerate_initrd_post}
%postun plymouth
test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%posttrans plymouth
%{?regenerate_initrd_posttrans}
%files
@ -186,6 +185,6 @@ test -x /bin/systemctl && /bin/systemctl daemon-reload >/dev/null 2>&1 || :
%{_unitdir}/sysinit.target.wants/systemd-ask-password-blog.path
%{_unitdir}/shutdown.target.wants/blog-final.service
%{_unitdir}/local-fs-pre.target.wants/blog-umount.service
%{_unitdir}/systemd-ask-password-blog.service.wants/systemd-vconsole-setup.service
%ghost %{_unitdir}/systemd-ask-password-blog.service.wants/systemd-vconsole-setup.service
%changelog

View File

@ -1,99 +0,0 @@
diff --git blogctl.8 blogctl.8
index 93f29b4..cbbfc06 100644
--- blogctl.8
+++ blogctl.8
@@ -53,6 +53,14 @@ This let the daemon disconnect from system console.
.TP
.B reactivate
Whereas this cause the daemon reconnect to system console.
+.TP
+.B final
+Let rename the daemon an open log file
+.I /var/log/boot.log
+to the new name
+.I /var/log/boot.old
+as well as mask it own program name in the process table
+with the @ character.
.SH SEE ALSO
.BR blogd (8),
.BR systemd (1),
diff --git blogd.c blogd.c
index 9f322e9..0ca0f9e 100644
--- blogd.c
+++ blogd.c
@@ -221,7 +221,6 @@ static volatile pid_t pid = -1;
static void flush_handler (void) attribute((noinline));
static void exit_handler (void) attribute((noinline));
-volatile char *arg0;
/*
* Now do the job
@@ -230,6 +229,7 @@ int main(int argc, char *argv[])
{
char ptsname[NAME_MAX+1];
const char *tty, *stt;
+ volatile char *arg0;
struct console *c;
struct termios o;
struct winsize w;
@@ -248,6 +248,7 @@ int main(int argc, char *argv[])
warn("could not tell system to show its status");
arg0 = (volatile char*)argv[0];
+ remember_arg0(arg0);
while ((arg = getopt(argc, argv, "f")) != -1) {
switch (arg) {
diff --git libconsole/console.c libconsole/console.c
index b3a499b..89ae1e5 100644
--- libconsole/console.c
+++ libconsole/console.c
@@ -50,7 +50,17 @@
#endif
int final = 0;
-extern volatile char *arg0;
+static volatile char *_arg0;
+
+/*
+ * Avoid trouble if linked with e.g. blogger as there
+ * is no external arg0 but linker on ppc64 and s390/x
+ * seems to expect this.
+ */
+void remember_arg0(volatile char *arg0)
+{
+ _arg0 = arg0;
+}
/*
* Used to ignore some signals during epoll_pwait(2) or ppoll(2)
@@ -1044,13 +1054,13 @@ static void socket_handler(int fd)
enqry = ANSWER_ACK;
safeout(fd, enqry, strlen(enqry)+1, SSIZE_MAX);
- if (!final) {
+ if (!final && _arg0) {
int ret;
final = 1;
- if (arg0[0] != '@')
- arg0[0] = '@';
+ if (_arg0[0] != '@')
+ _arg0[0] = '@';
ret = rename(BOOT_LOGFILE, BOOT_OLDLOGFILE);
if (ret < 0) {
diff --git libconsole/libconsole.h libconsole/libconsole.h
index d14fda5..7151d16 100644
--- libconsole/libconsole.h
+++ libconsole/libconsole.h
@@ -122,6 +122,7 @@ extern int evmax;
extern volatile sig_atomic_t signaled;
extern volatile sig_atomic_t nsigsys;
+extern void remember_arg0(volatile char *arg0);
extern ssize_t safein (int fd, void *ptr, size_t s);
extern void safeout (int fd, const void *ptr, size_t s, ssize_t max);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad3a2732a02d95704b58e94c12c99a80a7bbdb3e77b8b6b90b0e709119c447ab
size 40681

3
showconsole-2.26.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d8a4c499a94b99e74bce1112a6d67bc6d478217c732e670cdba96010ad011d63
size 40881