1 #!/bin/bash 2 # 3 # Copyright (C) 2010 The Android Open Source Project 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # 18 # You can remove exchange by running this script. 19 # 20 21 set -e # fail fast 22 23 24 # Step 0. Make sure we're in the right directory, and the user really wants it. 25 26 if [[ ! -d src/com/android/email/ ]] ; then 27 echo "Run the script in the root of the email source tree." 1>&2 28 exit 1 29 fi 30 31 echo "" 32 echo -n "Do you wish to remove exchange support from the email app? (y/N):" 33 34 read answer 35 if [[ "$answer" != y ]] ; then 36 echo "Aborted." 1>&2 37 exit 1 38 fi 39 40 41 # Step 1. Remove all Exchange related packages. 42 43 rm -fr src/com/android/exchange/ \ 44 tests/src/com/android/exchange/ 45 46 47 # Step 2. Remove lines surrounded by START-EXCHANGE and END-EXCHANGE 48 49 find . \( -name '*.java' -o -name '*.xml' -o -name 'Android.mk' \) -print0 | 50 xargs -0 sed -i -e '/EXCHANGE-REMOVE-SECTION-START/,/EXCHANGE-REMOVE-SECTION-END/d' 51 52 53 # Step 3. Remove all imports from com.android.exchange (and its subpackages). 54 55 find . -name '*.java' -print0 | 56 xargs -0 sed -i -e '/^import com\.android\.exchange/d' 57 58 59 echo "" 60 echo "Exchange support has been successfully removed." 61 62 exit 0 63