File ia32el.init of Package ia32el
#! /bin/sh
#
# Author: Dror Shenkar (dror.shenkar@intel.com)
# Andreas Schwab
# Please send feedback to http://www.suse.de/feedback/
#
### BEGIN INIT INFO
# Provides: ia32el
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: B
# Default-Stop:
# Short-Description: IA32 Execution Layer
# Description: Enable the IA32 Execution Layer
# to emulate IA32 instructions in user space
# instead of hardware
### END INIT INFO
# 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 be verbose in local rc status and clear it afterwards
# rc_status -v -r ditto and clear both the local and overall rc status
# rc_status -s display "skipped" and exit with status 3
# rc_status -u display "unused" and exit with status 3
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num>
# rc_reset clear both the local and overall rc status
# rc_exit exit appropriate to overall rc status
# rc_active checks whether a service is activated by symlinks
# rc_splash arg sets the boot splash screen to arg (if active)
. /etc/rc.status
# Reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - user had insufficient privileges
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signaling is not supported) are
# considered a success.
case $1 in
start)
echo -n "Starting ia32el "
if [ ! -e /proc/sys/fs/binfmt_misc/register ]; then
/sbin/modprobe binfmt_misc
test -e /proc/sys/fs/binfmt_misc/register ||
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc || rc_failed
fi
echo ':ia32el:M::\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00::/usr/lib/ia32el/ia32x_loader:PC' > /proc/sys/fs/binfmt_misc/register
test -e /proc/sys/fs/binfmt_misc/ia32el || rc_failed
echo ':ia32el_so:M::\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00::/usr/lib/ia32el/ia32x_loader:PC' > /proc/sys/fs/binfmt_misc/register
test -e /proc/sys/fs/binfmt_misc/ia32el_so || rc_failed
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down ia32el "
for t in ia32el ia32el_so; do
entry=/proc/sys/fs/binfmt_misc/$t
if [ -e $entry ]; then
echo -1 > $entry
test ! -e $entry || rc_failed
fi
done
# Remember status and be verbose
rc_status -v
;;
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
;;
status)
echo -n "Checking for service ia32el "
x=$(/usr/lib/ia32el/cpuid 2>/dev/null)
if [ $? -ne 0 ]; then
rc_failed 4
elif [ $x -eq 0 ]; then
rc_failed 3
fi
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
rc_exit