Revision: 5201
http://ipcop.svn.sourceforge.net/ipcop/?rev=5201&view=rev
Author: gespinasse
Date: 2010-12-04 11:43:27 +0000 (Sat, 04 Dec 2010)
Log Message:
-----------
Fix niceness when started as non-root
Running ./make.sh shell and nice show 0 when 10 default value was intented
Instead to renice make.sh itself, nice the children with sudo nice -n $NICE
chroot
You will need to reconfigure sudoers
make.sh will display the new lines to be include at first run
Modified Paths:
--------------
ipcop/trunk/make.sh
Modified: ipcop/trunk/make.sh
===================================================================
--- ipcop/trunk/make.sh 2010-12-04 07:01:37 UTC (rev 5200)
+++ ipcop/trunk/make.sh 2010-12-04 11:43:27 UTC (rev 5201)
@@ -402,7 +402,7 @@
MOUNT=`bash +h -c "type mount" | cut -d" " -f3` > /dev/null 2>&1
BIND="${MOUNT} --bind"
MV=`bash +h -c "type mv" | cut -d" " -f3`
-RENICE=`bash +h -c "type renice" | cut -d" " -f3`
+NICECMD=`bash +h -c "type nice" | cut -d" " -f3`
RM="`bash +h -c "type rm" | cut -d" " -f3` -fr"
UMOUNT=`bash +h -c "type umount" | cut -d" " -f3`
@@ -861,9 +861,9 @@
#################################################################################
echo -ne "Checking if sudo is configured ${BOLD}"
SUDO_ERROR=0
- SUDO_SYS_CONFIGURED=0
- SUDO_NUMBER=12 # number of registered command, need to be
adjusted in case of change
- if (! ${SUDO} -p " if you see a login prompt, type enter " -l
1>/dev/null); then
+ SUDO_NICE_CONFIGURED=0
+ SUDO_NUMBER=11 # number of registered command, need to be
adjusted in case of change
+ if (! ${SUDO} -p "If you see a login prompt, type enter until
failure " -l 1>/dev/null); then
SUDO_ERROR=1
else
SUDO_COUNT=`${SUDO} -l | wc -l`
@@ -871,10 +871,10 @@
echo -ne "${NORMAL} found only $SUDO_COUNT sudo
command instead of mini ${SUDO_NUMBER}"
SUDO_ERROR=1
fi
- SUDO_SYS_CONFIGURED=`${SUDO} -l | grep -q 'mount --bind
/sys';echo $?`
+ SUDO_NICE_CONFIGURED=`${SUDO} -l | grep -q '\/nice
';echo $?`
fi
echo -ne "${NORMAL}"
- if [ ${SUDO_ERROR} -eq 0 -a ${SUDO_SYS_CONFIGURED} -eq 0 ]; then
+ if [ ${SUDO_ERROR} -eq 0 -a ${SUDO_NICE_CONFIGURED} -eq 0 ];
then
echo -ne "${NORMAL}"
beautify message DONE
else
@@ -889,7 +889,6 @@
echo -ne "\t\t${BIND} /sys ${LFS}/sys, \\ \n"
echo -ne "\t\t${BIND} ${BASEDIR}/* ${LFS}/*\n"
echo -ne "Cmnd_Alias CHMOD = ${CHMOD} [0-9]* ${LFS}/*\n"
- echo -ne "Cmnd_Alias CHROOT = ${CHROOT} ${LFS} *\n"
echo -ne "Cmnd_Alias DU = ${DU} -skx ${BASEDIR}\n"
echo -ne "Cmnd_Alias LN = ${LN} * ${LFS}/*, \\ \n"
echo -ne "\t\t${LN}
${BASEDIR}/build_${MACHINE}/${TOOLS_DIR} /\n"
@@ -900,12 +899,12 @@
echo -ne "\t\t\t\t${LFS}/tmp/*, \\ \n"
echo -ne "\t\t${MV}
${BASEDIR}/build_${MACHINE}/${INSTALLER_DIR}/images/ipcop-* \\ \n"
echo -ne "\t\t\t\t${BASEDIR}/\n"
- echo -ne "Cmnd_Alias RENICE = ${RENICE} * *\n"
+ echo -ne "Cmnd_Alias NICECMD = ${NICECMD} * ${CHROOT}
${LFS} *\n"
echo -ne "Cmnd_Alias RM = ${RM} ${BASEDIR}/*, \\ \n"
echo -ne "\t\t${RM} /${TOOLS_DIR}\n"
echo -ne "Cmnd_Alias UMOUNT = ${UMOUNT} ${LFS}/*, \\ \n"
echo -ne "\t\t${UMOUNT} /dev/loop*\n\n"
- echo -ne "IPCOP_BUILDER ALL = NOPASSWD:
BIND,CHMOD,CHROOT,DU,LN,LOSETUP,MKDIR,MV,RENICE,RM,UMOUNT\n"
+ echo -ne "IPCOP_BUILDER ALL = NOPASSWD:
BIND,CHMOD,DU,LN,LOSETUP,MKDIR,MV,NICECMD,RM,UMOUNT\n"
echo -ne "# *** End of IPCop configuration ***\n"
echo -ne "${NORMAL}"
@@ -953,15 +952,12 @@
# Setting our nice level
if [ x`nice` != x"${NICE}" ]; then
- echo -ne "Setting our nice level to ${SET_OPT_COL}:
${INFO}${NICE}${NORMAL}"
- echo "Setting our nice level to ${NICE}" >> ${PREPLOGFILE}
- ${SUDO} ${RENICE} ${NICE} $$ >> ${PREPLOGFILE} 2>&1
-
- if [ x`nice` != x"${NICE}" ]; then
- exiterror "Failed to set correct nice level"
- else
- beautify message DONE
- fi
+ echo -e "Using nice level ${SET_OPT_COL}:
${INFO}${NICE}${NORMAL}"
+ echo "Using nice level ${NICE}" >> ${PREPLOGFILE}
+ NICEPARAM="-n ${NICE}"
+ else
+ NICECMD=
+ NICEPARAM=
fi
# Set SCHED_BATCH
@@ -1335,7 +1331,7 @@
echo -ne "Entering ${BOLD}${MACHINE_REAL}${NORMAL} LFS chroot, type
exit to return to host environment\n"
- ${SUDO} ${CHROOT} ${LFS} /${TOOLS_DIR}/bin/env -i \
+ ${SUDO} ${NICECMD} ${NICEPARAM} ${CHROOT} ${LFS} /${TOOLS_DIR}/bin/env
-i \
HOME=/root \
TERM=${TERM} \
PS1="\[${BOLD}\][chroot-${MACHINE_REAL}]\[${NORMAL}\] \u:\w\$ "
\
@@ -1362,6 +1358,7 @@
STAGE=${STAGE} \
STAGE_ORDER=${STAGE_ORDER} \
LOGFILE=`echo ${PREPLOGFILE} | sed "s,${BASEDIR},/usr/src,g"` \
+ NICE=${NICE} \
${WRAPPER_32BIT} bash
if [ ${?} -ne 0 ]; then
@@ -1517,7 +1514,7 @@
NORMAL=${NORMAL} \
${BASEDIR}/tools/progress.sh ${BUILD_MARKER} &
- ${SUDO} ${CHROOT} ${LFS} /${TOOLS_DIR}/bin/env -i \
+ ${SUDO} ${NICECMD} ${NICEPARAM} ${CHROOT} ${LFS} /${TOOLS_DIR}/bin/env
-i \
HOME=/root \
TERM=${TERM} \
PS1='\u:\w\$ ' \
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn