diff --git a/appldata b/appldata index db9347b..6dbc4d0 100644 --- a/appldata +++ b/appldata @@ -2,51 +2,11 @@ # Copyright (c) 2003 SUSE LINUX AG Nuernberg, Germany. # # Submit feedback to http://www.suse.de/feedback/ -# -# /etc/init.d/appldata -# -# and symbolic its link -# -# /use/sbin/rcappldata -# -# System startup script for "Linux - z/VM Monitor Stream". -# -### BEGIN INIT INFO -# Provides: appldata -# Required-Start: $network $remote_fs -# Required-Stop: $null -# Default-Start: 3 5 -# Default-Stop: 0 1 6 -# Short-Description: Linux - z/VM Monitor Stream -# Description: Start the Linux - z/VM Monitor Stream -### END INIT INFO -# # Local settings LOCKFILE=/var/lock/appldata CONFIGFILE=/etc/sysconfig/appldata -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - -# APPLDATA support in kernel? -if [ ! -e /proc/sys/appldata/interval ]; then - echo "No kernel support for \"Linux - z/VM Monitor Stream\"!" - exit 1 -fi - - # Source config file if [ -f $CONFIGFILE ]; then . $CONFIGFILE @@ -59,11 +19,6 @@ RETVAL=0 start() { echo "Starting \"Linux - z/VM Monitor Stream\" ..." - if [ -e $LOCKFILE ]; then - echo -n "(already running)" - rc_status -v - rc_exit - fi echo -n "(interval $APPLDATA_INTERVAL milliseconds) " echo $APPLDATA_INTERVAL > /proc/sys/appldata/interval if [ "$APPLDATA_MEM" = "yes" ]; then @@ -71,7 +26,7 @@ start() { echo -n "(mem) " modprobe appldata_mem 2>&1 if [ "$?" -ne 0 ] ; then - rc_failed 1 + exit 1 else echo 1 > /proc/sys/appldata/mem fi @@ -82,7 +37,7 @@ start() { echo -n "(os) " modprobe appldata_os 2>&1 if [ "$?" -ne 0 ]; then - rc_failed 1 + exit 1 else echo 1 > /proc/sys/appldata/os fi @@ -93,7 +48,7 @@ start() { echo -n "(net_sum) " modprobe appldata_net_sum 2>&1 if [ "$?" -ne 0 ]; then - rc_failed 1 + exit 1 else echo 1 > /proc/sys/appldata/net_sum fi @@ -102,7 +57,6 @@ start() { echo -n "(timer)" echo 1 > /proc/sys/appldata/timer touch $LOCKFILE - rc_status -v } stop() { @@ -126,12 +80,6 @@ stop() { fi echo -n ")" rm -f $LOCKFILE - rc_status -v -} - -restart() { - stop - start } status() { @@ -171,13 +119,8 @@ case "$1" in status) status ;; - restart|reload) - restart - ;; *) - echo "Usage: appldata {start|stop|status|restart|reload}" RETVAL=1 esac exit $RETVAL - diff --git a/appldata.service b/appldata.service new file mode 100644 index 0000000..7a61169 --- /dev/null +++ b/appldata.service @@ -0,0 +1,17 @@ +[Unit] +Description=Linux - z/VM Monitor Stream +After=network-online.target remote-fs.target +Wants=network-online.target remote-fs.target +ConditionPathExists=/proc/sys/appldata/interval +ConditionPathExists=!/var/lock/appldata + +[Service] +Type=oneshot +RemainAfterExit=yes + +ExecStart=/usr/lib/systemd/scripts/appldata start +ExecStartPost=/usr/lib/systemd/scripts/appldata status +ExecStop=/usr/lib/systemd/scripts/appldata stop + +[Install] +WantedBy=default.target diff --git a/hsnc b/hsnc index 2de81ec..2981b5e 100644 --- a/hsnc +++ b/hsnc @@ -12,24 +12,8 @@ # /usr/sbin/start_hsnc.sh # /use/sbin/rchsnc # -# # System startup script for the HiperSockets Network Concentrator # -### BEGIN INIT INFO -# Provides: hsnc -# Required-Start: $network $remote_fs -# Required-Stop: $null -# Default-Start: 3 5 -# Default-Stop: 0 1 6 -# Short-Description: HiperSockets Network Concentrator -# Description: Start the qeth HiperSockets Network Concentrator -### END INIT INFO -# -# -# -# -# -# # /etc/hsnc.conf should contain the following lines: # # operating_mode=[unicast|full|no] @@ -57,20 +41,6 @@ test -x $START_HSNC_BIN || exit 5 test -x $IP_WATCHER_BIN || exit 5 test -x $XCEC_BRIDGE_BIN || exit 5 -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -99,7 +69,7 @@ read_config_file() { else echo -ne "\nCannot read $file: empty or nonexistant! " # Means not configured: - return 3 + exit 3 fi } @@ -159,24 +129,17 @@ do_start_hsnc() { service="HiperSockets Network concentrator" case "$1" in start) - if [ -e /sys/devices/qeth ]; then - echo -n "Starting $service " - else - echo -n "- cannot start $service, no /sys/devices/qeth " - rc_failed 1 - fi - if checkproc $START_HSNC_BIN; then # Starting an already running service is success: echo -n "(already running)" else if read_config_file; then do_start_hsnc + RETVAL=$? + exit $RETVAL fi fi - # Remember status and be verbose - rc_status -v ;; stop) echo -n "Shutting down $service " @@ -184,7 +147,6 @@ case "$1" in # kill ip_watcher, start_hsnc, which started it needs cleans up # then: killproc -TERM $IP_WATCHER_BIN - rc_failed $? if [ -f $HSNC_CLEANUP_FILE ]; then read_config_file cleanup # remove all connector settings(not yet implemented): @@ -197,43 +159,6 @@ case "$1" in echo -n "- no cleanup file found " fi - # Remember status and be verbose - rc_status -v - ;; - try-restart) - ## Stop the service and if this succeeds (i.e. the - ## service was running before), start it again. - ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) - $0 status >/dev/null && $0 restart - - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - ## start_hsnc.sh does not listen to signals - - echo -n "Force-reload $service " - - $0 stop && $0 start - rc_status - ;; - reload) - ## start_hsnc.sh does not listen to signals - - echo -n "Reload $service: not supported" - - ## it does not support reload: - rc_failed 3 - rc_status -v ;; status) echo -n "Checking $service " @@ -248,11 +173,9 @@ case "$1" in # NOTE: checkproc returns LSB compliant status values. checkproc $START_HSNC_BIN - rc_status -v ;; *) - echo "Usage: $0 {start|stop|status|try-restart|restart}" exit 1 ;; esac -rc_exit + diff --git a/hsnc.service b/hsnc.service new file mode 100644 index 0000000..42daceb --- /dev/null +++ b/hsnc.service @@ -0,0 +1,16 @@ +[Unit] +Description=Start the qeth HiperSockets Network Concentrator +After=network-online.target remote-fs.target +Wants=network-online.target remote-fs.target +ConditionPathExists=/sys/devices/qeth + +[Service] +Type=oneshot +RemainAfterExit=yes + +ExecStart=/usr/lib/systemd/scripts/hsnc start +ExecStartPost=/usr/lib/systemd/scripts/hsnc status +ExecStop=/usr/lib/systemd/scripts/hsnc stop + +[Install] +WantedBy=default.target diff --git a/s390-tools.changes b/s390-tools.changes index eeb763b..57cdb7f 100644 --- a/s390-tools.changes +++ b/s390-tools.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Tue Dec 12 01:01:09 UTC 2017 - mpost@suse.com + +- Converted the following SysV init scripts to systemd unit files + and scripts (bsc#1050786): + * appldata + * hsnc + * vmlogrdr + * xpram + ------------------------------------------------------------------- Thu Dec 7 23:08:31 UTC 2017 - mpost@suse.com diff --git a/s390-tools.spec b/s390-tools.spec index 3888f57..0422ada 100644 --- a/s390-tools.spec +++ b/s390-tools.spec @@ -60,7 +60,6 @@ Source5: xpram Source6: sysconfig.xpram Source7: appldata Source8: sysconfig.appldata -Source9: vmlogrdr Source10: dasdro Source11: dasd_reload Source12: mkdump.pl @@ -86,6 +85,10 @@ Source33: lgr_check Source34: sysconfig.virtsetup Source35: virtsetup.service Source36: virtsetup.sh +Source37: appldata.service +Source38: hsnc.service +Source39: vmlogrdr.service +Source40: xpram.service ### Obsolete scripts and man pages to be removed once changes in other tools are made ### That's been delayed to at least SLES12 SP1, but I'm leaving the comments here. @@ -268,19 +271,22 @@ install -D -m755 %{S:27} %{buildroot}/usr/lib/systemd/scripts/setup_cio_ignore.s install -D -m755 %{S:31} %{buildroot}/usr/lib/systemd/scripts/detach_disks.sh install -D -m644 %{S:35} %{buildroot}/%{_unitdir}/virtsetup.service install -D -m755 %{S:36} %{buildroot}/usr/lib/systemd/scripts/virtsetup.sh +install -D -m644 %{S:37} %{buildroot}/%{_unitdir}/appldata.service +install -D -m644 %{S:38} %{buildroot}/%{_unitdir}/hsnc.service +install -D -m644 %{S:39} %{buildroot}/%{_unitdir}/vmlogrdr.service +install -D -m644 %{S:40} %{buildroot}/%{_unitdir}/xpram.service cp %{S:18} zpxe.rexx cp %{S:2} zipl.conf.sample cp %{S:23} README.SUSE cd %{buildroot} -install -D -m755 %{S:3} etc/init.d/hsnc +install -D -m755 %{S:3} %{buildroot}/usr/lib/systemd/scripts/hsnc install -D -m644 %{S:4} %{buildroot}%{_fillupdir}/sysconfig.hsnc -install -D -m755 %{S:5} etc/init.d/xpram +install -D -m755 %{S:5} %{buildroot}/usr/lib/systemd/scripts/xpram install -D -m644 %{S:6} %{buildroot}%{_fillupdir}/sysconfig.xpram -install -D -m755 %{S:7} etc/init.d/appldata +install -D -m755 %{S:7} %{buildroot}/usr/lib/systemd/scripts/appldata install -D -m644 %{S:8} %{buildroot}%{_fillupdir}/sysconfig.appldata -install -D -m755 %{S:9} etc/init.d/vmlogrdr install -D -m755 %{S:10} sbin/dasdro install -D -m755 %{S:11} sbin/dasd_reload install -D -m755 %{S:12} sbin/mkdump @@ -301,10 +307,10 @@ if [ ! -d %{_sbindir} ]; then rm -f %{_sbindir} mkdir -p %{_sbindir} fi -(cd usr/sbin; ln -s ../../etc/init.d/appldata rcappldata) -(cd usr/sbin; ln -s ../../etc/init.d/hsnc rchsnc) -(cd usr/sbin; ln -s ../../etc/init.d/vmlogrdr rcvmlogrdr) -(cd usr/sbin; ln -s ../../etc/init.d/xpram rcxpram) +(cd usr/sbin; ln -s service rcappldata) +(cd usr/sbin; ln -s service rchsnc) +(cd usr/sbin; ln -s service rcvmlogrdr) +(cd usr/sbin; ln -s service rcxpram) (cd usr/sbin; ln -s service rccio_ignore) (cd usr/sbin; ln -s service rccpacfstatsd) (cd usr/sbin; ln -s service rccpi) diff --git a/vmlogrdr b/vmlogrdr deleted file mode 100644 index 063bcc6..0000000 --- a/vmlogrdr +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -# Copyright (c) 2003 SUSE LINUX AG Nuernberg, Germany. -# -# Submit feedback to http://www.suse.de/feedback/ -# -# /etc/init.d/vmlogrdr -# -# and symbolic its link -# -# /use/sbin/rcvmlogrdr -# -# -### BEGIN INIT INFO -# Provides: vmlogrdr -# Required-Start: $network $remote_fs -# Required-Stop: $null -# Default-Start: 3 5 -# Default-Stop: 0 1 6 -# Short-Description: Linux - z/VM Log reader -# Description: System startup script for the Linux - z/VM Log reader -### END INIT INFO -# - -# Local settings -SERVICE=LOGREC -DEVNODE=/dev/vmlogrdr_${SERVICE} - -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -rc_reset - - -RETVAL=0 - -start() { - echo -n "Starting z/VM log reader for service $SERVICE... " - if [ -e $DEVNODE ]; then - echo -n "(already running)" - rc_status -v - rc_exit - fi - modprobe vmlogrdr 2>&1 - if [ "$?" -ne 0 ] ; then - rc_failed 1 - fi - rc_status -v -} - -stop() { - echo "Stopping z/VM log reader for service $SERVICE... " - rmmod vmlogrdr - rc_status -v -} - -restart() { - stop - start -} - -status() { - echo -n "Checking z/VM log reader for service $SERVICE... " - if [ ! -e $DEVNODE ]; then - rc_failed 1 - fi - rc_status -v -} - -# How are we called? -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status - ;; - restart|reload) - restart - ;; - *) - echo "Usage: vmlogrdr {start|stop|status|restart|reload}" - RETVAL=1 -esac - -exit $RETVAL - diff --git a/vmlogrdr.service b/vmlogrdr.service new file mode 100644 index 0000000..6382b36 --- /dev/null +++ b/vmlogrdr.service @@ -0,0 +1,15 @@ +[Unit] +Description=System startup script for the Linux - z/VM Log reader +After=network-online.target remote-fs.target +Wants=network-online.target remote-fs.target +ConditionPathExists=!/dev/vmlogrdr_LOGREC + +[Service] +Type=oneshot +RemainAfterExit=yes + +ExecStart=/sbin/modprobe vmlogrdr +ExecStop=/sbin/modprobe -r vmlogrdr + +[Install] +WantedBy=default.target diff --git a/xpram b/xpram index 993bb61..7124e29 100644 --- a/xpram +++ b/xpram @@ -3,24 +3,7 @@ # # Submit feedback to http://www.suse.de/feedback/ # -# /etc/init.d/xpram -# -# and symbolic its link -# -# /use/sbin/rcxpram -# # System startup script for XPRAM device driver -# -### BEGIN INIT INFO -# Provides: xpram -# Required-Start: $remote_fs -# Required-Stop: $null -# Default-Start: 3 5 -# Default-Stop: 0 1 6 -# Short-Description: XPRAM device driver -# Description: Creates an xpram device and mounts it -### END INIT INFO -# XPRAM_CONFIG_FILE=/etc/sysconfig/xpram @@ -36,8 +19,6 @@ read_config_file() { else echo -ne "Cannot read $file: empty or nonexistant! " # Means not configured: - rc_failed 6 - rc_status -v return 6 fi } @@ -45,9 +26,7 @@ read_config_file() { prepare_xpram() { if [ -z "$XPRAM_MNTPATH" -o -z "$XPRAM_DEVNODE" ]; then echo -n "Cannot mkfs/mount XPRAM: Missing parameters! " - rc_failed 6 - rc_status -v - rc_exit + exit 6 fi grep -q $XPRAM_DEVNODE /proc/mounts 2>&1 > /dev/null if [ $? -eq 0 ] ; then @@ -71,9 +50,7 @@ prepare_xpram() { then echo echo -n "Warning: current filessystem and configured filesystem are not the same!" - rc_failed 6 - rc_status -v - rc_exit + exit 6 fi if [ "$XPRAM_FSTYPE" = swap ] then @@ -92,28 +69,11 @@ prepare_xpram() { if [ $? -ne 0 ] then echo -n "Mount failed with error code $?" - rc_failed 6 - rc_status -v - rc_exit + exit 6 fi fi } -# Shell functions sourced from /etc/rc.status: -# rc_check check and set local and overall rc status -# rc_status check and set local and overall rc status -# rc_status -v ditto but be verbose in local rc status -# rc_status -v -r ditto and clear the local rc status -# rc_failed set local and overall rc status to failed -# rc_failed set local and overall rc status to -# rc_reset clear local rc status (overall remains) -# rc_exit exit appropriate to overall rc status -. /etc/rc.status - -# First reset status of this service -config_read=0 -rc_reset - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -132,9 +92,7 @@ rc_reset check_config () { if [ -z "$XPRAM_MODULE" ]; then echo -n "$file: parameters XPRAM_MODULE missing! " - rc_failed 6 - rc_status -v - rc_exit + exit 6 fi } @@ -142,20 +100,8 @@ quit_disabled() { if [ "$XPRAM_START" != "yes" ]; then # Config file exists but xpram not enabled, do not complain, # but note with exit status 6 that we are not configured. - rc_exit - fi -} - -check_enabled() { - if [ "$XPRAM_START" != "yes" ]; then - rc_failed 6 - if [ "$XPRAM_MODULE" ]; then - if grep -q "$XPRAM_MODULE" /proc/modules; then - echo -n "Service $service $_rc_todo " - rc_status -v - fi - fi - rc_exit + echo "xpram not enabled" + exit 0 fi } @@ -163,9 +109,8 @@ service="xpram" case "$1" in start) # Read in configuration - read_config_file || rc_exit + read_config_file || exit 6 - check_enabled quit_disabled check_config @@ -173,17 +118,15 @@ case "$1" in modprobe "$XPRAM_MODULE" if [ $? -ne 0 ]; then echo -n "- failed to load $XPRAM_MODULE " - rc_failed 1 + exit 1 else prepare_xpram fi - # Remember status and be verbose - rc_status -v ;; stop) # Read in configuration - read_config_file || rc_exit + read_config_file || exit 6 # check_enabled # quit_disabled @@ -203,44 +146,10 @@ case "$1" in if grep -q "$XPRAM_MODULE" /proc/modules; then rmmod "$XPRAM_MODULE" - rc_status else - rc_failed 7 + exit 7 fi - # Remember status and be verbose - rc_status -v - ;; - try-restart) - ## Stop the service and if this succeeds (i.e. the - ## service was running before), start it again. - ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) - $0 status >/dev/null && $0 restart - - # Remember status and be quiet - rc_status - ;; - restart) - ## Stop the service and regardless of whether it was - ## running or not, start it again. - $0 stop - $0 start - - # Remember status and be quiet - rc_status - ;; - force-reload) - echo -n "Force-reload $service " - - $0 stop && $0 start - rc_status - ;; - reload) - echo -n "Reloading $service not supported." - - ## it does not support reload: - rc_failed 3 - rc_status -v ;; status) echo -n "Checking $service " @@ -251,7 +160,7 @@ case "$1" in # 3 - service not running # Read in configuration - read_config_file || rc_exit + read_config_file || exit 3 check_config @@ -261,18 +170,12 @@ case "$1" in if ! grep -q $XPRAM_DEVNODE /proc/mounts && ! swapon -s | grep -q $XPRAM_DEVNODE; then xpram_result=3 echo -n "loaded, but $XPRAM_DEVNODE not used" - rc_failed 3 + exit 3 fi fi else - rc_failed 3 + exit 3 fi - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status|try-restart|restart}" - exit 1 ;; esac -rc_exit diff --git a/xpram.service b/xpram.service new file mode 100644 index 0000000..7702d4f --- /dev/null +++ b/xpram.service @@ -0,0 +1,18 @@ +[Unit] +Description=Linux - z/VM Monitor Stream +After=network-online.target remote-fs.target +Wants=network-online.target remote-fs.target +ConditionPathExists=/proc/sys/appldata/interval +ConditionPathExists=!/var/lock/appldata + +[Service] +Type=oneshot +RemainAfterExit=yes +SuccessExitStatus=3 + +ExecStart=/usr/lib/systemd/scripts/xpram start +ExecStartPost=/usr/lib/systemd/scripts/xpram status +ExecStop=/usr/lib/systemd/scripts/xpram stop + +[Install] +WantedBy=default.target