3
0
forked from pool/util-linux
Dominique Leuenberger 2018-11-14 13:29:03 +00:00 committed by Git OBS Bridge
commit f623b47472
11 changed files with 75 additions and 645 deletions

205
addnote.c
View File

@ -1,205 +0,0 @@
/*
* Program to hack in a PT_NOTE program header entry in an ELF file.
* This is needed for OF on RS/6000s to load an image correctly.
* Note that OF needs a program header entry for the note, not an
* ELF section.
*
* Copyright 2000 Paul Mackerras.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Usage: addnote zImage
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
/* CHRP note section */
char arch[] = "PowerPC";
#define N_DESCR 6
unsigned int descr[N_DESCR] = {
0xffffffff, /* real-mode = true */
0x02000000, /* real-base, i.e. where we expect OF to be */
0xffffffff, /* real-size */
0xffffffff, /* virt-base */
0xffffffff, /* virt-size */
0x4000, /* load-base */
};
/* RPA note section */
char rpaname[] = "IBM,RPA-Client-Config";
/*
* Note: setting ignore_my_client_config *should* mean that OF ignores
* all the other fields, but there is a firmware bug which means that
* it looks at the splpar field at least. So these values need to be
* reasonable.
*/
#define N_RPA_DESCR 8
unsigned int rpanote[N_RPA_DESCR] = {
0, /* lparaffinity */
64, /* min_rmo_size */
0, /* min_rmo_percent */
40, /* max_pft_size */
1, /* splpar */
-1, /* min_load */
0, /* new_mem_def */
1, /* ignore_my_client_config */
};
#define ROUNDUP(len) (((len) + 3) & ~3)
unsigned char buf[512];
#define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1]))
#define GET_32BE(off) ((GET_16BE(off) << 16) + GET_16BE((off)+2))
#define PUT_16BE(off, v) (buf[off] = ((v) >> 8) & 0xff, \
buf[(off) + 1] = (v) & 0xff)
#define PUT_32BE(off, v) (PUT_16BE((off), (v) >> 16), \
PUT_16BE((off) + 2, (v)))
/* Structure of an ELF file */
#define E_IDENT 0 /* ELF header */
#define E_PHOFF 28
#define E_PHENTSIZE 42
#define E_PHNUM 44
#define E_HSIZE 52 /* size of ELF header */
#define EI_MAGIC 0 /* offsets in E_IDENT area */
#define EI_CLASS 4
#define EI_DATA 5
#define PH_TYPE 0 /* ELF program header */
#define PH_OFFSET 4
#define PH_FILESZ 16
#define PH_HSIZE 32 /* size of program header */
#define PT_NOTE 4 /* Program header type = note */
#define ELFCLASS32 1
#define ELFDATA2MSB 2
unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
int
main(int ac, char **av)
{
int fd, n, i;
int ph, ps, np;
int nnote, nnote2, ns;
if (ac != 2) {
fprintf(stderr, "Usage: %s elf-file\n", av[0]);
exit(1);
}
fd = open(av[1], O_RDWR);
if (fd < 0) {
perror(av[1]);
exit(1);
}
nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr);
nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote);
n = read(fd, buf, sizeof(buf));
if (n < 0) {
perror("read");
exit(1);
}
if (n < E_HSIZE || memcmp(&buf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0)
goto notelf;
if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
|| buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
av[1]);
exit(1);
}
ph = GET_32BE(E_PHOFF);
ps = GET_16BE(E_PHENTSIZE);
np = GET_16BE(E_PHNUM);
if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
goto notelf;
if (ph + (np + 2) * ps + nnote + nnote2 > n)
goto nospace;
for (i = 0; i < np; ++i) {
if (GET_32BE(ph + PH_TYPE) == PT_NOTE) {
fprintf(stderr, "%s already has a note entry\n",
av[1]);
exit(0);
}
ph += ps;
}
/* XXX check that the area we want to use is all zeroes */
for (i = 0; i < 2 * ps + nnote + nnote2; ++i)
if (buf[ph + i] != 0)
goto nospace;
/* fill in the program header entry */
ns = ph + 2 * ps;
PUT_32BE(ph + PH_TYPE, PT_NOTE);
PUT_32BE(ph + PH_OFFSET, ns);
PUT_32BE(ph + PH_FILESZ, nnote);
/* fill in the note area we point to */
/* XXX we should probably make this a proper section */
PUT_32BE(ns, strlen(arch) + 1);
PUT_32BE(ns + 4, N_DESCR * 4);
PUT_32BE(ns + 8, 0x1275);
strcpy((char *) &buf[ns + 12], arch);
ns += 12 + strlen(arch) + 1;
for (i = 0; i < N_DESCR; ++i, ns += 4)
PUT_32BE(ns, descr[i]);
/* fill in the second program header entry and the RPA note area */
ph += ps;
PUT_32BE(ph + PH_TYPE, PT_NOTE);
PUT_32BE(ph + PH_OFFSET, ns);
PUT_32BE(ph + PH_FILESZ, nnote2);
/* fill in the note area we point to */
PUT_32BE(ns, strlen(rpaname) + 1);
PUT_32BE(ns + 4, sizeof(rpanote));
PUT_32BE(ns + 8, 0x12759999);
strcpy((char *) &buf[ns + 12], rpaname);
ns += 12 + ROUNDUP(strlen(rpaname) + 1);
for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
PUT_32BE(ns, rpanote[i]);
/* Update the number of program headers */
PUT_16BE(E_PHNUM, np + 2);
/* write back */
lseek(fd, (long) 0, SEEK_SET);
i = write(fd, buf, n);
if (i < 0) {
perror("write");
exit(1);
}
if (i < n) {
fprintf(stderr, "%s: write truncated\n", av[1]);
exit(1);
}
exit(0);
notelf:
fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]);
exit(1);
nospace:
fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
av[1]);
exit(1);
}

