#!/bin/sh
#
# Modify keytable to use Windows key for Homeros emacs menu
#
# chkconfig: 2345 90 10
# description: This package modifies keytable to use Windows key for Homeros emacs menu

WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/init.d/functions

LOCKFILE=/var/lock/subsys/homeros-emacs-menu

case "$1" in
    condrestart|condreload)
      # Nothing to do on condrestart because otherwise we could 
      # damage a custom keytable loaded by the admin.
      :
      ;;
	start|restart|reload)
		/bin/loadkeys /usr/share/homeros-emacs-menu/keymap
		touch "$LOCKFILE"
		;;
	stop|condstop)
        # Nothing to do when stoping.
		rm -f "$LOCKFILE"
		;;
	status)
		if [ -f "$LOCKFILE" ]; then
			echo "This service was last time (re-)started at $(LANG=C LANGUAGE=C /bin/ls -l "$LOCKFILE" --full-time |tr -s ' ' |cut --fields 6-10 -d' ')."
			echo "No other status information available for this package."
		else
			echo "This service hasn't been started since stopped last time."
			echo "This does mean nothing at all (stopping the service doesn't unload the keytable)."
		fi
		exit 0
		;;
	*)
		msg_usage "${0##*/} {start|stop|restart|reload|status|condrestart|condreload|condstop}"
		exit 1
esac

exit 0
