#! /bin/sh
#
# Copyright (c) 2001-2002 SuSE Linux AG Nuernberg, Germany.  All rights reserved.
#
# /etc/init.d/boot.restore_permissions
#
### BEGIN INIT INFO
# Provides:          boot.restore_permissions
# Required-Start:    boot.localfs
# Should-Start:      boot.crypto
# Required-Stop:
# Default-Start:     B
# Default-Stop:
# Short-Description: restore permissions after a crash
# Description:       Restores the permissions modified by
#	pam_devperm after a crash.
### END INIT INFO

. /etc/rc.status

DEVICES=`/bin/ls /var/lib/pam_devperm`

rc_reset

case "$1" in
  start|stop)
    echo -n "Restore device permissions"
    if [ ! -z "$DEVICES" ] ; then
      for f in $DEVICES; do
        /sbin/restore_devperm $f
	rc_status
      done
    else
      # everything is ok.
      rc_failed 0
    fi
    rc_status -v
    ;;
  status)
    rc_failed 4
    rc_status -v
    ;;
  *)
    echo "Usage: $0 {start|stop|status}"
    exit 1
    ;;
esac

rc_exit

