common.sh: move user_* helpers out to single user

The only users of these APIs are enter_chroot (and make_chroot),
so move the funcs out of common.sh and to the respective script.

BUG=None
TEST=CQ passes

Change-Id: I4917e1538cb6e80a4e0c455253f12a353d704bd2
Reviewed-on: https://chromium-review.googlesource.com/1791262
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index b797a4e..49faeb1 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -139,6 +139,14 @@
   fi
 }
 
+# Appends stdin to the given file name as the sudo user.
+#
+# $1 - The output file name.
+user_append() {
+  cat >> "$1"
+  chown ${SUDO_UID}:${SUDO_GID} "$1"
+}
+
 delete_existing() {
   # Delete old chroot dir.
   local chroot_img="${FLAGS_chroot}.img"