Corrections to spec file and scripts and update to the micasad.
This commit is contained in:
@@ -6,40 +6,17 @@ do
|
||||
sed -i '/pam_micasa/d' $file
|
||||
var=`grep pam_unix2.so $file`
|
||||
entry=`echo -e "auth\t required\tpam_micasa.so"`
|
||||
entry2=`echo -e "session\t required\tpam_micasa.so"`
|
||||
cnt=0
|
||||
if [ "$var" != "" ]
|
||||
then
|
||||
sed -i "/^auth.*required.*pam_unix2.so/a$entry" $file
|
||||
sed -i "/^session.*required.*pam_unix2.so/a$entry2" $file
|
||||
|
||||
else
|
||||
let ' cnt = cnt + 1'
|
||||
continue
|
||||
fi
|
||||
var2=`grep common-auth $file`
|
||||
if [ "$var2" != "" ]
|
||||
then
|
||||
sed -i "/^auth.*include.*common-auth/a$entry" $file
|
||||
sed -i "/^session.*include.*common-session/a$entry2" $file
|
||||
else
|
||||
let ' cnt = cnt + 1'
|
||||
fi
|
||||
if [ $cnt -eq 2 ]
|
||||
then
|
||||
awk '
|
||||
/auth/ { authSeen++; }
|
||||
/account/ {
|
||||
if (!acctSeen && authSeen)
|
||||
{
|
||||
print "auth\trequired\tpam_micasa.so\n";}
|
||||
acctSeen++;
|
||||
}
|
||||
/session/ { sesSeen++; }
|
||||
// {print $0; }
|
||||
END { if (sesSeen)
|
||||
print "session\trequired\tpam_micasa.so\n"; }
|
||||
' $file > $file.sav
|
||||
mv $file.sav $file
|
||||
continue
|
||||
fi
|
||||
sed -i "0,/^auth/s/^\(auth.*\)/\1\n$entry/" $file
|
||||
fi
|
||||
done
|
||||
@@ -31,7 +31,7 @@ rc_reset
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting miCASA daemon"
|
||||
startproc -f $MICASAD_BIN
|
||||
/sbin/startproc -f $MICASAD_BIN
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
@@ -39,57 +39,58 @@ case "$1" in
|
||||
stop)
|
||||
echo "Shutting miCASA daemon down"
|
||||
#killproc -TERM $MICASAD_BIN
|
||||
pid=`cat /var/run/micasad.pid` > /dev/null 2>&1
|
||||
kill -s TERM $pid > /dev/null 2>&1
|
||||
pid=`cat /var/run/micasad.pid` >/dev/null 2>&1
|
||||
kill -s TERM $pid >/dev/null 2>&1
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
|
||||
try-restart|condrestart)
|
||||
# $0 status >/dev/null && $0 restart
|
||||
$0 restart
|
||||
try-restart|condrestart)
|
||||
$0 status >/dev/null && $0 restart
|
||||
rc_status
|
||||
;;
|
||||
|
||||
restart)
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
echo "Restarting miCASA daemon"
|
||||
$0 stop
|
||||
$0 start
|
||||
$0 stop
|
||||
$0 start
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
|
||||
status)
|
||||
status)
|
||||
echo "Checking for service micasad ..."
|
||||
checkproc micasad
|
||||
if [ $? == 0 ]
|
||||
/sbin/checkproc micasad
|
||||
$res=$?
|
||||
if [ $res == 0 ]
|
||||
then
|
||||
echo -n "0 - service up and running"
|
||||
elif [ $? == 1 ]
|
||||
elif [ $res == 1 ]
|
||||
then
|
||||
echo -n "1 - service dead, but /var/run/pid file exists"
|
||||
elif [ $? == 2 ]
|
||||
elif [ $res == 2 ]
|
||||
then
|
||||
echo -n "2 - service dead, but /var/lock/lock file exists"
|
||||
elif [ $? == 3 ]
|
||||
elif [ $res == 3 ]
|
||||
then
|
||||
echo -n "3 - service not running (unused)"
|
||||
elif [ $? == 4 ]
|
||||
elif [ $res == 4 ]
|
||||
then
|
||||
echo -n "4 - service status unknown"
|
||||
else
|
||||
echo -n "5--199 reserved (5--99 LSB, 100--149 distro, 150--199 appl.)"
|
||||
fi
|
||||
|
||||
rc_status -v
|
||||
rc_status >/dev/null 2>&1
|
||||
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|try-restart|status}"
|
||||
echo "Usage: $0 {start|stop|restart|try-restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user