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 <cwolfe@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-03-14 18:17:08 -04:00 committed by David James
parent e266b3b850
commit 0d5efffd97

View File

@ -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