From 0d5efffd9734a1a6e8c245a8e13676a125b0cca2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 14 Mar 2012 18:17:08 -0400 Subject: [PATCH] cros_workon: don't use sudo to update the workon file We start off cros_workon by doing: touch "${WORKON_FILE}" || die So we've guaranteed that the user owns this file. As such, there's no need to go to sudo to update it, so drop that for a minor speed up. BUG=None TEST=`./cros_workon --board x86-alex start metrics` still works TEST=`./cros_workon --board x86-alex stop metrics` still works Change-Id: I5b78070b85ee53a76b6bdc29e24747b225905368 Reviewed-on: https://gerrit.chromium.org/gerrit/18170 Reviewed-by: Chris Wolfe Reviewed-by: David James Commit-Ready: Mike Frysinger Tested-by: Mike Frysinger --- cros_workon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cros_workon b/cros_workon index 281ebe62bd..18676ce50e 100755 --- a/cros_workon +++ b/cros_workon @@ -293,7 +293,7 @@ ebuild_to_live () { for atom in ${atoms}; do if ! grep -qx "=${atom}-9999" "${WORKON_FILE}" ; then - if sudo bash -c "echo \"=${atom}-9999\" >> \"${WORKON_FILE}\""; then + if echo "=${atom}-9999" >> "${WORKON_FILE}" ; then atoms_success="${atoms_success} ${atom}" if [ "${atom}" = "${CHROME_ATOM}" ]; then chrome_to_live @@ -315,7 +315,7 @@ ebuild_to_stable () { for atom in ${atoms}; do if grep -qx "=${atom}-9999" "${WORKON_FILE}" ; then - if sudo sed -e "/^=${atom/\//\\/}-9999\$/d" -i "${WORKON_FILE}"; then + if sed -i -e "/^=${atom/\//\\/}-9999\$/d" "${WORKON_FILE}" ; then atoms_success="${atoms_success} ${atom}" fi else