diff --git a/browser_patches/do_checkout.sh b/browser_patches/do_checkout.sh index b83bd9b11d..c107b6035e 100755 --- a/browser_patches/do_checkout.sh +++ b/browser_patches/do_checkout.sh @@ -2,13 +2,8 @@ set -e set +x -function cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) +trap "cd $(pwd -P)" EXIT cd "$(dirname "$0")" -trap cleanup EXIT if [[ ($1 == '--help') || ($1 == '-h') ]]; then echo "usage: do_something.sh [firefox|webkit]" diff --git a/browser_patches/export.sh b/browser_patches/export.sh index b6384e79f1..3d89e7c14f 100755 --- a/browser_patches/export.sh +++ b/browser_patches/export.sh @@ -2,13 +2,8 @@ set -e set +x -cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) +trap "cd $(pwd -P)" EXIT cd "$(dirname "$0")" -trap cleanup EXIT if [[ ($1 == '--help') || ($1 == '-h') ]]; then echo "usage: export.sh [firefox|webkit] [custom_checkout_path]" diff --git a/browser_patches/firefox/archive.sh b/browser_patches/firefox/archive.sh index 42e75711da..68885ffd88 100755 --- a/browser_patches/firefox/archive.sh +++ b/browser_patches/firefox/archive.sh @@ -12,7 +12,6 @@ set -e set -x createZIPForLinuxOrMac() { - cd checkout local zipname=$1 local OBJ_FOLDER=$(ls -1 | grep obj-) if [[ $OBJ_FOLDER == "" ]]; then @@ -35,13 +34,8 @@ createZIPForLinuxOrMac() { cd - } -cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) -cd "$(dirname "$0")" -trap cleanup EXIT +trap "cd $(pwd -P)" EXIT +cd checkout if [[ "$(uname)" == "Darwin" ]]; then createZIPForLinuxOrMac "firefox-mac.zip" diff --git a/browser_patches/firefox/build.sh b/browser_patches/firefox/build.sh index 1870546b1b..93e85e92a9 100755 --- a/browser_patches/firefox/build.sh +++ b/browser_patches/firefox/build.sh @@ -2,14 +2,7 @@ set -e set +x -function cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) -cd "$(dirname "$0")" -trap cleanup EXIT - +trap "cd $(pwd -P)" EXIT cd checkout if ! [[ $(git rev-parse --abbrev-ref HEAD) == "pwdev" ]]; then diff --git a/browser_patches/upload.sh b/browser_patches/upload.sh index 0266f1ef8c..936267efb5 100755 --- a/browser_patches/upload.sh +++ b/browser_patches/upload.sh @@ -2,13 +2,8 @@ set -e set +x -cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) +trap "cd $(pwd -P)" EXIT cd "$(dirname "$0")" -trap cleanup EXIT if [[ ($1 == '--help') || ($1 == '-h') ]]; then echo "usage: $0 [firefox|webkit]" diff --git a/browser_patches/webkit/archive.sh b/browser_patches/webkit/archive.sh index 57ebdcb0ad..c96e493a06 100755 --- a/browser_patches/webkit/archive.sh +++ b/browser_patches/webkit/archive.sh @@ -75,11 +75,7 @@ createZipForMac() { rm -rf $tmpdir } -cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) +trap "cd $(pwd -P)" EXIT cd "$(dirname "$0")" -trap cleanup EXIT + main "$@" diff --git a/browser_patches/webkit/build.sh b/browser_patches/webkit/build.sh index ee2c12c28c..196cbe8213 100755 --- a/browser_patches/webkit/build.sh +++ b/browser_patches/webkit/build.sh @@ -2,14 +2,7 @@ set -e set +x -function cleanup() { - cd $OLD_DIR -} - -OLD_DIR=$(pwd -P) -cd "$(dirname "$0")" -trap cleanup EXIT - +trap "cd $(pwd -P)" EXIT cd checkout if ! [[ $(git rev-parse --abbrev-ref HEAD) == "pwdev" ]]; then