| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Test of the Mac Chrome installer. | 7 # Test of the Mac Chrome installer. |
| 8 | 8 |
| 9 | 9 |
| 10 # Where I am | 10 # Where I am |
| 11 DIR=$(dirname "${0}") | 11 DIR=$(dirname "${0}") |
| 12 | 12 |
| 13 # My installer to test | 13 # My installer to test |
| 14 INSTALLER="${DIR}"/keystone_install.sh | 14 INSTALLER="${DIR}"/keystone_install.sh |
| 15 if [ ! -f "${INSTALLER}" ]; then | 15 if [ ! -f "${INSTALLER}" ]; then |
| 16 echo "Can't find scripts." >& 2 | 16 echo "Can't find scripts." >& 2 |
| 17 exit 1 | 17 exit 1 |
| 18 fi | 18 fi |
| 19 | 19 |
| 20 # What I test | 20 # What I test |
| 21 PRODNAME="Google Chrome" | 21 PRODNAME="Google Chrome" |
| 22 APPNAME="${PRODNAME}.app" | 22 APPNAME="${PRODNAME}.app" |
| 23 FWKNAME="${PRODNAME} Framework.framework" | 23 FWKNAME="${PRODNAME} Framework.framework" |
| 24 | 24 |
| 25 # The version number for fake ksadmin to pretend to be |
| 26 KSADMIN_VERSION_LIE="1.0.7.1306" |
| 27 |
| 25 # Temp directory to be used as the disk image (source) | 28 # Temp directory to be used as the disk image (source) |
| 26 TEMPDIR=$(mktemp -d -t $(basename ${0})) | 29 TEMPDIR=$(mktemp -d -t $(basename ${0})) |
| 27 PATH=$PATH:"${TEMPDIR}" | 30 PATH=$PATH:"${TEMPDIR}" |
| 28 | 31 |
| 29 # Clean up the temp directory | 32 # Clean up the temp directory |
| 30 function cleanup_tempdir() { | 33 function cleanup_tempdir() { |
| 31 chmod u+w "${TEMPDIR}" | 34 chmod u+w "${TEMPDIR}" |
| 32 rm -rf "${TEMPDIR}" | 35 rm -rf "${TEMPDIR}" |
| 33 } | 36 } |
| 34 | 37 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 | 68 |
| 66 # Make an old-style destination directory, to test updating from old-style | 69 # Make an old-style destination directory, to test updating from old-style |
| 67 # versions to new-style versions. | 70 # versions to new-style versions. |
| 68 function make_old_dest() { | 71 function make_old_dest() { |
| 69 DEST="${TEMPDIR}"/Dest.app | 72 DEST="${TEMPDIR}"/Dest.app |
| 70 rm -rf "${DEST}" | 73 rm -rf "${DEST}" |
| 71 mkdir -p "${DEST}"/Contents | 74 mkdir -p "${DEST}"/Contents |
| 72 defaults write "${DEST}/Contents/Info" KSVersion 0 | 75 defaults write "${DEST}/Contents/Info" KSVersion 0 |
| 73 cat >"${TEMPDIR}"/ksadmin <<EOF | 76 cat >"${TEMPDIR}"/ksadmin <<EOF |
| 74 #!/bin/sh | 77 #!/bin/sh |
| 78 if [ "\${1}" = "--ksadmin-version" ] ; then |
| 79 echo "${KSADMIN_VERSION_LIE}" |
| 80 exit 0 |
| 81 fi |
| 75 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then | 82 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then |
| 76 echo no system tix! >& 2 | 83 echo no system tix! >& 2 |
| 77 exit 1 | 84 exit 1 |
| 78 fi | 85 fi |
| 79 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>" | 86 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>" |
| 80 exit 0 | 87 exit 0 |
| 81 EOF | 88 EOF |
| 82 chmod u+x "${TEMPDIR}"/ksadmin | 89 chmod u+x "${TEMPDIR}"/ksadmin |
| 83 } | 90 } |
| 84 | 91 |
| 85 # Make a new-style destination directory, to test updating between new-style | 92 # Make a new-style destination directory, to test updating between new-style |
| 86 # versions. | 93 # versions. |
| 87 function make_new_dest() { | 94 function make_new_dest() { |
| 88 DEST="${TEMPDIR}"/Dest.app | 95 DEST="${TEMPDIR}"/Dest.app |
| 89 rm -rf "${DEST}" | 96 rm -rf "${DEST}" |
| 90 RSRCDIR="${DEST}/Contents/Versions/0/${FWKNAME}/Resources" | 97 RSRCDIR="${DEST}/Contents/Versions/0/${FWKNAME}/Resources" |
| 91 mkdir -p "${RSRCDIR}" | 98 mkdir -p "${RSRCDIR}" |
| 92 defaults write "${DEST}/Contents/Info" CFBundleShortVersionString 0 | 99 defaults write "${DEST}/Contents/Info" CFBundleShortVersionString 0 |
| 93 defaults write "${RSRCDIR}/Info" KSVersion 0 | 100 defaults write "${RSRCDIR}/Info" KSVersion 0 |
| 94 cat >"${TEMPDIR}"/ksadmin <<EOF | 101 cat >"${TEMPDIR}"/ksadmin <<EOF |
| 95 #!/bin/sh | 102 #!/bin/sh |
| 103 if [ "\${1}" = "--ksadmin-version" ] ; then |
| 104 echo "${KSADMIN_VERSION_LIE}" |
| 105 exit 0 |
| 106 fi |
| 96 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then | 107 if [ -z "\${FAKE_SYSTEM_TICKET}" ] && [ "\${1}" = "-S" ] ; then |
| 97 echo no system tix! >& 2 | 108 echo no system tix! >& 2 |
| 98 exit 1 | 109 exit 1 |
| 99 fi | 110 fi |
| 100 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>" | 111 echo " xc=<KSPathExistenceChecker:0x45 path=${DEST}>" |
| 101 exit 0 | 112 exit 0 |
| 102 EOF | 113 EOF |
| 103 chmod u+x "${TEMPDIR}"/ksadmin | 114 chmod u+x "${TEMPDIR}"/ksadmin |
| 104 } | 115 } |
| 105 | 116 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 KSUpdateURL "http://foo.bar" | 160 KSUpdateURL "http://foo.bar" |
| 150 pass_installer "Old-style update" | 161 pass_installer "Old-style update" |
| 151 | 162 |
| 152 make_basic_src_and_dest | 163 make_basic_src_and_dest |
| 153 defaults write \ | 164 defaults write \ |
| 154 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \ | 165 "${TEMPDIR}/${APPNAME}/Contents/Versions/1/${FWKNAME}/Resources/Info" \ |
| 155 KSUpdateURL "http://foo.bar" | 166 KSUpdateURL "http://foo.bar" |
| 156 pass_installer "ALL" | 167 pass_installer "ALL" |
| 157 | 168 |
| 158 cleanup_tempdir | 169 cleanup_tempdir |
| OLD | NEW |