1 # 2 # Copyright (C) 2009 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 BEGIN { 17 fixed_remount = 0; 18 console_state = 0; 19 } 20 21 /^ mount yaffs2 mtd@system \/system ro remount$/ { 22 fixed_remount = 1; 23 print " # dexpreopt needs to write to /system"; 24 print " ### " $0; 25 next; 26 } 27 28 console_state == 0 && /^service console \/system\/bin\/sh$/ { 29 console_state = 1; 30 print; 31 next; 32 } 33 34 console_state == 1 && /^ console$/ { 35 console_state = 2; 36 print; 37 exit; 38 } 39 40 console_state == 1 { 41 # The second line of the console entry should always immediately 42 # follow the first. 43 exit; 44 } 45 46 { print } 47 48 END { 49 failed = 0; 50 if (fixed_remount != 1) { 51 print "ERROR: no match for remount line" > "/dev/stderr"; 52 failed = 1; 53 } 54 if (console_state != 2) { 55 print "ERROR: no match for console lines" > "/dev/stderr"; 56 failed = 1; 57 } 58 if (failed == 1) { 59 print ">>>> FAILED <<<<" 60 exit 1; 61 } 62 } 63