• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
21set -e # fail fast
22
23# Step 0. Make sure we're in the right directory, and the user really wants it.
24
25if [[ ! -d src/com/android/email/ ]] ; then
26  echo "Run the script in the root of the email source tree." 1>&2
27  exit 1
28fi
29
30echo ""
31echo -n "Do you wish to remove exchange support from the email app? (y/N):"
32
33read answer
34if [[ "$answer" != y ]] ; then
35  echo "Aborted." 1>&2
36  exit 1
37fi
38
39
40# Step 1. Remove all Exchange related packages.
41
42rm -fr src/com/android/exchange/ \
43       tests/src/com/android/exchange/
44
45
46# Step 2. Remove lines surrounded by START-EXCHANGE and END-EXCHANGE
47
48find . \( -name '*.java' -o -name '*.xml' -o -name 'Android.mk' \) -print0 |
49    xargs -0 sed -i "" -e '/EXCHANGE-REMOVE-SECTION-START/,/EXCHANGE-REMOVE-SECTION-END/d'
50
51
52# Step 3. Remove all imports from com.android.exchange (and its subpackages).
53
54find . -name '*.java' -print0 |
55    xargs -0 sed -i "" -e '/^import com\.android\.exchange/d'
56
57
58echo ""
59echo "Exchange support has been successfully removed."
60
61exit 0
62