Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3473)

Unified Diff: bin/cros_package_to_live

Issue 3739001: Temporarily clear noexec flag on /var if set (Closed) Base URL: ssh://gitrw.chromium.org/crosutils.git
Patch Set: Small nits and debug message Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/cros_package_to_live
diff --git a/bin/cros_package_to_live b/bin/cros_package_to_live
index 6b8ec623693b52157816793c79c90a6e34ec7659..699bf237c4e1b8a9136cb8618e02a1b46331d86d 100755
--- a/bin/cros_package_to_live
+++ b/bin/cros_package_to_live
@@ -33,9 +33,12 @@ FLAGS "$@" || exit 1
TMP=$(mktemp -d /tmp/cros_package_to_live.XXXX)
function cleanup {
- if [ "${mount_type}" = ro ]; then
+ if [ "${root_mount_type}" = ro ]; then
remote_sh "mount -o remount,ro /" || /bin/true
fi
+ if [ "${var_mount_noexec}" = yes ]; then
+ remote_sh "mount -o remount,noexec /var" || /bin/true
+ fi
cleanup_remote_access
rm -rf "${TMP}"
}
@@ -65,13 +68,21 @@ fi
PKGROOT="${FLAGS_build_root}/${FLAGS_board}/packages"
+# Temporarily clear read-only flag on / if it is set
remote_sh "grep '\S* / ' /proc/mounts | tail -1 | awk '{ print \$4 }' |
cut -d, -f1"
-mount_type=$REMOTE_OUT
-if [ "${mount_type}" = ro ]; then
+root_mount_type=${REMOTE_OUT}
+if [ "${root_mount_type}" = ro ]; then
remote_sh "mount -o remount,rw /"
fi
+# Temporarily clear noexec flag on /var if it is set
+remote_sh "grep '\S* /var ' /proc/mounts | tail -1 | awk '{ print \$4 }'"
+if expr "${REMOTE_OUT}" : '.*noexec' >/dev/null; then
+ var_mount_noexec=yes
+ remote_sh "mount -o remount,exec /var"
+fi
+
for pkg in $@; do
latest_pkg=$(ls -tr $PKGROOT/*/${pkg}-[0-9]* | tail -1)
if [ -z "${latest_pkg}" ]; then
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698