Accepting request 347468 from home:rudi_m:branches:Base:System
- cleanup package: * don't build binaries which are not installed * remove unused sources * remove patches (or parts of patches) which modify unused files * remove old build conditions (sysvinit, util-linux, mkinitrd) * remove unused dependencies - this cleanup does not change the resulting binaries (except some package dependencies) - list of removed patches: * sysvinit-2.82-startstop.patch * sysvinit-2.88+dsf-blowfish.dif * sysvinit-2.88+dsf-crypt.patch * sysvinit-2.88+dsf-env.patch * sysvinit-2.88dsf-multiple-sulogin.patch * sysvinit-2.88+dsf-run.diff * sysvinit-2.88+dsf-xen.patch - list of modified patches: * notify-pam-dead.patch * sysvinit-2.88+dsf.dif * sysvinit-2.88+dsf-sulogin.diff * sysvinit-2.88dsf-suse.patch OBS-URL: https://build.opensuse.org/request/show/347468 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysvinit?expand=0&rev=214
This commit is contained in:
parent
2f93e802ec
commit
fb512c6276
@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
#%stage: boot
|
||||
#%depends: udev clock
|
||||
#%programs: blogd
|
||||
#%programs: ln
|
||||
#%programs: mkdir
|
||||
#%programs: mount
|
||||
#%programs: showconsole
|
||||
#%if: -x /sbin/blogd
|
||||
#%dontshow
|
||||
#
|
||||
##### blogd start
|
||||
##
|
||||
## This script starts blogd if this has not happened before.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
|
||||
fboot=$(get_param fastboot)
|
||||
quiet=$(get_param quiet)
|
||||
|
||||
if test -z "$fboot" -a -z "$quiet" -a -z "$REDIRECT" ; then
|
||||
REDIRECT=$(showconsole 2>/dev/null)
|
||||
if test -n "$REDIRECT" ; then
|
||||
if test "$devpts" != "yes" ; then
|
||||
mount -t devpts devpts /dev/pts
|
||||
devpts=yes
|
||||
fi
|
||||
> /dev/shm/initrd.msg
|
||||
ln -sf /dev/shm/initrd.msg /var/log/boot.msg
|
||||
mkdir -p /var/run
|
||||
blogd $REDIRECT
|
||||
fi
|
||||
fi
|
@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: setup
|
||||
#
|
||||
#%programs: kill
|
||||
#%programs: pidof
|
||||
#%dontshow
|
||||
#
|
||||
##### blogd end
|
||||
##
|
||||
## This script tells blogd that the initrd is done.
|
||||
## Additionally it moves /dev to the new root filesystem.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
|
||||
blogd_pid=$(pidof blogd)
|
||||
if test -n "$blogd_pid" ; then
|
||||
kill -IO "$blogd_pid"
|
||||
fi
|
@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
#%stage: setup
|
||||
#%depends: killblogd
|
||||
#%provides: killprogs
|
||||
#
|
||||
#%programs: kill
|
||||
#%programs: umount
|
||||
#%programs: usleep
|
||||
#%dontshow
|
||||
#
|
||||
##### blogd end2
|
||||
##
|
||||
## Really kill blogd this time.
|
||||
##
|
||||
## Command line parameters
|
||||
## -----------------------
|
||||
##
|
||||
|
||||
if test -n "$blogd_pid" ; then
|
||||
kill -QUIT "$blogd_pid"
|
||||
typeset -i bquit=50
|
||||
while test -d "/proc/$blogd_pid" ; do
|
||||
usleep 30000
|
||||
if ((bquit-- <= 0)) ; then
|
||||
kill -KILL "$blogd_pid"
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset bquit blogd_pid
|
||||
if test "$devpts" = "yes" ; then
|
||||
umount -t devpts /dev/pts
|
||||
fi
|
||||
fi
|
@ -35,59 +35,6 @@
|
||||
# $(INSTALL_DIR) $(ROOT)/etc/
|
||||
# $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
|
||||
ln -sf halt $(ROOT)/sbin/reboot
|
||||
--- src/init.c
|
||||
+++ src/init.c 2010-04-13 00:00:00.000000000 +0000
|
||||
@@ -79,6 +79,10 @@
|
||||
#include "reboot.h"
|
||||
#include "set.h"
|
||||
|
||||
+#ifdef USE_PAM
|
||||
+extern void notify_pam_dead_session(const char *id);
|
||||
+#endif
|
||||
+
|
||||
#ifndef SIGPWR
|
||||
# define SIGPWR SIGUSR2
|
||||
#endif
|
||||
@@ -1132,6 +1136,9 @@ pid_t spawn(CHILD *ch, int *res)
|
||||
}
|
||||
dup(f);
|
||||
dup(f);
|
||||
+#ifdef USE_PAM
|
||||
+ notify_pam_dead_session(ch->id);
|
||||
+#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1551,6 +1558,9 @@ void read_inittab(void)
|
||||
INITDBG(L_VB, "Updating utmp for pid %d [id %s]",
|
||||
ch->pid, ch->id);
|
||||
ch->flags &= ~RUNNING;
|
||||
+#ifdef USE_PAM
|
||||
+ notify_pam_dead_session(ch->id);
|
||||
+#endif
|
||||
if (ch->process[0] != '+')
|
||||
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
|
||||
}
|
||||
@@ -2012,6 +2022,9 @@ void re_exec(void)
|
||||
if (ch->flags & ZOMBIE) {
|
||||
INITDBG(L_VB, "Child died, PID= %d", ch->pid);
|
||||
ch->flags &= ~(RUNNING|ZOMBIE|WAITING);
|
||||
+#ifdef USE_PAM
|
||||
+ notify_pam_dead_session(ch->id);
|
||||
+#endif
|
||||
if (ch->process[0] != '+')
|
||||
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
|
||||
}
|
||||
@@ -2465,6 +2478,9 @@ void process_signals()
|
||||
if (ch->flags & ZOMBIE) {
|
||||
INITDBG(L_VB, "Child died, PID= %d", ch->pid);
|
||||
ch->flags &= ~(RUNNING|ZOMBIE|WAITING);
|
||||
+#ifdef USE_PAM
|
||||
+ notify_pam_dead_session(ch->id);
|
||||
+#endif
|
||||
if (ch->process[0] != '+')
|
||||
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
|
||||
}
|
||||
--- src/init.sample
|
||||
+++ src/init.sample 2010-04-13 00:00:00.000000000 +0000
|
||||
@@ -0,0 +1,8 @@
|
||||
@ -99,113 +46,4 @@
|
||||
+auth sufficient pam_rootok.so
|
||||
+account include common-account
|
||||
+session requisite pam_lastlog.so silent
|
||||
--- src/utmp.c
|
||||
+++ src/utmp.c 2010-04-13 00:00:00.000000000 +0000
|
||||
@@ -34,10 +34,18 @@
|
||||
#include <string.h>
|
||||
#include <utmp.h>
|
||||
|
||||
+#if defined(USE_PAM) && defined(INIT_MAIN)
|
||||
+# include <security/pam_appl.h>
|
||||
+# include <security/pam_misc.h>
|
||||
+#endif
|
||||
+
|
||||
#include "init.h"
|
||||
#include "initreq.h"
|
||||
#include "paths.h"
|
||||
|
||||
+#ifndef _PATH_DEV
|
||||
+# define _PATH_DEV "/dev/"
|
||||
+#endif
|
||||
|
||||
#if defined(__GLIBC__)
|
||||
# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) && defined(__powerpc__)
|
||||
@@ -127,9 +135,9 @@ char *line) /* Which line is this */
|
||||
strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
|
||||
strncpy(utmp.ut_id , id , sizeof(utmp.ut_id ));
|
||||
strncpy(utmp.ut_line, line, sizeof(utmp.ut_line));
|
||||
-
|
||||
- /* Put the OS version in place of the hostname */
|
||||
- if (uname(&uname_buf) == 0)
|
||||
+
|
||||
+ /* Put the OS version in place of the hostname */
|
||||
+ if (uname(&uname_buf) == 0)
|
||||
strncpy(utmp.ut_host, uname_buf.release, sizeof(utmp.ut_host));
|
||||
|
||||
#if HAVE_UPDWTMP
|
||||
@@ -262,3 +270,75 @@ char *line) /* LINE if used. */
|
||||
write_wtmp(user, id, pid, type, line && line[0] ? line : oldline);
|
||||
}
|
||||
|
||||
+#if defined(USE_PAM) && defined(INIT_MAIN)
|
||||
+static pam_handle_t *pamh = NULL;
|
||||
+# ifdef __GNUC__
|
||||
+static int
|
||||
+null_conv(int num_msg, const struct pam_message **msgm,
|
||||
+ struct pam_response **response __attribute__((unused)),
|
||||
+ void *appdata_ptr __attribute__((unused)))
|
||||
+# else
|
||||
+static int
|
||||
+null_conv(int num_msg, const struct pam_message **msgm,
|
||||
+ struct pam_response **response, void *appdata_ptr)
|
||||
+# endif
|
||||
+{
|
||||
+ int i;
|
||||
+ for (i = 0; i < num_msg; i++) {
|
||||
+ const struct pam_message *msg = msgm[i];
|
||||
+ if (msg == (const struct pam_message*)0)
|
||||
+ continue;
|
||||
+ if (msg->msg == (char*)0)
|
||||
+ continue;
|
||||
+ switch (msg->msg_style) {
|
||||
+ case PAM_ERROR_MSG:
|
||||
+ case PAM_TEXT_INFO:
|
||||
+ initlog(L_VB, "pam_message %s", msg->msg);
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+static const struct pam_conv conv = { null_conv, NULL };
|
||||
+# define PAM_FAIL_CHECK(func, args...) \
|
||||
+ { \
|
||||
+ if ((pam_ret = (func)(args)) != PAM_SUCCESS) { \
|
||||
+ initlog(L_VB, "%s", pam_strerror(pamh, pam_ret)); \
|
||||
+ goto pam_error; \
|
||||
+ } \
|
||||
+ }
|
||||
+
|
||||
+void notify_pam_dead_session(const char *id)
|
||||
+{
|
||||
+ struct utmp *oldut, ut;
|
||||
+
|
||||
+ setutent();
|
||||
+
|
||||
+ memset(&ut, 0, sizeof(ut));
|
||||
+ ut.ut_type = DEAD_PROCESS;
|
||||
+ strncpy(ut.ut_id, id, sizeof(ut.ut_id));
|
||||
+
|
||||
+ if ((oldut = getutid(&ut)) && (oldut->ut_type == USER_PROCESS)) {
|
||||
+ int pam_ret;
|
||||
+ char tty[UT_LINESIZE+ strlen(_PATH_DEV) + 1];
|
||||
+
|
||||
+ if (strncmp(oldut->ut_line, _PATH_DEV, strlen(_PATH_DEV)))
|
||||
+ snprintf(tty, sizeof(tty), _PATH_DEV "%.*s",
|
||||
+ UT_LINESIZE, oldut->ut_line);
|
||||
+ else
|
||||
+ snprintf(tty, sizeof(tty), "%.*s",
|
||||
+ UT_LINESIZE, oldut->ut_line);
|
||||
+
|
||||
+ PAM_FAIL_CHECK(pam_start, "init", oldut->ut_user, &conv, &pamh);
|
||||
+ PAM_FAIL_CHECK(pam_set_item, pamh, PAM_TTY, tty);
|
||||
+ PAM_FAIL_CHECK(pam_set_item, pamh, PAM_RHOST, oldut->ut_host);
|
||||
+ PAM_FAIL_CHECK(pam_close_session, pamh, PAM_SILENT);
|
||||
+ pam_error:
|
||||
+ pam_end(pamh, pam_ret);
|
||||
+ }
|
||||
+
|
||||
+ endutent();
|
||||
+}
|
||||
+#endif /* USE_PAM && INIT_MAIN */
|
||||
+
|
||||
|
@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 4 15:24:01 UTC 2015 - sweet_f_a@gmx.de
|
||||
|
||||
- cleanup package
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 21 11:38:06 UTC 2014 - lnussel@suse.de
|
||||
|
||||
|
30
powerd.spec
30
powerd.spec
@ -16,11 +16,6 @@
|
||||
#
|
||||
|
||||
|
||||
%if %{undefined systemd_requires}
|
||||
%global with_sysvinit 1
|
||||
%endif
|
||||
%bcond_with sysvinit
|
||||
|
||||
Name: powerd
|
||||
Version: 2.0.2
|
||||
Release: 0
|
||||
@ -28,25 +23,15 @@ Summary: UPS monitoring daemon
|
||||
License: GPL-2.0+
|
||||
Group: System/Base
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if 0%{?suse_version} > 1140
|
||||
%if 0%{?suse_version} > 1230
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%else
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: systemd-devel
|
||||
%endif
|
||||
%endif
|
||||
Url: https://power.sourceforge.net/
|
||||
Source0: powerd-%{version}.tar.bz2
|
||||
Source1: rc.powerd
|
||||
Source2: powerd.service
|
||||
Patch0: powerd-%{version}.dif
|
||||
Patch1: powerd-%{version}-getaddrinfo.patch
|
||||
%if %{without sysvinit}
|
||||
%if %{undefined _unitdir}
|
||||
%{expand: %%global %_unitdir %(pkg-config systemd --variable=systemdsystemunitdir)}
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%description -n powerd
|
||||
powerd monitors the serial port connected to an UPS device and will perform
|
||||
@ -82,28 +67,17 @@ than a specified number of minutes.
|
||||
echo '# read manual page of detectups(8) and powerd(8) its self.' >> %{buildroot}/etc/powerd.conf
|
||||
echo '# ' >> %{buildroot}/etc/powerd.conf
|
||||
echo '# to enable powerd service run the command' >> %{buildroot}/etc/powerd.conf
|
||||
%if %{with sysvinit}
|
||||
echo '# insserv powerd' >> %{buildroot}/etc/powerd.conf
|
||||
echo '# rcpowerd start' >> %{buildroot}/etc/powerd.conf
|
||||
mkdir -p %{buildroot}/etc/init.d
|
||||
install -m 0744 %{S:1} %{buildroot}/etc/init.d/powerd
|
||||
ln -sf /etc/init.d/powerd %{buildroot}%{_sbindir}/rcpowerd
|
||||
%else
|
||||
echo '# systemctl enable powerd.service' >> %{buildroot}/etc/powerd.conf
|
||||
echo '# systemctl start powerd.service' >> %{buildroot}/etc/powerd.conf
|
||||
mkdir -p %{buildroot}/%{_unitdir}
|
||||
install -m 0644 %{S:2} %{buildroot}/%{_unitdir}/powerd.service
|
||||
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcpowerd
|
||||
%endif
|
||||
|
||||
%preun
|
||||
%stop_on_removal powerd
|
||||
|
||||
%postun
|
||||
%restart_on_update powerd
|
||||
%if %{with sysvinit}
|
||||
%insserv_cleanup
|
||||
%endif
|
||||
|
||||
%files -n powerd
|
||||
%defattr (-,root,root,755)
|
||||
@ -112,11 +86,7 @@ than a specified number of minutes.
|
||||
/sbin/detectups
|
||||
%{_sbindir}/rcpowerd
|
||||
%config /etc/powerd.conf
|
||||
%if %{with sysvinit}
|
||||
%config /etc/init.d/powerd
|
||||
%else
|
||||
%attr(0644,root,root) %{_unitdir}/powerd.service
|
||||
%endif
|
||||
%doc %{_mandir}/man8/powerd.8.gz
|
||||
%doc %{_mandir}/man8/detectups.8.gz
|
||||
|
||||
|
65
rc.powerd
65
rc.powerd
@ -1,65 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# System startup script for the UPS monitoring daemon
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: powerd
|
||||
# Required-Start: $syslog
|
||||
# Should-Start:
|
||||
# Required-Stop: $syslog
|
||||
# Should-Stop:
|
||||
# Default-Start: 2 3 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start the UPS monitoring daemon
|
||||
# Description: Start the UPS monitoring daemon
|
||||
### END INIT INFO
|
||||
|
||||
POWERD=/sbin/powerd
|
||||
test -x $POWERD || exit 5
|
||||
|
||||
POWERD_CONFIG=/etc/powerd.conf
|
||||
test -f $POWERD_CONFIG || exit 6
|
||||
|
||||
# Source SuSE config
|
||||
. /etc/rc.status
|
||||
|
||||
rc_reset
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting UPS monitoring daemon"
|
||||
startproc -f $POWERD
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down UPS monitoring daemon"
|
||||
killproc $POWERD
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
$0 start
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
$0 try-restart
|
||||
rc_status
|
||||
;;
|
||||
reload)
|
||||
$0 try-restart
|
||||
rc_status
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for UPS monitoring service"
|
||||
checkproc $POWERD
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
@ -1,161 +0,0 @@
|
||||
--- contrib/start-stop-daemon.c
|
||||
+++ contrib/start-stop-daemon.c Wed Feb 14 13:38:07 2001
|
||||
@@ -3,6 +3,7 @@
|
||||
* in C (faster - it is executed many times during system startup).
|
||||
*
|
||||
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
|
||||
+ * modified by Raymund Will <ray@lst.de>,
|
||||
* public domain.
|
||||
*/
|
||||
|
||||
@@ -13,12 +14,13 @@
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
+#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <pwd.h>
|
||||
|
||||
-#define VERSION "version 0.3, 1996-06-05"
|
||||
+#define VERSION "version 0.3.1, 1996-07-19"
|
||||
|
||||
static int testmode = 0;
|
||||
static int quietmode = 0;
|
||||
@@ -28,9 +30,8 @@
|
||||
static int signal_nr = 15;
|
||||
static int user_id = -1;
|
||||
static const char *userspec = NULL;
|
||||
-static const char *cmdname = NULL;
|
||||
+static char *cmdname = NULL;
|
||||
static char *execname = NULL;
|
||||
-static char *startas = NULL;
|
||||
static const char *pidfile = NULL;
|
||||
static const char *progname = "";
|
||||
|
||||
@@ -122,9 +123,8 @@
|
||||
-x|--exec <executable> program to start/check if it is running\n\
|
||||
-p|--pidfile <pid-file> pid file to check\n\
|
||||
-u|--user <username>|<uid> stop this user's processes\n\
|
||||
- -n|--name <process-name> stop processes with this name\n\
|
||||
+ -n|--name <process-name> start/stop processes with this name\n\
|
||||
-s|--signal <signal> signal to send (default 15)\n\
|
||||
- -a|--startas <pathname> program to start (default <executable>)\n\
|
||||
-t|--test test mode, don't do anything\n\
|
||||
-o|--oknodo exit status 0 (not 1) if nothing done\n\
|
||||
-q|--quiet | -v, --verbose\n\
|
||||
@@ -183,9 +183,7 @@
|
||||
case 'V': /* --version */
|
||||
printf("start-stop-daemon " VERSION "\n");
|
||||
exit(0);
|
||||
- case 'a': /* --startas <pathname> */
|
||||
- startas = optarg;
|
||||
- break;
|
||||
+ case 'a': /* --startas <pathname>: OBSOLETE */
|
||||
case 'n': /* --name <process-name> */
|
||||
cmdname = optarg;
|
||||
break;
|
||||
@@ -225,11 +223,11 @@
|
||||
if (!execname && !pidfile && !userspec)
|
||||
badusage("need at least one of --exec, --pidfile or --user");
|
||||
|
||||
- if (!startas)
|
||||
- startas = execname;
|
||||
+ if (!cmdname)
|
||||
+ cmdname = execname;
|
||||
|
||||
- if (start && !startas)
|
||||
- badusage("--start needs --exec or --startas");
|
||||
+ if (start && !cmdname)
|
||||
+ badusage("--start needs --exec or --cmdname");
|
||||
}
|
||||
|
||||
|
||||
@@ -262,25 +260,18 @@
|
||||
static int
|
||||
pid_is_cmd(int pid, const char *name)
|
||||
{
|
||||
- char buf[32];
|
||||
- FILE *f;
|
||||
- int c;
|
||||
+ char buf[1024];
|
||||
+ int h, c;
|
||||
|
||||
- sprintf(buf, "/proc/%d/stat", pid);
|
||||
- f = fopen(buf, "r");
|
||||
- if (!f)
|
||||
- return 0;
|
||||
- while ((c = getc(f)) != EOF && c != '(')
|
||||
- ;
|
||||
- if (c != '(') {
|
||||
- fclose(f);
|
||||
+ sprintf(buf, "/proc/%d/cmdline", pid);
|
||||
+ if ( (h=open(buf, O_RDONLY)) < 0 ||
|
||||
+ (c=read( h, buf, 1023)) <= 0 ) {
|
||||
return 0;
|
||||
}
|
||||
- /* this hopefully handles command names containing ')' */
|
||||
- while ((c = getc(f)) != EOF && c == *name)
|
||||
- name++;
|
||||
- fclose(f);
|
||||
- return (c == ')' && *name == '\0');
|
||||
+ close( h);
|
||||
+ buf[ c] = '\0';
|
||||
+
|
||||
+ return ( !strcmp( name, buf) );
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +345,7 @@
|
||||
fatal("internal error, please report");
|
||||
|
||||
if (!found) {
|
||||
- if (quietmode <= 0)
|
||||
+ if (quietmode < 0)
|
||||
printf("no %s found; none killed.\n", what);
|
||||
exit(exitnodo);
|
||||
}
|
||||
@@ -373,6 +364,9 @@
|
||||
for (p = killed; p; p = p->next)
|
||||
printf(" %d", p->pid);
|
||||
printf(").\n");
|
||||
+ } else if (quietmode == 0) {
|
||||
+ printf(" %s", what);
|
||||
+ fflush( stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,21 +404,25 @@
|
||||
}
|
||||
|
||||
if (found) {
|
||||
- if (quietmode <= 0)
|
||||
+ if (quietmode < 0)
|
||||
printf("%s already running.\n", execname);
|
||||
exit(exitnodo);
|
||||
}
|
||||
if (testmode) {
|
||||
- printf("would start %s ", startas);
|
||||
+ printf("would start %s ", cmdname);
|
||||
while (argc-- > 0)
|
||||
printf("%s ", *argv++);
|
||||
printf(".\n");
|
||||
exit(0);
|
||||
}
|
||||
- if (quietmode < 0)
|
||||
- printf("starting %s ...\n", startas);
|
||||
- *--argv = startas;
|
||||
- execv(startas, argv);
|
||||
- fatal("unable to start %s: %s", startas, strerror(errno));
|
||||
+ if (quietmode < 0) {
|
||||
+ printf("starting %s ...\n", cmdname);
|
||||
+ } else if (quietmode == 0) {
|
||||
+ printf(" %s", cmdname);
|
||||
+ fflush( stdout);
|
||||
+ }
|
||||
+ *--argv = cmdname;
|
||||
+ execv(execname, argv);
|
||||
+ fatal("%s: %s", execname, strerror(errno));
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
--- src/consoles.h
|
||||
+++ src/consoles.h 2011-07-27 11:10:26.620613503 +0000
|
||||
@@ -39,6 +39,7 @@ struct console {
|
||||
int fd, id;
|
||||
#define CON_SERIAL 0x0001
|
||||
#define CON_NOTTY 0x0002
|
||||
+#define CON_EIGHTBIT 0x1000
|
||||
pid_t pid;
|
||||
struct chardata cp;
|
||||
struct termios tio;
|
||||
--- src/sulogin.c
|
||||
+++ src/sulogin.c 2011-07-27 13:10:16.791925602 +0000
|
||||
@@ -635,6 +635,7 @@ char *getpasswd(struct console *con)
|
||||
ptr = &pass[0];
|
||||
cp->eol = *ptr = '\0';
|
||||
|
||||
+ con->flags &= ~CON_EIGHTBIT;
|
||||
eightbit = ((con->flags & CON_SERIAL) == 0 || (tty.c_cflag & (PARODD|PARENB)) == 0);
|
||||
while (cp->eol == '\0') {
|
||||
if (read(fd, &c, 1) < 1) {
|
||||
@@ -697,6 +698,8 @@ char *getpasswd(struct console *con)
|
||||
goto quit;
|
||||
}
|
||||
*ptr++ = ascval;
|
||||
+ if (((unsigned char)ascval) & 0x80)
|
||||
+ con->flags |= CON_EIGHTBIT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -839,6 +842,30 @@ void usage(void)
|
||||
fprintf(stderr, "Usage: sulogin [-e] [-p] [-t timeout] [tty device]\n\r");
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Wrapper for blowfish signedness bug (CVE-2011-2483)
|
||||
+ */
|
||||
+
|
||||
+static
|
||||
+int checkpw(const char *answer, const char *passwd, const struct console *con)
|
||||
+{
|
||||
+ char buf[64];
|
||||
+
|
||||
+ if (strcmp(crypt(answer, passwd), passwd) == 0)
|
||||
+ return 1;
|
||||
+ if (strncmp(passwd, "$2a$", 4) != 0)
|
||||
+ return 0;
|
||||
+ if ((con->flags & CON_EIGHTBIT) == 0)
|
||||
+ return 0;
|
||||
+ if (strlen(passwd) >= 64)
|
||||
+ return 0;
|
||||
+
|
||||
+ strncpy(buf, passwd, 64);
|
||||
+ buf[2] = 'x';
|
||||
+
|
||||
+ return (strcmp(crypt(answer, buf), buf) == 0);
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *tty = NULL;
|
||||
@@ -967,8 +994,7 @@ int main(int argc, char **argv)
|
||||
if ((answer = getpasswd(con)) == NULL)
|
||||
break;
|
||||
|
||||
- if (passwd[0] == '\0' ||
|
||||
- strcmp(crypt(answer, passwd), passwd) == 0) {
|
||||
+ if (passwd[0] == '\0' || checkpw(answer, passwd, con)) {
|
||||
*usemask |= (1<<con->id);
|
||||
sushell(pwd);
|
||||
*usemask &= ~(1<<con->id);
|
@ -1,22 +0,0 @@
|
||||
Index: src/Makefile
|
||||
===================================================================
|
||||
--- src/Makefile.orig
|
||||
+++ src/Makefile
|
||||
@@ -70,7 +70,7 @@ MANDIR = /usr/share/man
|
||||
ifeq ($(WITH_SELINUX),yes)
|
||||
SELINUX_DEF = -DWITH_SELINUX
|
||||
INITLIBS += -lsepol -lselinux
|
||||
- SULOGINLIBS = -lselinux
|
||||
+ SULOGINLIBS = -lselinux
|
||||
else
|
||||
SELINUX_DEF =
|
||||
INITLIBS =
|
||||
@@ -78,7 +78,7 @@ else
|
||||
endif
|
||||
|
||||
# Additional libs for GNU libc.
|
||||
-ifneq ($(wildcard /usr/lib*/libcrypt.a),)
|
||||
+ifneq ($(wildcard /usr/lib*/libcrypt.so),)
|
||||
SULOGINLIBS += -lcrypt
|
||||
endif
|
||||
|
@ -1,149 +0,0 @@
|
||||
--- src/init.c
|
||||
+++ src/init.c 2012-05-04 13:56:17.470065199 +0200
|
||||
@@ -252,7 +252,7 @@ void *imalloc(size_t size)
|
||||
}
|
||||
|
||||
static
|
||||
-char *istrdup(char *s)
|
||||
+char *istrdup(const char *s)
|
||||
{
|
||||
char *m;
|
||||
int l;
|
||||
@@ -884,6 +884,27 @@ void initlog(int loglevel, char *s, ...)
|
||||
}
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Add or replace specific environment value
|
||||
+ */
|
||||
+int addnewenv(const char *new, char **curr, int n)
|
||||
+{
|
||||
+ size_t nlen = strcspn(new, "=");
|
||||
+ int i;
|
||||
+ for (i = 0; i < n; i++) {
|
||||
+ if (nlen != strcspn(curr[i], "="))
|
||||
+ continue;
|
||||
+ if (strncmp (new, curr[i], nlen) == 0)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (i >= n)
|
||||
+ curr[n++] = istrdup(new);
|
||||
+ else {
|
||||
+ free(curr[i]);
|
||||
+ curr[i] = istrdup(new);
|
||||
+ }
|
||||
+ return n;
|
||||
+}
|
||||
|
||||
/*
|
||||
* Build a new environment for execve().
|
||||
@@ -892,35 +913,40 @@ char **init_buildenv(int child)
|
||||
{
|
||||
char i_lvl[] = "RUNLEVEL=x";
|
||||
char i_prev[] = "PREVLEVEL=x";
|
||||
- char i_cons[32];
|
||||
+ char i_cons[128];
|
||||
char i_shell[] = "SHELL=" SHELL;
|
||||
char **e;
|
||||
int n, i;
|
||||
|
||||
for (n = 0; environ[n]; n++)
|
||||
;
|
||||
- n += NR_EXTRA_ENV;
|
||||
+ n += NR_EXTRA_ENV + 1; /* Also room for last NULL */
|
||||
if (child)
|
||||
n += 8;
|
||||
- e = calloc(n, sizeof(char *));
|
||||
+
|
||||
+ while ((e = (char**)calloc(n, sizeof(char *))) == NULL) {
|
||||
+ initlog(L_VB, "out of memory");
|
||||
+ do_sleep(5);
|
||||
+ }
|
||||
|
||||
for (n = 0; environ[n]; n++)
|
||||
e[n] = istrdup(environ[n]);
|
||||
|
||||
for (i = 0; i < NR_EXTRA_ENV; i++) {
|
||||
- if (extra_env[i])
|
||||
- e[n++] = istrdup(extra_env[i]);
|
||||
+ if (extra_env[i] == NULL || *extra_env[i] == '\0')
|
||||
+ continue;
|
||||
+ n = addnewenv(extra_env[i], e, n);
|
||||
}
|
||||
|
||||
if (child) {
|
||||
snprintf(i_cons, sizeof(i_cons), "CONSOLE=%s", console_dev);
|
||||
i_lvl[9] = thislevel;
|
||||
i_prev[10] = prevlevel;
|
||||
- e[n++] = istrdup(i_shell);
|
||||
- e[n++] = istrdup(i_lvl);
|
||||
- e[n++] = istrdup(i_prev);
|
||||
- e[n++] = istrdup(i_cons);
|
||||
- e[n++] = istrdup(E_VERSION);
|
||||
+ n = addnewenv(i_shell, e, n);
|
||||
+ n = addnewenv(i_lvl, e, n);
|
||||
+ n = addnewenv(i_prev, e, n);
|
||||
+ n = addnewenv(i_cons, e, n);
|
||||
+ n = addnewenv(E_VERSION, e, n);
|
||||
}
|
||||
|
||||
e[n++] = NULL;
|
||||
@@ -2146,41 +2172,46 @@ void fifo_new_level(int level)
|
||||
static
|
||||
void initcmd_setenv(char *data, int size)
|
||||
{
|
||||
- char *env, *p, *e, *eq;
|
||||
- int i, sz;
|
||||
+ char *env, *p, *e;
|
||||
+ size_t sz;
|
||||
+ int i, eq;
|
||||
|
||||
e = data + size;
|
||||
|
||||
while (*data && data < e) {
|
||||
- eq = NULL;
|
||||
for (p = data; *p && p < e; p++)
|
||||
- if (*p == '=') eq = p;
|
||||
+ ;
|
||||
if (*p) break;
|
||||
env = data;
|
||||
data = ++p;
|
||||
|
||||
- sz = eq ? (eq - env) : (p - env);
|
||||
-
|
||||
- /*initlog(L_SY, "init_setenv: %s, %s, %d", env, eq, sz);*/
|
||||
-
|
||||
/*
|
||||
* We only allow INIT_* to be set.
|
||||
*/
|
||||
if (strncmp(env, "INIT_", 5) != 0)
|
||||
continue;
|
||||
|
||||
+ sz = strcspn(env, "=");
|
||||
+ eq = (env[sz] == '=');
|
||||
+
|
||||
+ /*initlog(L_SY, "init_setenv: %s, %d, %d", env, eq, sz);*/
|
||||
+
|
||||
/* Free existing vars. */
|
||||
for (i = 0; i < NR_EXTRA_ENV; i++) {
|
||||
- if (extra_env[i] == NULL) continue;
|
||||
- if (!strncmp(extra_env[i], env, sz) &&
|
||||
- extra_env[i][sz] == '=') {
|
||||
+ if (extra_env[i] == NULL)
|
||||
+ continue;
|
||||
+ if (sz != strcspn(extra_env[i], "="))
|
||||
+ continue;
|
||||
+ if (strncmp(extra_env[i], env, sz) == 0) {
|
||||
free(extra_env[i]);
|
||||
extra_env[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
+ if (eq == 0)
|
||||
+ continue;
|
||||
+
|
||||
/* Set new vars if needed. */
|
||||
- if (eq == NULL) continue;
|
||||
for (i = 0; i < NR_EXTRA_ENV; i++) {
|
||||
if (extra_env[i] == NULL) {
|
||||
extra_env[i] = istrdup(env);
|
@ -1,23 +0,0 @@
|
||||
use /run/utmp
|
||||
Index: src/paths.h
|
||||
===================================================================
|
||||
--- src/paths.h.orig
|
||||
+++ src/paths.h
|
||||
@@ -48,3 +48,5 @@
|
||||
#define REBOOTSCRIPT2 "/etc/rc.d/rc.6" /* Ditto. */
|
||||
#endif
|
||||
|
||||
+#undef UTMP_FILE
|
||||
+#define UTMP_FILE "/run/utmp"
|
||||
Index: src/init.c
|
||||
===================================================================
|
||||
--- src/init.c.orig
|
||||
+++ src/init.c
|
||||
@@ -2634,6 +2634,7 @@ void init_main(void)
|
||||
*/
|
||||
if ((fd = open(UTMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0644)) >= 0)
|
||||
close(fd);
|
||||
+ utmpname(UTMP_FILE);
|
||||
|
||||
/*
|
||||
* Say hello to the world
|
@ -16,29 +16,3 @@ Index: src/killall5.c
|
||||
if (buf[0] == '\0') {
|
||||
nsyslog(LOG_ERR,
|
||||
"can't read from %s\n", path);
|
||||
Index: src/shutdown.c
|
||||
===================================================================
|
||||
--- src/shutdown.c (revision 116)
|
||||
+++ src/shutdown.c (working copy)
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
char *clean_env[] = {
|
||||
"HOME=/",
|
||||
- "PATH=/bin:/usr/bin:/sbin:/usr/sbin",
|
||||
+ "PATH=" PATH_DEFAULT,
|
||||
"TERM=dumb",
|
||||
"SHELL=/bin/sh",
|
||||
NULL,
|
||||
Index: src/sulogin.c
|
||||
===================================================================
|
||||
--- src/sulogin.c (revision 116)
|
||||
+++ src/sulogin.c (working copy)
|
||||
@@ -987,7 +998,7 @@
|
||||
}
|
||||
if (alarm_rised) {
|
||||
tcfinal(con);
|
||||
- printf("Timed out.\n\r");
|
||||
+ fprintf(stderr, "Timed out.\n\r");
|
||||
}
|
||||
/*
|
||||
* User may pressed Control-D.
|
||||
|
@ -1,24 +0,0 @@
|
||||
--- src/consoles.c
|
||||
+++ src/consoles.c 2014-02-07 15:33:15.786235493 +0000
|
||||
@@ -313,16 +313,19 @@ console:
|
||||
*/
|
||||
if ((fc = fopen("/proc/consoles", "re"))) {
|
||||
char fbuf[16];
|
||||
- int maj, min;
|
||||
+ int maj, min, matches;
|
||||
DIR *dir;
|
||||
dir = opendir("/dev");
|
||||
if (!dir) {
|
||||
fclose(fc);
|
||||
goto fallback;
|
||||
}
|
||||
- while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) {
|
||||
+ while ((matches = fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min)) >= 1) {
|
||||
char * name;
|
||||
|
||||
+ if (matches != 3)
|
||||
+ continue;
|
||||
+
|
||||
if (!strchr(fbuf, 'E'))
|
||||
continue;
|
||||
comparedev = makedev(maj, min);
|
@ -1,6 +1,6 @@
|
||||
--- src/Makefile
|
||||
+++ src/Makefile 2010-03-23 15:11:12.000000000 +0000
|
||||
@@ -9,16 +9,16 @@
|
||||
--- src/Makefile.orig 2015-12-04 14:01:44.134651379 +0100
|
||||
+++ src/Makefile 2015-12-04 14:01:50.735728998 +0100
|
||||
@@ -9,19 +9,19 @@
|
||||
#
|
||||
|
||||
CPPFLAGS = -DUSE_PAM
|
||||
@ -11,19 +11,41 @@
|
||||
|
||||
# For some known distributions we do not build all programs, otherwise we do.
|
||||
BIN =
|
||||
SBIN = init halt shutdown runlevel killall5 fstab-decode
|
||||
-SBIN = init halt shutdown runlevel killall5 fstab-decode
|
||||
-USRBIN = last mesg
|
||||
+SBIN = killall5 fstab-decode
|
||||
+USRBIN =
|
||||
|
||||
-MAN1 = last.1 lastb.1 mesg.1
|
||||
-MAN5 = initscript.5 inittab.5
|
||||
-MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
|
||||
-MAN8 += shutdown.8 telinit.8 fstab-decode.8
|
||||
+MAN1 =
|
||||
MAN5 = initscript.5 inittab.5
|
||||
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
|
||||
MAN8 += shutdown.8 telinit.8 fstab-decode.8
|
||||
@@ -176,10 +176,8 @@ endif
|
||||
ln -sf halt $(ROOT)/sbin/reboot
|
||||
ln -sf halt $(ROOT)/sbin/poweroff
|
||||
ln -sf init $(ROOT)/sbin/telinit
|
||||
+MAN5 =
|
||||
+MAN8 = killall5.8 pidof.8
|
||||
+MAN8 += fstab-decode.8
|
||||
|
||||
ifeq ($(DISTRO),)
|
||||
BIN += mountpoint
|
||||
@@ -46,11 +46,6 @@
|
||||
|
||||
ifeq ($(DISTRO),SuSE)
|
||||
CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
|
||||
-BIN += mountpoint
|
||||
-SBIN += sulogin
|
||||
-USRBIN += utmpdump
|
||||
-MAN1 += utmpdump.1 mountpoint.1
|
||||
-MAN8 += sulogin.8
|
||||
endif
|
||||
|
||||
ID = $(shell id -u)
|
||||
@@ -173,13 +168,8 @@
|
||||
endif
|
||||
# $(INSTALL_DIR) $(ROOT)/etc/
|
||||
# $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
|
||||
- ln -sf halt $(ROOT)/sbin/reboot
|
||||
- ln -sf halt $(ROOT)/sbin/poweroff
|
||||
- ln -sf init $(ROOT)/sbin/telinit
|
||||
- ln -sf /sbin/killall5 $(ROOT)/bin/pidof
|
||||
- if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
|
||||
- ln -sf last $(ROOT)/usr/bin/lastb; \
|
||||
@ -33,23 +55,3 @@
|
||||
$(INSTALL_DIR) $(ROOT)/usr/include/
|
||||
$(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
|
||||
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
|
||||
--- src/bootlogd.c
|
||||
+++ src/bootlogd.c 2011-03-15 14:58:54.000000000 +0000
|
||||
@@ -241,7 +241,7 @@
|
||||
int consolename(char *res, size_t rlen)
|
||||
{
|
||||
#ifdef TIOCGDEV
|
||||
- unsigned int kdev;
|
||||
+ kdev_t kdev;
|
||||
#endif
|
||||
struct stat st;
|
||||
int n;
|
||||
@@ -559,7 +559,7 @@
|
||||
}
|
||||
|
||||
(void)ioctl(0, TIOCCONS, NULL);
|
||||
-#if 1
|
||||
+#if 0
|
||||
/* Work around bug in 2.1/2.2 kernels. Fixed in 2.2.13 and 2.3.18 */
|
||||
if ((n = open("/dev/tty0", O_RDWR)) >= 0) {
|
||||
(void)ioctl(n, TIOCCONS, NULL);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,113 +1,3 @@
|
||||
--- man/init.8
|
||||
+++ man/init.8 2010-03-19 14:44:16.000000000 +0000
|
||||
@@ -261,7 +261,7 @@ It activates the \fIkbrequest\fP action.
|
||||
.SH CONFORMING TO
|
||||
\fBInit\fP is compatible with the System V init. It works closely
|
||||
together with the scripts in the directories
|
||||
-\fI/etc/init.d\fP and \fI/etc/rc{runlevel}.d\fP.
|
||||
+\fI/etc/init.d\fP and \fI/etc/init.d/rc{runlevel}.d\fP.
|
||||
If your system uses this convention, there should be a \fIREADME\fP
|
||||
file in the directory \fI/etc/init.d\fP explaining how these scripts work.
|
||||
.\"}}}
|
||||
@@ -301,6 +301,7 @@ page by Michael Haardt (u31b3hs@pool.inf
|
||||
.\"}}}
|
||||
.\"{{{ See also
|
||||
.SH "SEE ALSO"
|
||||
+.BR init.d (7),
|
||||
.BR getty (1),
|
||||
.BR login (1),
|
||||
.BR sh (1),
|
||||
--- man/inittab.5
|
||||
+++ man/inittab.5 2004-03-12 12:33:05.000000000 +0000
|
||||
@@ -197,7 +197,7 @@ rc::bootwait:/etc/rc
|
||||
.fi
|
||||
.sp
|
||||
.RE
|
||||
-This inittab file executes \fB/etc/rc\fP during boot and starts gettys
|
||||
+This inittab file executes \fB/etc/rc\fP during boot and starts mingettys
|
||||
on tty1\-tty4.
|
||||
.PP
|
||||
A more elaborate \fBinittab\fP with different runlevels (see the comments
|
||||
@@ -205,23 +205,20 @@ inside):
|
||||
.RS
|
||||
.sp
|
||||
.nf
|
||||
-.ne 19
|
||||
+.ne 41
|
||||
# Level to run in
|
||||
id:2:initdefault:
|
||||
|
||||
# Boot-time system configuration/initialization script.
|
||||
-si::sysinit:/etc/init.d/rcS
|
||||
+si:I:bootwait:/etc/init.d/boot
|
||||
|
||||
-# What to do in single-user mode.
|
||||
-~:S:wait:/sbin/sulogin
|
||||
-
|
||||
-# /etc/init.d executes the S and K scripts upon change
|
||||
-# of runlevel.
|
||||
-#
|
||||
-# Runlevel 0 is halt.
|
||||
-# Runlevel 1 is single-user.
|
||||
-# Runlevels 2-5 are multi-user.
|
||||
-# Runlevel 6 is reboot.
|
||||
+# Runlevel 0 is System halt (Never use this as initdefault!)
|
||||
+# Runlevel 1 is Single user mode
|
||||
+# Runlevel 2 is Local multiuser without remote network (e.g. NFS)
|
||||
+# Runlevel 3 is Full multiuser with network
|
||||
+# Runlevel 4 is Not used
|
||||
+# Runlevel 5 is Full multiuser with network and xdm
|
||||
+# Runlevel 6 is System reboot (Never use this as initdefault!)
|
||||
|
||||
l0:0:wait:/etc/init.d/rc 0
|
||||
l1:1:wait:/etc/init.d/rc 1
|
||||
@@ -231,17 +228,27 @@ l4:4:wait:/etc/init.d/rc 4
|
||||
l5:5:wait:/etc/init.d/rc 5
|
||||
l6:6:wait:/etc/init.d/rc 6
|
||||
|
||||
+# What to do in single-user mode
|
||||
+ls:S:wait:/etc/init.d/rc S
|
||||
+~~:S:respawn:/sbin/sulogin
|
||||
+
|
||||
# What to do at the "3 finger salute".
|
||||
-ca::ctrlaltdel:/sbin/shutdown -t1 -h now
|
||||
+ca::ctrlaltdel:/sbin/shutdown -t5 -h now
|
||||
|
||||
-# Runlevel 2,3: getty on virtual consoles
|
||||
-# Runlevel 3: getty on terminal (ttyS0) and modem (ttyS1)
|
||||
-1:23:respawn:/sbin/getty tty1 VC linux
|
||||
-2:23:respawn:/sbin/getty tty2 VC linux
|
||||
-3:23:respawn:/sbin/getty tty3 VC linux
|
||||
-4:23:respawn:/sbin/getty tty4 VC linux
|
||||
-S0:3:respawn:/sbin/getty -L 9600 ttyS0 vt320
|
||||
-S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
|
||||
+# Runlevel 2 upto 5: mingetty on console.
|
||||
+# level 2, 3, and 5 also getty on serial port S0.
|
||||
+1:2345:respawn:/sbin/mingetty --noclear tty1
|
||||
+2:2345:respawn:/sbin/mingetty tty2
|
||||
+3:2345:respawn:/sbin/mingetty tty3
|
||||
+4:2345:respawn:/sbin/mingetty tty4
|
||||
+5:2345:respawn:/sbin/mingetty tty5
|
||||
+6:2345:respawn:/sbin/mingetty tty6
|
||||
+S0:235:respawn:/sbin/agetty -L 9600 ttyS0 vt102
|
||||
+
|
||||
+# modem getty(s),
|
||||
+# /dev/modem is a link to the modem device.
|
||||
+#mo:235:respawn:/usr/sbin/mgetty -s 38400 modem
|
||||
+mo:235:respawn:/sbin/uugetty modem M19200
|
||||
|
||||
.fi
|
||||
.sp
|
||||
@@ -261,5 +268,8 @@ by Michael Haardt (u31b3hs@pool.informat
|
||||
.\"{{{ See also
|
||||
.SH "SEE ALSO"
|
||||
.BR init (8),
|
||||
-.BR telinit (8)
|
||||
+.BR telinit (8),
|
||||
+.BR init.d (7),
|
||||
+.BR agetty (8),
|
||||
+.BR mgetty (8)
|
||||
.\"}}}
|
||||
--- man/killall5.8
|
||||
+++ man/killall5.8 2010-03-19 14:43:25.000000000 +0000
|
||||
@@ -44,6 +44,7 @@ process were killed, and 1 if it was una
|
||||
@ -129,14 +19,3 @@
|
||||
.BR shutdown (8),
|
||||
.BR init (8),
|
||||
.BR halt (8),
|
||||
--- man/sulogin.8
|
||||
+++ man/sulogin.8 2004-03-12 12:26:35.000000000 +0000
|
||||
@@ -35,7 +35,7 @@ passes it the \fB\-b\fP option.
|
||||
.PP
|
||||
The user is prompted
|
||||
.IP "" .5i
|
||||
-Give root password for system maintenance
|
||||
+Give root password for system login
|
||||
.br
|
||||
(or type Control\-D for normal startup):
|
||||
.PP
|
||||
|
@ -1,7 +0,0 @@
|
||||
addFilter(".*statically-linked-binary.*/sbin/init.*")
|
||||
addFilter(".*files-duplicate.*/usr/share/man/man.*")
|
||||
addFilter(".*non-remote_fs-dependency.*/etc/init.d/powerd.*")
|
||||
addFilter(".*incoherent-init-script-name.*powerd.*")
|
||||
addFilter(".*no-manual-page-for-binary.*sysvinit.*")
|
||||
addFilter(".*dangling-symlink.*/sbin/init.*/sbin/sysvinit.*")
|
||||
addFilter(".*no-manual-page-for-binary.*rcpowerd.*")
|
@ -1,3 +1,28 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 4 15:24:01 UTC 2015 - sweet_f_a@gmx.de
|
||||
|
||||
- cleanup package:
|
||||
* don't build binaries which are not installed
|
||||
* remove unused sources
|
||||
* remove patches (or parts of patches) which modify unused files
|
||||
* remove old build conditions (sysvinit, util-linux, mkinitrd)
|
||||
* remove unused dependencies
|
||||
- this cleanup does not change the resulting binaries (except some
|
||||
package dependencies)
|
||||
- list of removed patches:
|
||||
* sysvinit-2.82-startstop.patch
|
||||
* sysvinit-2.88+dsf-blowfish.dif
|
||||
* sysvinit-2.88+dsf-crypt.patch
|
||||
* sysvinit-2.88+dsf-env.patch
|
||||
* sysvinit-2.88dsf-multiple-sulogin.patch
|
||||
* sysvinit-2.88+dsf-run.diff
|
||||
* sysvinit-2.88+dsf-xen.patch
|
||||
- list of modified patches:
|
||||
* notify-pam-dead.patch
|
||||
* sysvinit-2.88+dsf.dif
|
||||
* sysvinit-2.88+dsf-sulogin.diff
|
||||
* sysvinit-2.88dsf-suse.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 1 10:48:20 UTC 2015 - sweet_f_a@gmx.de
|
||||
|
||||
|
221
sysvinit.spec
221
sysvinit.spec
@ -16,22 +16,6 @@
|
||||
#
|
||||
|
||||
|
||||
%if 0%{suse_version} < 1300
|
||||
%global with_util_linux 1
|
||||
%endif
|
||||
%bcond_with util_linux
|
||||
%if %{undefined systemd_requires}
|
||||
%bcond_without sysvinit
|
||||
%else
|
||||
%bcond_with sysvinit
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version} > 1310
|
||||
%define have_mkinitrd 0
|
||||
%else
|
||||
%define have_mkinitrd 1
|
||||
%endif
|
||||
|
||||
Name: sysvinit
|
||||
%define KPVER 2.21
|
||||
%define SCVER 1.16
|
||||
@ -43,57 +27,26 @@ Summary: SysV-Style init
|
||||
License: GPL-2.0+
|
||||
Group: System/Base
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: audit-devel
|
||||
BuildRequires: libselinux-devel
|
||||
BuildRequires: libsepol-devel
|
||||
BuildRequires: pam-devel
|
||||
%if 0%{?suse_version} > 1140
|
||||
%if 0%{?suse_version} > 1230
|
||||
BuildRequires: systemd-rpm-macros
|
||||
%else
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: systemd-devel
|
||||
%endif
|
||||
%endif
|
||||
#!BuildIgnore: sysvinit-tools
|
||||
Requires(post): coreutils grep
|
||||
%if %have_mkinitrd
|
||||
Requires(post): mkinitrd
|
||||
Requires(postun): mkinitrd
|
||||
%endif
|
||||
Url: http://savannah.nongnu.org/projects/sysvinit/
|
||||
Source: sysvinit-%{SIVER}dsf.tar.bz2
|
||||
Source2: killproc-%{KPVER}.tar.bz2
|
||||
Source4: showconsole-%{SCVER}.tar.bz2
|
||||
Source5: startpar-%{START}.tar.bz2
|
||||
Source7: %{name}-rpmlintrc
|
||||
Source8: mkinitrd-boot.sh
|
||||
Source9: mkinitrd-kill1.sh
|
||||
Source10: mkinitrd-kill2.sh
|
||||
Patch: %{name}-%{version}dsf.dif
|
||||
Patch1: %{name}-2.82-startstop.patch
|
||||
Patch2: %{name}-2.88dsf-suse.patch
|
||||
Patch3: %{name}-2.88dsf-scripts2.patch
|
||||
Patch4: notify-pam-dead.patch
|
||||
Patch5: %{name}-2.88dsf-multiple-sulogin.patch
|
||||
Patch6: %{name}-%{version}dsf-run.diff
|
||||
Patch7: %{name}-%{version}dsf-crypt.patch
|
||||
Patch8: %{name}-%{version}dsf-blowfish.dif
|
||||
Patch9: %{name}-2.88dsf-no-kill.patch
|
||||
Patch10: %{name}-%{version}dsf-env.patch
|
||||
Patch11: %{name}-%{version}dsf-dostat.patch
|
||||
# PATCH-FIX-UPSTREAM -- killall5: handle strange names of executables
|
||||
Patch12: %{name}-%{version}dsf-sulogin.diff
|
||||
# PATCH-FIX-SUSE -- sulogin: find suitable console device even if first is not usable
|
||||
Patch13: %{name}-%{version}dsf-xen.patch
|
||||
Patch30: killproc-%{KPVER}.dif
|
||||
Patch31: killproc-2.18-open_flags.dif
|
||||
Patch40: showconsole-%{SCVER}.dif
|
||||
Patch41: showconsole-1.16-deadlock.diff
|
||||
Patch42: showconsole-1.16-glibc.dif
|
||||
Patch50: startpar-%{START}.dif
|
||||
Requires: mingetty
|
||||
Requires: sysvinit-tools
|
||||
|
||||
%description
|
||||
System V style init programs by Miquel van Smoorenburg that control the
|
||||
@ -108,46 +61,20 @@ more information.
|
||||
%package tools
|
||||
Summary: Tools for basic booting
|
||||
Group: System/Base
|
||||
%if 0%{suse_version} > 1120
|
||||
Requires(preun): coreutils %insserv_prereq
|
||||
Requires(postun): coreutils %insserv_prereq
|
||||
%else
|
||||
PreReq: coreutils %insserv_prereq
|
||||
%endif
|
||||
|
||||
%description tools
|
||||
Helper tools from sysvinit that support booting, including but not exclusive
|
||||
to startpar, killproc and pidof. System V init specific programs are in the
|
||||
sysvinit package.
|
||||
|
||||
%package init
|
||||
Summary: Provides /sbin/init for sysvinit
|
||||
Group: System/Base
|
||||
Provides: sbin_init
|
||||
Conflicts: otherproviders(sbin_init)
|
||||
Requires: %{name}
|
||||
%ifnarch s390 s390x
|
||||
Requires: powerd
|
||||
%endif
|
||||
|
||||
%description init
|
||||
Just some symlinks and manual page for sysvinit
|
||||
|
||||
%prep
|
||||
%setup -n %{name}-%{SIVER}dsf -q -b 2 -b 4 -b 5
|
||||
%patch1 -p0 -b .startstop
|
||||
%patch2 -p0 -b .suse
|
||||
%patch3 -p0 -b .scripts2
|
||||
%patch4 -p0 -b .pam
|
||||
%patch5 -p0 -b .sulogin
|
||||
%patch6 -p0 -b .run
|
||||
%patch7 -p0 -b .crypt
|
||||
%patch8 -p0 -b .blowfish
|
||||
%patch9 -p0 -b .no-kill
|
||||
%patch10 -p0 -b .env
|
||||
%patch11 -p0 -b .dostat
|
||||
%patch12 -p0 -b .ka5
|
||||
%patch13 -p0 -b .xen
|
||||
%patch
|
||||
pushd doc
|
||||
mkdir killproc showconsole
|
||||
@ -186,30 +113,7 @@ pushd ../startpar-%{START}
|
||||
popd
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir %{buildroot}
|
||||
mkdir -m 755 -p %{buildroot}/bin
|
||||
mkdir -m 755 -p %{buildroot}/dev
|
||||
mkdir -m 755 -p %{buildroot}/etc
|
||||
mkdir -m 755 -p %{buildroot}/sbin
|
||||
mkdir -m 755 -p %{buildroot}/usr/bin
|
||||
mkdir -m 755 -p %{buildroot}/usr/include
|
||||
mkdir -m 755 -p %{buildroot}%{_mandir}/man1
|
||||
mkdir -m 755 -p %{buildroot}%{_mandir}/man5
|
||||
mkdir -m 755 -p %{buildroot}%{_mandir}/man8
|
||||
make install -C src MANPATH=%{_mandir} ROOT=%{buildroot} WITH_SELINUX=yes DISTRO=SuSE
|
||||
mv %{buildroot}/sbin/init %{buildroot}/sbin/sysvinit
|
||||
mv %{buildroot}%{_mandir}/man8/init.8 %{buildroot}/%{_mandir}/man8/sysvinit.8
|
||||
ln -s /sbin/sysvinit %{buildroot}/sbin/init
|
||||
ln -s sysvinit.8 %{buildroot}%{_mandir}/man8/init.8
|
||||
mkdir -p %{buildroot}/lib/sysvinit
|
||||
ln -sf /sbin/sysvinit %{buildroot}/lib/sysvinit/telinit
|
||||
ln -sf /sbin/sysvinit %{buildroot}/sbin/telinit
|
||||
test -p %{buildroot}/dev/initctl || {
|
||||
rm -f %{buildroot}/dev/initctl
|
||||
mknod %{buildroot}/dev/initctl p
|
||||
chmod 600 %{buildroot}/dev/initctl
|
||||
}
|
||||
make install -C src MANPATH=%{_mandir} ROOT=%{buildroot} DISTRO=SuSE
|
||||
pushd ../showconsole-%{SCVER}
|
||||
make install MANPATH=%{_mandir} INSTBINFLAGS="-m 0700" DESTDIR=%{buildroot}
|
||||
popd
|
||||
@ -220,124 +124,17 @@ pushd ../startpar-%{START}
|
||||
make install DESTDIR=%{buildroot}
|
||||
popd
|
||||
#
|
||||
# Install mkinitrd scriptlets
|
||||
#
|
||||
%if %have_mkinitrd
|
||||
install -d %{buildroot}/lib/mkinitrd/scripts
|
||||
install -m 0755 %{SOURCE8} %{buildroot}/lib/mkinitrd/scripts/boot-blogd.sh
|
||||
install -m 0755 %{SOURCE9} %{buildroot}/lib/mkinitrd/scripts/boot-killblogd.sh
|
||||
install -m 0755 %{SOURCE10} %{buildroot}/lib/mkinitrd/scripts/boot-killblogd2.sh
|
||||
%endif
|
||||
#
|
||||
# Remove files not packed:
|
||||
#
|
||||
rm -f %{buildroot}/usr/include/{initreq.h,libblogger.h}
|
||||
rm -f %{buildroot}/usr/lib/libblogger.a
|
||||
rm -f %{buildroot}%{_mandir}/man1/mesg.1*
|
||||
rm %{buildroot}/usr/include/{initreq.h,libblogger.h}
|
||||
rm %{buildroot}/usr/lib/libblogger.a
|
||||
chmod 444 %{buildroot}%{_mandir}/man?/*
|
||||
%if ! %{with util_linux}
|
||||
rm -vf %{buildroot}/bin/mountpoint
|
||||
rm -vf %{buildroot}/usr/bin/utmpdump
|
||||
rm -vf %{buildroot}/sbin/sulogin
|
||||
rm -vf %{buildroot}%{_mandir}/man1/mountpoint.1*
|
||||
rm -vf %{buildroot}%{_mandir}/man1/utmpdump.1*
|
||||
rm -vf %{buildroot}%{_mandir}/man8/sulogin.8*
|
||||
%endif
|
||||
%if !%{with sysvinit}
|
||||
rm -vf %{buildroot}/sbin/sysvinit
|
||||
rm -vfr %{buildroot}/lib/sysvinit
|
||||
rm -vf %{buildroot}/sbin/halt
|
||||
rm -vf %{buildroot}/sbin/init
|
||||
rm -vf %{buildroot}/sbin/poweroff
|
||||
rm -vf %{buildroot}/sbin/reboot
|
||||
rm -vf %{buildroot}/sbin/runlevel
|
||||
rm -vf %{buildroot}/sbin/shutdown
|
||||
rm -vf %{buildroot}/sbin/telinit
|
||||
rm -vf %{buildroot}%{_mandir}/man8/halt.8
|
||||
rm -vf %{buildroot}%{_mandir}/man5/initscript.5
|
||||
rm -vf %{buildroot}%{_mandir}/man5/inittab.5
|
||||
rm -vf %{buildroot}%{_mandir}/man8/init.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/sysvinit.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/poweroff.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/reboot.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/runlevel.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/shutdown.8
|
||||
rm -vf %{buildroot}%{_mandir}/man8/telinit.8
|
||||
rm -vfr %{buildroot}/lib/mkinitrd
|
||||
%endif
|
||||
|
||||
%if %{with sysvinit}
|
||||
%post
|
||||
ret=0
|
||||
if test -x /sbin/telinit -a -p /dev/initctl -a -f /proc/1/exe -a -d /proc/1/root -a ! -d /.build -a -x /sbin/init; then
|
||||
icount=$(grep -cE '^[[:alnum:]]+:[[:alnum:]]*:' /etc/inittab 2>/dev/null || echo 0)
|
||||
if test $(stat -Lc '%%D-%%i' /) = $(stat -Lc '%%D-%%i' /proc/1/root) -a $icount -gt 6 ; then
|
||||
if test $(stat -Lc '%%D-%%i' /sbin/init) = $(stat -Lc '%%D-%%i' /sbin/sysvinit); then
|
||||
/sbin/telinit u
|
||||
fi
|
||||
elif test $icount -le 6 ; then
|
||||
echo 'Broken /etc/inittab found, installing and using %{name} make no sense!' 1>&2
|
||||
ret=1
|
||||
fi
|
||||
fi
|
||||
%if %have_mkinitrd
|
||||
if test -x /sbin/mkinitrd_setup; then
|
||||
mkinitrd_setup
|
||||
fi
|
||||
%endif
|
||||
exit $ret
|
||||
|
||||
%if %have_mkinitrd
|
||||
%postun
|
||||
if test -x /sbin/mkinitrd_setup; then
|
||||
mkinitrd_setup
|
||||
fi
|
||||
%endif
|
||||
|
||||
%files
|
||||
%defattr (-,root,root,755)
|
||||
/sbin/sysvinit
|
||||
%dir /lib/sysvinit
|
||||
/lib/sysvinit/telinit
|
||||
|
||||
%files init
|
||||
%defattr (-,root,root,755)
|
||||
/sbin/halt
|
||||
/sbin/init
|
||||
/sbin/poweroff
|
||||
/sbin/reboot
|
||||
/sbin/runlevel
|
||||
/sbin/shutdown
|
||||
/sbin/telinit
|
||||
%doc %{_mandir}/man8/halt.8.gz
|
||||
%doc %{_mandir}/man5/initscript.5.gz
|
||||
%doc %{_mandir}/man5/inittab.5.gz
|
||||
%doc %{_mandir}/man8/init.8.gz
|
||||
%doc %{_mandir}/man8/sysvinit.8.gz
|
||||
%doc %{_mandir}/man8/poweroff.8.gz
|
||||
%doc %{_mandir}/man8/reboot.8.gz
|
||||
%doc %{_mandir}/man8/runlevel.8.gz
|
||||
%doc %{_mandir}/man8/shutdown.8.gz
|
||||
%doc %{_mandir}/man8/telinit.8.gz
|
||||
%if %have_mkinitrd
|
||||
%dir /lib/mkinitrd
|
||||
%dir /lib/mkinitrd/scripts
|
||||
/lib/mkinitrd/scripts/boot-blogd.sh
|
||||
/lib/mkinitrd/scripts/boot-killblogd.sh
|
||||
/lib/mkinitrd/scripts/boot-killblogd2.sh
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%files tools
|
||||
%defattr (-,root,root,755)
|
||||
%doc COPYING COPYRIGHT doc/Propaganda
|
||||
%doc doc/Changelog doc/killproc doc/showconsole
|
||||
%config /etc/pam.d/init
|
||||
%if %{with util_linux}
|
||||
/sbin/sulogin
|
||||
/bin/mountpoint
|
||||
/usr/bin/utmpdump
|
||||
%endif
|
||||
/bin/pidof
|
||||
/bin/usleep
|
||||
/bin/fsync
|
||||
@ -358,11 +155,6 @@ fi
|
||||
/sbin/mkill
|
||||
/sbin/startproc
|
||||
/sbin/start_daemon
|
||||
%if %{with util_linux}
|
||||
%doc %{_mandir}/man1/mountpoint.1.gz
|
||||
%doc %{_mandir}/man1/utmpdump.1.gz
|
||||
%doc %{_mandir}/man8/sulogin.8.gz
|
||||
%endif
|
||||
%doc %{_mandir}/man1/usleep.1.gz
|
||||
%doc %{_mandir}/man1/fsync.1.gz
|
||||
# /usr/include/libblogger.h
|
||||
@ -384,12 +176,5 @@ fi
|
||||
%doc %{_mandir}/man8/rvmtab.8.gz
|
||||
%doc %{_mandir}/man8/vhangup.8.gz
|
||||
%doc %{_mandir}/man8/mkill.8.gz
|
||||
%if 0
|
||||
%doc contrib/bootlogd.README
|
||||
/sbin/bootlogd
|
||||
/sbin/intr
|
||||
%doc %{_mandir}/man8/bootlogd.8.gz
|
||||
%doc %{_mandir}/man8/intr.8.gz
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
|
Loading…
Reference in New Issue
Block a user