#! /bin/sh # Copyright (c) 2000-2002 SuSE Linux AG, Nuernberg, Germany. # All rights reserved. # # Author: Burchard Steinbild, 1996-97 # Bernhard Kaindl , 1999 # Rüdiger Oertel , 2000-01 # # This module checks and sets file permissions # check if we are started as root # only one of UID and USER must be set correctly if test "$UID" != 0 -a "$USER" != root; then echo "You must be root to start $0." exit 1 fi r=$ROOT test -f $r/lib/YaST/SuSEconfig.functions || { echo "ERROR - can not find $r/lib/YaST/SuSEconfig.functions!!" echo "This should not happen. Exit..." exit 1 } . $r/lib/YaST/SuSEconfig.functions for i in $r/etc/sysconfig/security $r/etc/sysconfig/suseconfig ; do if test ! -f $i ; then echo "No $i found." exit 1 fi . $i done if test -n "$ENABLE_SUSECONFIG" -a "$ENABLE_SUSECONFIG" = "no" ; then echo "SuSEconfig is disabled in $r/etc/sysconfig/suseconfig." echo "Exit..." exit 0 fi test -z "$r" -a ! -e $r/usr/lib/YaST/.DemoMode || exit 0 if test -n "$CHECK_PERMISSIONS" -a \ -x /usr/bin/chkstat ; then PERMISSIONS_FILES="" PACKAGE_PERMFILES=(/etc/permissions.d/*) PACKAGE_PERMFILES=(${PACKAGE_PERMFILES[*]##*/}) PACKAGE_PERMFILES=(${PACKAGE_PERMFILES[*]%%\.*}) PACKS=${PACKAGE_PERMFILES[*]} if test -n "$PACKS" ; then test -x /usr/bin/sort && { PACKS=`for j in $PACKS ; do echo $j ; done | /usr/bin/sort -u` } for i in $PACKS ; do test -e /etc/permissions.d/$i && \ PERMISSIONS_FILES="$PERMISSIONS_FILES /etc/permissions.d/$i" for PERMEXT in $PERMISSION_SECURITY ; do test -e /etc/permissions.d/$i.$PERMEXT && \ PERMISSIONS_FILES="$PERMISSIONS_FILES /etc/permissions.d/$i.$PERMEXT" done done fi test -e /etc/permissions && \ PERMISSIONS_FILES="$PERMISSIONS_FILES /etc/permissions" for PERMEXT in $PERMISSION_SECURITY ; do test -e /etc/permissions.$PERMEXT && \ PERMISSIONS_FILES="$PERMISSIONS_FILES /etc/permissions.$PERMEXT" done if test "$CHECK_PERMISSIONS" = "set" ; then /usr/bin/chkstat -set $PERMISSIONS_FILES elif test "$CHECK_PERMISSIONS" = "warn" ; then /usr/bin/chkstat $PERMISSIONS_FILES fi fi