View File

@ -1,20 +0,0 @@
.\" $Id: mkzimage_cmdline.8 590 2006-02-07 14:38:07Z jplack $
.TH mkzimage_cmdline 8
.SH NAME
\fBmkzimage_cmdline\fR - edit the built-in kernel cmdline in a PowerPC CHRP zImage
.SH SYNOPSIS
\fBmkzimage_cmdline [-a 0|1] [-s 'kernel cmdline'] [-c] zImage\fR
.SH DESCRIPTION
\fBmkzimage_cmdline\fR adds a kernel cmdline to a zImage. This string will be passed to the kernel, the contents in /options/boot-file will be overwritten with the provided cmdline.
.SH OPTIONS
.TP
.B \-a 0|1
activate or deactivate the the cmdline
.TP
.B \-s 'kernel cmdline'
pass this string to the kernel. It can be up to 511 chars long.
.TP
.B \-c
clear cmdline area in zImage
.SH AUTHOR
Olaf Hering <olh@suse.de>

View File

@ -1,185 +0,0 @@
/* $Id: mkzimage_cmdline.c 590 2006-02-07 14:38:07Z jplack $ */
/*
* a little tool to modify the cmdline inside a zImage
* Olaf Hering <olh@suse.de> Copyright (C) 2003, 2004
*/
/*
2003-10-02, version 1
2003-11-15, version 2: fix short reads if the string is at the end of the file
2004-08-07, version 3: use mmap
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#define MY_VERSION 3
static int activate;
static int clear;
static int set;
static char *string;
static char *filename;
static const char cmdline_start[] = "cmd_line_start";
static const char cmdline_end[] = "cmd_line_end";
static void my_version(void)
{
printf("version: %d\n", MY_VERSION);
printf("(C) SuSE Linux AG, Nuernberg, Germany, 2003, 2004\n");
return;
}
static void my_rtfm(const char *app)
{
printf("modify the built-in cmdline of a CHRP boot image\n");
printf("%s filename\n", app);
printf("work with zImage named 'filename'\n");
printf(" [-h] display this help\n");
printf(" [-v] display version\n");
printf(" [-a 0|1] disable/enable built-in cmdline\n");
printf(" overrides whatever is passed from OpenFirmware\n");
printf(" [-s STRING] store STRING in the boot image\n");
printf(" [-c] clear previous content before update\n");
printf(" no option will show the current settings in 'filename'\n");
return;
}
int main(int argc, char **argv)
{
struct stat sb;
int fd, found;
unsigned char *p, *s, *e, *tmp, *active;
if (argc < 2) {
my_rtfm(argv[0]);
exit(1);
}
while (1) {
int i;
i = getopt(argc, argv, "a:hcvs:");
if (i == -1)
break;
switch (i) {
case 'a':
if (*optarg == '0')
activate = -1;
else
activate = 1;
break;
case 'c':
clear = 1;
break;
case 'h':
my_rtfm(argv[0]);
exit(0);
case 's':
string = strdup(optarg);
if (!string) {
fprintf(stderr, "set: no mem\n");
exit(1);
}
set = 1;
if (!activate)
activate = 1;
break;
case 'v':
my_version();
exit(0);
default:
printf("unknown option\n");
my_rtfm(argv[0]);
exit(1);
}
}
if (argc <= optind) {
fprintf(stderr, "filename required\n");
exit(1);
}
filename = strdup(argv[optind]);
if (!filename) {
fprintf(stderr, "no mem\n");
exit(1);
}
fd = open(filename, (activate || clear || set) ? O_RDWR : O_RDONLY);
if (fd == -1)
goto error;
found = stat(filename, &sb);
if (found < 0)
goto error;
if (!S_ISREG(sb.st_mode)) {
fprintf(stderr, "%s is not a file\n", filename);
exit(1);
}
p = mmap(NULL, sb.st_size,
((activate || clear || set) ?
PROT_WRITE : 0) | PROT_READ, MAP_SHARED, fd, 0);
if (p == MAP_FAILED)
goto error;
s = p;
e = p + sb.st_size - sizeof(cmdline_start) - sizeof(cmdline_end);
found = 0;
while (s < e) {
if (memcmp(++s, cmdline_start, sizeof(cmdline_start) - 1) != 0)
continue;
found = 1;
break;
}
if (!found)
goto no_start;
found = 0;
active = s - 1;
tmp = s = s + sizeof(cmdline_start) - 1;
e = p + sb.st_size - sizeof(cmdline_end);
while (tmp < e) {
if (memcmp(++tmp, cmdline_end, sizeof(cmdline_end)) != 0)
continue;
found = 1;
break;
}
if (!found)
goto no_end;
if (activate || clear || set) {
if (activate)
*active = activate > 0 ? '1' : '0';
if (clear)
memset(s, 0x0, tmp - s);
if (set)
snprintf((char*)s, tmp - s, "%s", string);
} else {
fprintf(stdout, "cmd_line size:%td\n", tmp - s);
fprintf(stdout, "cmd_line: %s\n", s);
fprintf(stdout, "active: %c\n", *active);
}
munmap(p, sb.st_size);
close(fd);
return 0;
error:
perror(filename);
return 1;
no_start:
fprintf(stderr, "%s: %s not found.\n", filename, cmdline_start);
return 1;
no_end:
fprintf(stderr, "%s: %s not found.\n", filename, cmdline_end);
return 1;
}

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Fri Oct 26 17:24:46 CEST 2018 - sbrabec@suse.com
- Fix runstatedir path (to /run) (boo#1113188#c1).
-------------------------------------------------------------------
Fri Oct 12 14:06:56 CEST 2018 - sbrabec@suse.com
- Create empty /etc/issue.d for the new agetty feature.
-------------------------------------------------------------------
Thu Sep 27 20:24:45 CEST 2018 - sbrabec@suse.com
- Drop obsolete downstream ppc utilities
chrp-addnote and mkzimage_cmdline (boo#1109284).
- Drop obsolete setctsid (boo#1109290).
-------------------------------------------------------------------
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -143,14 +143,6 @@ Source16: su-l.pamd
# klogconsole, http://opensuse.github.com/kiwi, 7.02.25, git 859dc050
# TODO: split to separate package
Source40: klogconsole.tar.xz
# XXX: Run a program in a new session and with controlling tty
Source22: setctsid.c
Source23: setctsid.8
# XXX: ppc specific, still needed?
Source28: mkzimage_cmdline.8
Source29: mkzimage_cmdline.c
Source31: addnote.c
#
Source41: rfkill-block@.service
Source42: rfkill-unblock@.service
#
@ -397,8 +389,6 @@ library.
%setup -q -n %{_name}-%{version} -b 40
%patch0 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .
%build
%if %build_util_linux
@ -406,9 +396,6 @@ pushd ../klogconsole
# klogconsole build
make %{?_smp_mflags} CFLAGS="%{optflags}" CC="%{__cc}"
popd
# setctsid build
rm -f setctsid
make %{?_smp_mflags} setctsid CFLAGS="%{optflags}" CC="%{__cc}"
#
#BEGIN SYSTEMD SAFETY CHECK
# With systemd, some utilities are built differently. Keep track of these
@ -520,15 +507,12 @@ export SUID_LDFLAGS="-pie"
export LDFLAGS="-Wl,-z,relro,-z,now"
export CFLAGS="%{optflags} -D_GNU_SOURCE"
export CXXFLAGS="%{optflags} -D_GNU_SOURCE"
# override default localstatedir to /run
# only used for volatile data
#
# SUSE now supports only systemd based system. We do not build
# sysvinit-only versions of UTIL_LINUX_SYSTEMD_SOURCES utilities.
AUTOPOINT=true autoreconf -vfi
%configure \
--disable-silent-rules \
--localstatedir=/run \
--docdir=%{_docdir}/%{_name} \
--disable-makeinstall-chown \
--disable-makeinstall-setuid \
@ -576,11 +560,6 @@ AUTOPOINT=true autoreconf -vfi
# Safety check: HAVE_UUIDD should be always 1:
grep -q 'HAVE_UUIDD 1' config.h
make %{?_smp_mflags}
#
%if %build_util_linux
%{__cc} -fwhole-program %{optflags} -o mkzimage_cmdline %{S:29}
%{__cc} -fwhole-program %{optflags} -o chrp-addnote %{SOURCE31}
%endif
%check
# mark some tests "known_fail"
@ -618,7 +597,7 @@ exit "$result"
%install
%if %build_util_linux
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir}}
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir},%{_sysconfdir}/issue.d}
install -m 644 %{SOURCE51} %{buildroot}%{_sysconfdir}/blkid.conf
install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/pam.d/login
install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/pam.d/remote
@ -680,14 +659,6 @@ ln -s %{_sbindir}/fstrim %{buildroot}/sbin
ln -s %{_sbindir}/chcpu %{buildroot}/sbin
#EndUsrMerge
install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/filesystems
%ifnarch ppc ppc64
install -m 755 mkzimage_cmdline %{buildroot}%{_bindir}
install -m 644 %{S:28} %{buildroot}%{_mandir}/man8
install -m 755 chrp-addnote %{buildroot}%{_bindir}
%endif
# setctsid install
install -m 755 setctsid %{buildroot}%{_sbindir}
install -m 444 setctsid.8 %{buildroot}%{_mandir}/man8/
echo -e "#! /bin/bash\n/sbin/blockdev --flushbufs \$1" > %{buildroot}%{_sbindir}/flushb
chmod 755 %{buildroot}%{_sbindir}/flushb
# Install scripts to configure raw devices at boot time
@ -870,6 +841,11 @@ getent passwd uuidd >/dev/null || \
%{service_add_pre uuidd.socket uuidd.service}
%post -n uuidd
# Fix running instance paths during live upgrade from
# Leap = 15, SLE = 15 (boo#1113188).
# Useful for Tumbleweed or zypper dup only.
mv /run/run/uuidd /run/uuidd >/dev/null 2>&1 || :
rmdir --ignore-fail-on-non-empty /run/run >/dev/null 2>&1 || :
%{service_add_post uuidd.socket uuidd.service}
%preun -n uuidd
@ -912,6 +888,7 @@ getent passwd uuidd >/dev/null || \
%config(noreplace) %{_sysconfdir}/pam.d/su
%config(noreplace) %{_sysconfdir}/pam.d/su-l
%config(noreplace) %{_sysconfdir}/default/su
%config %dir %{_sysconfdir}/issue.d
#UsrMerge
/bin/kill
/bin/su
@ -1006,10 +983,6 @@ getent passwd uuidd >/dev/null || \
%{_bindir}/uuidgen
%{_bindir}/uuidparse
%{_bindir}/uname26
%ifnarch ppc ppc64
%{_bindir}/chrp-addnote
%{_bindir}/mkzimage_cmdline
%endif
%{_bindir}/wdctl
%{_sbindir}/addpart
%{_sbindir}/agetty
@ -1045,7 +1018,6 @@ getent passwd uuidd >/dev/null || \
%{_sbindir}/rfkill
%{_sbindir}/rtcwake
%{_sbindir}/runuser
%{_sbindir}/setctsid
%{_sbindir}/sulogin
%{_sbindir}/swaplabel
%{_sbindir}/swapoff
@ -1146,9 +1118,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/readprofile.8.gz
%{_mandir}/man8/rfkill.8.gz
%{_mandir}/man8/chcpu.8.gz
%ifnarch ppc ppc64
%{_mandir}/man8/mkzimage_cmdline.8.gz
%endif
%{_mandir}/man8/partx.8.gz
%{_mandir}/man8/pivot_root.8.gz
%{_mandir}/man8/raw.8.gz
@ -1158,7 +1127,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/swapon.8.gz
%{_mandir}/man8/umount.8.gz
%{_mandir}/man8/uname26.8.gz
%{_mandir}/man8/setctsid.8.gz
%{_mandir}/man8/wipefs.8.gz
%{_mandir}/man8/zramctl.8.gz
%{_mandir}/man8/fstrim.8.gz

View File

@ -1,25 +0,0 @@
.\" Rick Sladkey <jrs@world.std.com>
.\" In the public domain.
.\" Path modifications by faith@cs.unc.edu
.TH SETCTSID 8 "12 April 1999" "Linux 2.2" "Linux Programmer's Manual"
.SH NAME
setctsid \- run a program in a new session and tty
.SH SYNOPSIS
.B setctsid
.RB [ -f ]
.I /dev/<tty>
.I program
.RB [ args... ]
.SH DESCRIPTION
.B setctsid
runs a program in a new session with a new controlling terminal
.IR /dev/<tty> .
The
.B -f
option causes
.B setctsid
to run the program in a new process.
.SH "SEE ALSO"
.BR setsid (2)
.SH AUTHORS
Rick Sladkey <jrs@world.std.com>, Werner Fink <werner@suse.de>

View File

@ -1,90 +0,0 @@
/*
* setctsid.c -- execute a command in a new session and with
* new controlling terminal
*
* derviated from: setctsid.c of Rick Sladkey <jrs@world.std.com>
* In the public domain.
*
* Changed by Werner Fink, <werner@suse.de>
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/syslog.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#define xerror(n) do { int error = errno; \
if (!isatty(fileno(stderr))) \
syslog(LOG_ERR, n ": %s", strerror(error)); \
else \
errno = error, perror(n); \
} while (0)
int main(int argc, char *argv[])
{
int fd;
struct stat buf;
int dofork = 0;
if (argc > 1 && !strcmp(argv[1], "-f")) {
dofork = 1;
argc--;
argv++;
}
if (argc < 3) {
fprintf(stderr, "usage: setctsid [-f] tty program [arg ...]\n");
exit(1);
}
if (stat(argv[1], &buf) < 0) {
perror(argv[1]);
exit(1);
}
if (!(S_ISCHR(buf.st_mode))) {
/* why do we care? */
fprintf(stderr, "%s: not a character device\n", argv[1]);
exit(1);
}
if (dofork) {
switch (fork()) {
case -1:
perror("fork");
exit(1);
case 0:
break;
default:
exit(0);
}
}
if (setsid() < 0) {
perror("setsid");
exit(1);
}
if ((fd = open(argv[1], O_RDWR, 0)) < 0) {
xerror("open");
exit(1);
}
dup2(fd, fileno(stdin));
dup2(fd, fileno(stdout));
dup2(fd, fileno(stderr));
if (isatty(fd)) {
if (ioctl(fileno(stdin), TIOCSCTTY, argv[1]) < 0) {
xerror("ioctl");
exit(1);
}
}
if (fd > fileno(stderr))
close(fd);
execvp(argv[2], argv + 2);
xerror("execvp");
exit(1);
}

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Fri Oct 26 17:24:46 CEST 2018 - sbrabec@suse.com
- Fix runstatedir path (to /run) (boo#1113188#c1).
-------------------------------------------------------------------
Fri Oct 12 14:06:56 CEST 2018 - sbrabec@suse.com
- Create empty /etc/issue.d for the new agetty feature.
-------------------------------------------------------------------
Thu Sep 27 20:24:45 CEST 2018 - sbrabec@suse.com
- Drop obsolete downstream ppc utilities
chrp-addnote and mkzimage_cmdline (boo#1109284).
- Drop obsolete setctsid (boo#1109290).
-------------------------------------------------------------------
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -143,14 +143,6 @@ Source16: su-l.pamd
# klogconsole, http://opensuse.github.com/kiwi, 7.02.25, git 859dc050
# TODO: split to separate package
Source40: klogconsole.tar.xz
# XXX: Run a program in a new session and with controlling tty
Source22: setctsid.c
Source23: setctsid.8
# XXX: ppc specific, still needed?
Source28: mkzimage_cmdline.8
Source29: mkzimage_cmdline.c
Source31: addnote.c
#
Source41: rfkill-block@.service
Source42: rfkill-unblock@.service
#
@ -397,8 +389,6 @@ library.
%setup -q -n %{_name}-%{version} -b 40
%patch0 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .
%build
%if %build_util_linux
@ -406,9 +396,6 @@ pushd ../klogconsole
# klogconsole build
make %{?_smp_mflags} CFLAGS="%{optflags}" CC="%{__cc}"
popd
# setctsid build
rm -f setctsid
make %{?_smp_mflags} setctsid CFLAGS="%{optflags}" CC="%{__cc}"
#
#BEGIN SYSTEMD SAFETY CHECK
# With systemd, some utilities are built differently. Keep track of these
@ -520,15 +507,12 @@ export SUID_LDFLAGS="-pie"
export LDFLAGS="-Wl,-z,relro,-z,now"
export CFLAGS="%{optflags} -D_GNU_SOURCE"
export CXXFLAGS="%{optflags} -D_GNU_SOURCE"
# override default localstatedir to /run
# only used for volatile data
#
# SUSE now supports only systemd based system. We do not build
# sysvinit-only versions of UTIL_LINUX_SYSTEMD_SOURCES utilities.
AUTOPOINT=true autoreconf -vfi
%configure \
--disable-silent-rules \
--localstatedir=/run \
--docdir=%{_docdir}/%{_name} \
--disable-makeinstall-chown \
--disable-makeinstall-setuid \
@ -576,11 +560,6 @@ AUTOPOINT=true autoreconf -vfi
# Safety check: HAVE_UUIDD should be always 1:
grep -q 'HAVE_UUIDD 1' config.h
make %{?_smp_mflags}
#
%if %build_util_linux
%{__cc} -fwhole-program %{optflags} -o mkzimage_cmdline %{S:29}
%{__cc} -fwhole-program %{optflags} -o chrp-addnote %{SOURCE31}
%endif
%check
# mark some tests "known_fail"
@ -618,7 +597,7 @@ exit "$result"
%install
%if %build_util_linux
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir}}
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir},%{_sysconfdir}/issue.d}
install -m 644 %{SOURCE51} %{buildroot}%{_sysconfdir}/blkid.conf
install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/pam.d/login
install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/pam.d/remote
@ -680,14 +659,6 @@ ln -s %{_sbindir}/fstrim %{buildroot}/sbin
ln -s %{_sbindir}/chcpu %{buildroot}/sbin
#EndUsrMerge
install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/filesystems
%ifnarch ppc ppc64
install -m 755 mkzimage_cmdline %{buildroot}%{_bindir}
install -m 644 %{S:28} %{buildroot}%{_mandir}/man8
install -m 755 chrp-addnote %{buildroot}%{_bindir}
%endif
# setctsid install
install -m 755 setctsid %{buildroot}%{_sbindir}
install -m 444 setctsid.8 %{buildroot}%{_mandir}/man8/
echo -e "#! /bin/bash\n/sbin/blockdev --flushbufs \$1" > %{buildroot}%{_sbindir}/flushb
chmod 755 %{buildroot}%{_sbindir}/flushb
# Install scripts to configure raw devices at boot time
@ -870,6 +841,11 @@ getent passwd uuidd >/dev/null || \
%{service_add_pre uuidd.socket uuidd.service}
%post -n uuidd
# Fix running instance paths during live upgrade from
# Leap = 15, SLE = 15 (boo#1113188).
# Useful for Tumbleweed or zypper dup only.
mv /run/run/uuidd /run/uuidd >/dev/null 2>&1 || :
rmdir --ignore-fail-on-non-empty /run/run >/dev/null 2>&1 || :
%{service_add_post uuidd.socket uuidd.service}
%preun -n uuidd
@ -912,6 +888,7 @@ getent passwd uuidd >/dev/null || \
%config(noreplace) %{_sysconfdir}/pam.d/su
%config(noreplace) %{_sysconfdir}/pam.d/su-l
%config(noreplace) %{_sysconfdir}/default/su
%config %dir %{_sysconfdir}/issue.d
#UsrMerge
/bin/kill
/bin/su
@ -1006,10 +983,6 @@ getent passwd uuidd >/dev/null || \
%{_bindir}/uuidgen
%{_bindir}/uuidparse
%{_bindir}/uname26
%ifnarch ppc ppc64
%{_bindir}/chrp-addnote
%{_bindir}/mkzimage_cmdline
%endif
%{_bindir}/wdctl
%{_sbindir}/addpart
%{_sbindir}/agetty
@ -1045,7 +1018,6 @@ getent passwd uuidd >/dev/null || \
%{_sbindir}/rfkill
%{_sbindir}/rtcwake
%{_sbindir}/runuser
%{_sbindir}/setctsid
%{_sbindir}/sulogin
%{_sbindir}/swaplabel
%{_sbindir}/swapoff
@ -1146,9 +1118,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/readprofile.8.gz
%{_mandir}/man8/rfkill.8.gz
%{_mandir}/man8/chcpu.8.gz
%ifnarch ppc ppc64
%{_mandir}/man8/mkzimage_cmdline.8.gz
%endif
%{_mandir}/man8/partx.8.gz
%{_mandir}/man8/pivot_root.8.gz
%{_mandir}/man8/raw.8.gz
@ -1158,7 +1127,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/swapon.8.gz
%{_mandir}/man8/umount.8.gz
%{_mandir}/man8/uname26.8.gz
%{_mandir}/man8/setctsid.8.gz
%{_mandir}/man8/wipefs.8.gz
%{_mandir}/man8/zramctl.8.gz
%{_mandir}/man8/fstrim.8.gz

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Fri Oct 26 17:24:46 CEST 2018 - sbrabec@suse.com
- Fix runstatedir path (to /run) (boo#1113188#c1).
-------------------------------------------------------------------
Fri Oct 12 14:06:56 CEST 2018 - sbrabec@suse.com
- Create empty /etc/issue.d for the new agetty feature.
-------------------------------------------------------------------
Thu Sep 27 20:24:45 CEST 2018 - sbrabec@suse.com
- Drop obsolete downstream ppc utilities
chrp-addnote and mkzimage_cmdline (boo#1109284).
- Drop obsolete setctsid (boo#1109290).
-------------------------------------------------------------------
Mon Aug 6 15:21:35 CEST 2018 - sbrabec@suse.com

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -143,14 +143,6 @@ Source16: su-l.pamd
# klogconsole, http://opensuse.github.com/kiwi, 7.02.25, git 859dc050
# TODO: split to separate package
Source40: klogconsole.tar.xz
# XXX: Run a program in a new session and with controlling tty
Source22: setctsid.c
Source23: setctsid.8
# XXX: ppc specific, still needed?
Source28: mkzimage_cmdline.8
Source29: mkzimage_cmdline.c
Source31: addnote.c
#
Source41: rfkill-block@.service
Source42: rfkill-unblock@.service
#
@ -397,8 +389,6 @@ library.
%setup -q -n %{_name}-%{version} -b 40
%patch0 -p1
#
# setctsid
cp -p %{S:22} %{S:23} .
%build
%if %build_util_linux
@ -406,9 +396,6 @@ pushd ../klogconsole
# klogconsole build
make %{?_smp_mflags} CFLAGS="%{optflags}" CC="%{__cc}"
popd
# setctsid build
rm -f setctsid
make %{?_smp_mflags} setctsid CFLAGS="%{optflags}" CC="%{__cc}"
#
#BEGIN SYSTEMD SAFETY CHECK
# With systemd, some utilities are built differently. Keep track of these
@ -520,15 +507,12 @@ export SUID_LDFLAGS="-pie"
export LDFLAGS="-Wl,-z,relro,-z,now"
export CFLAGS="%{optflags} -D_GNU_SOURCE"
export CXXFLAGS="%{optflags} -D_GNU_SOURCE"
# override default localstatedir to /run
# only used for volatile data
#
# SUSE now supports only systemd based system. We do not build
# sysvinit-only versions of UTIL_LINUX_SYSTEMD_SOURCES utilities.
AUTOPOINT=true autoreconf -vfi
%configure \
--disable-silent-rules \
--localstatedir=/run \
--docdir=%{_docdir}/%{_name} \
--disable-makeinstall-chown \
--disable-makeinstall-setuid \
@ -576,11 +560,6 @@ AUTOPOINT=true autoreconf -vfi
# Safety check: HAVE_UUIDD should be always 1:
grep -q 'HAVE_UUIDD 1' config.h
make %{?_smp_mflags}
#
%if %build_util_linux
%{__cc} -fwhole-program %{optflags} -o mkzimage_cmdline %{S:29}
%{__cc} -fwhole-program %{optflags} -o chrp-addnote %{SOURCE31}
%endif
%check
# mark some tests "known_fail"
@ -618,7 +597,7 @@ exit "$result"
%install
%if %build_util_linux
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir}}
mkdir -p %{buildroot}{%{_sysconfdir}/{pam.d,default},%{_mandir}/man{1,8},/bin,/sbin,%{_bindir},%{_sbindir},%{_infodir},%{_sysconfdir}/issue.d}
install -m 644 %{SOURCE51} %{buildroot}%{_sysconfdir}/blkid.conf
install -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/pam.d/login
install -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/pam.d/remote
@ -680,14 +659,6 @@ ln -s %{_sbindir}/fstrim %{buildroot}/sbin
ln -s %{_sbindir}/chcpu %{buildroot}/sbin
#EndUsrMerge
install -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/filesystems
%ifnarch ppc ppc64
install -m 755 mkzimage_cmdline %{buildroot}%{_bindir}
install -m 644 %{S:28} %{buildroot}%{_mandir}/man8
install -m 755 chrp-addnote %{buildroot}%{_bindir}
%endif
# setctsid install
install -m 755 setctsid %{buildroot}%{_sbindir}
install -m 444 setctsid.8 %{buildroot}%{_mandir}/man8/
echo -e "#! /bin/bash\n/sbin/blockdev --flushbufs \$1" > %{buildroot}%{_sbindir}/flushb
chmod 755 %{buildroot}%{_sbindir}/flushb
# Install scripts to configure raw devices at boot time
@ -870,6 +841,11 @@ getent passwd uuidd >/dev/null || \
%{service_add_pre uuidd.socket uuidd.service}
%post -n uuidd
# Fix running instance paths during live upgrade from
# Leap = 15, SLE = 15 (boo#1113188).
# Useful for Tumbleweed or zypper dup only.
mv /run/run/uuidd /run/uuidd >/dev/null 2>&1 || :
rmdir --ignore-fail-on-non-empty /run/run >/dev/null 2>&1 || :
%{service_add_post uuidd.socket uuidd.service}
%preun -n uuidd
@ -912,6 +888,7 @@ getent passwd uuidd >/dev/null || \
%config(noreplace) %{_sysconfdir}/pam.d/su
%config(noreplace) %{_sysconfdir}/pam.d/su-l
%config(noreplace) %{_sysconfdir}/default/su
%config %dir %{_sysconfdir}/issue.d
#UsrMerge
/bin/kill
/bin/su
@ -1006,10 +983,6 @@ getent passwd uuidd >/dev/null || \
%{_bindir}/uuidgen
%{_bindir}/uuidparse
%{_bindir}/uname26
%ifnarch ppc ppc64
%{_bindir}/chrp-addnote
%{_bindir}/mkzimage_cmdline
%endif
%{_bindir}/wdctl
%{_sbindir}/addpart
%{_sbindir}/agetty
@ -1045,7 +1018,6 @@ getent passwd uuidd >/dev/null || \
%{_sbindir}/rfkill
%{_sbindir}/rtcwake
%{_sbindir}/runuser
%{_sbindir}/setctsid
%{_sbindir}/sulogin
%{_sbindir}/swaplabel
%{_sbindir}/swapoff
@ -1146,9 +1118,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/readprofile.8.gz
%{_mandir}/man8/rfkill.8.gz
%{_mandir}/man8/chcpu.8.gz
%ifnarch ppc ppc64
%{_mandir}/man8/mkzimage_cmdline.8.gz
%endif
%{_mandir}/man8/partx.8.gz
%{_mandir}/man8/pivot_root.8.gz
%{_mandir}/man8/raw.8.gz
@ -1158,7 +1127,6 @@ getent passwd uuidd >/dev/null || \
%{_mandir}/man8/swapon.8.gz
%{_mandir}/man8/umount.8.gz
%{_mandir}/man8/uname26.8.gz
%{_mandir}/man8/setctsid.8.gz
%{_mandir}/man8/wipefs.8.gz
%{_mandir}/man8/zramctl.8.gz
%{_mandir}/man8/fstrim.8.gz