From 32cf66b3f860f93c2a0552bab8fba696acb1c303 Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 12 Jul 2018 22:18:31 -0700 Subject: [PATCH] add the capability to use 'nice' to avoid locking everything up during long compiles --- README.md | 3 +++ bin/manage-tools | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6b558c9..561c980 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,9 @@ manage-tools -s install gdb # install pwntools, but don't let it sudo install dependencies manage-tools install pwntools +# install qemu, but use "nice" to avoid degrading performance during compilation +manage-tools -n install qemu + # uninstall gdb manage-tools uninstall gdb diff --git a/bin/manage-tools b/bin/manage-tools index 4cd1ea0..5c58135 100755 --- a/bin/manage-tools +++ b/bin/manage-tools @@ -12,6 +12,7 @@ Usage: $(basename $0) [-sv] (list|setup|install|uninstall|bin|search) tool Where: -s allow running things with sudo (i.e., to install debs) + -n "nice" the installer to reduce background load -v verbose mode. print log while installing -f force certain actions (such as installing over an installed tool) tool the name of the tool. if "all", does the action on all (installed) tools @@ -247,6 +248,9 @@ do -s) export ALLOW_SUDO=1 ;; + -n) + export NICE_LEVEL=10 + ;; -f) export FORCE=1 ;; @@ -264,6 +268,7 @@ done [[ -z ${ALLOW_SUDO+x} ]] && export ALLOW_SUDO=0 [[ -z ${FORCE+x} ]] && export FORCE=0 [[ -z ${VERBOSE_OUTPUT+x} ]] && export VERBOSE_OUTPUT=0 +[[ -z ${NICE_LEVEL+x} ]] && export NICE_LEVEL=0 export EXPECTFAIL=${EXPECTFAIL:-0} if [[ $# -ge 1 ]]; then @@ -398,9 +403,9 @@ case $ACTION in # execute install script set +e if [ "$VERBOSE_OUTPUT" -eq 1 ]; then - DISTRI=$DISTRI PATH=$CTF_TOOLS_ROOT/bin/:$PATH ./install 2>&1 | tee -a install.log + DISTRI=$DISTRI PATH=$CTF_TOOLS_ROOT/bin/:$PATH nice -n$NICE_LEVEL ./install 2>&1 | tee -a install.log else - DISTRI=$DISTRI PATH=$CTF_TOOLS_ROOT/bin/:$PATH ./install >>install.log 2>&1 + DISTRI=$DISTRI PATH=$CTF_TOOLS_ROOT/bin/:$PATH nice -n$NICE_LEVEL ./install >>install.log 2>&1 fi INSTALL_FAILED=$? set -e