| OLD | NEW |
| (Empty) | |
| 1 #!/bin/bash -p |
| 2 |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Called as root before Keystone ticket promotion to ensure a suitable |
| 8 # environment for Keystone installation. Ultimately, these features should be |
| 9 # integrated directly into the Keystone installation. |
| 10 # |
| 11 # Note that this script will be invoked with the real user ID set to the |
| 12 # user's ID, but the effective user ID set to 0 (root). bash -p is used on |
| 13 # the first line to prevent bash from setting the effective user ID to the |
| 14 # real user ID (dropping root privileges). |
| 15 # |
| 16 # TODO(mark): Remove this script when able. See http://b/2285921 and |
| 17 # http://b/2289908. |
| 18 |
| 19 set -e |
| 20 |
| 21 # This script runs as root, so be paranoid about things like ${PATH}. |
| 22 export PATH="/usr/bin:/usr/sbin:/bin:/sbin" |
| 23 |
| 24 # Output the pid to stdout before doing anything else. See |
| 25 # chrome/browser/cocoa/authorization_util.h. |
| 26 echo "${$}" |
| 27 |
| 28 if [ ${#} -ne 0 ] ; then |
| 29 echo "usage: ${0}" >& 2 |
| 30 exit 2 |
| 31 fi |
| 32 |
| 33 OWNER_GROUP="root:admin" |
| 34 CHMOD_MODE="a+rX,u+w,go-w" |
| 35 |
| 36 LIB_GOOG="/Library/Google" |
| 37 if [ -d "${LIB_GOOG}" ] ; then |
| 38 # Just work with the directory. Don't do anything recursively here, so as |
| 39 # to leave other things in /Library/Google alone. |
| 40 chown -h "${OWNER_GROUP}" "${LIB_GOOG}" >& /dev/null |
| 41 chmod -h "${CHMOD_MODE}" "${LIB_GOOG}" >& /dev/null |
| 42 |
| 43 LIB_GOOG_GSU="${LIB_GOOG}/GoogleSoftwareUpdate" |
| 44 if [ -d "${LIB_GOOG_GSU}" ] ; then |
| 45 chown -Rh "${OWNER_GROUP}" "${LIB_GOOG_GSU}" >& /dev/null |
| 46 chmod -R "${CHMOD_MODE}" "${LIB_GOOG_GSU}" >& /dev/null |
| 47 |
| 48 # On the Mac, or at least on HFS+, symbolic link permissions are |
| 49 # significant, but chmod -R and -h can't be used together. Do another |
| 50 # pass to fix the permissions on any symbolic links. |
| 51 find "${LIB_GOOG_GSU}" -type l -exec chmod -h "${CHMOD_MODE}" {} + >& \ |
| 52 /dev/null |
| 53 |
| 54 # TODO(mark): If GoogleSoftwareUpdate.bundle is missing, dump TicketStore |
| 55 # too? |
| 56 fi |
| 57 fi |
| 58 |
| 59 exit 0 |
| OLD | NEW |