Accepting request 563489 from home:markkp:branches:Base:System
- Converted the following SysV init scripts to systemd unit files and scripts (bsc#1050786): * appldata * hsnc * vmlogrdr * xpram OBS-URL: https://build.opensuse.org/request/show/563489 OBS-URL: https://build.opensuse.org/package/show/Base:System/s390-tools?expand=0&rev=43
This commit is contained in:
committed by
Git OBS Bridge
parent
b12140c3aa
commit
f675d71be2
123
xpram
123
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 <num> set local and overall rc status to <num><num>
|
||||
# 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
|
||||
|
Reference in New Issue
Block a user