File: //opt/BCLinux/bse/secure_set/s50_initUserPath
#!/bin/sh
#=====================================================================
InsertSection "Set the ALWAYS_SET_PATH..."
if [ $SET_ALWAYS_SET_PATH -eq 1 ]; then
cp -np /etc/login.defs /etc/login.defs_bak
#-----------------set the ALWAYS_SET_PATH----------------
IS_EXIST=`egrep -v '^#|^$' /etc/login.defs | grep 'ALWAYS_SET_PATH' | wc -l`
if [ $IS_EXIST -eq 0 ] ; then
echo -e "ALWAYS_SET_PATH=yes" >> /etc/login.defs
else
sed -i 's/^ALWAYS_SET_PATH.*/ALWAYS_SET_PATH=yes/' /etc/login.defs
fi
IS_EXIST=`egrep -v '^#|^$' /etc/login.defs | grep '^ALWAYS_SET_PATH' |wc -l`
if [ $IS_EXIST -eq 0 ] ; then
logtext "NO ALWAYS_SET_PATH set, setting failed"
Display --indent 2 --text "- NO ALWAYS_SET_PATH set... " --result FAILED --color RED
else
if [ $(egrep -v '^#|^$' /etc/login.defs | grep '^ALWAYS_SET_PATH' | grep yes |wc -l) -eq 0 ];then
logtext "Wrong ALWAYS_SET_PATH, seting failed"
Display --indent 2 --text "- Wrong ALWAYS_SET_PATH... " --result FAILED --color RED
else
logtext "Has ALWAYS_SET_PATH set, seting ok"
Display --indent 2 --text "- Set ALWAYS_SET_PATH... " --result FINISHED --color GREEN
fi
fi
else
Display --indent 2 --text "- Skip set ALWAYS_SET_PATH due to config file... " --result SKIPPING --color YELLOW
fi