Skip to content

Commit 598f3d9

Browse files
Steve Kondikashwinr64
Steve Kondik
authored andcommitted
onyx: Use the new generic extractor
Change-Id: I80c5887405e587f1f854f5991d1a9b604a4c84e2
1 parent f17fa08 commit 598f3d9

File tree

2 files changed

+56
-220
lines changed

2 files changed

+56
-220
lines changed

extract-files.sh

+34-36
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
11
#!/bin/bash
2+
#
3+
# Copyright (C) 2016 The CyanogenMod 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+
#
217

318
set -e
419

5-
export DEVICE=onyx
6-
export VENDOR=oneplus
7-
8-
function extract() {
9-
for FILE in `egrep -v '(^#|^$)' $1`; do
10-
OLDIFS=$IFS IFS=":" PARSING_ARRAY=($FILE) IFS=$OLDIFS
11-
FILE=`echo ${PARSING_ARRAY[0]} | sed -e "s/^-//g"`
12-
DEST=${PARSING_ARRAY[1]}
13-
if [ -z $DEST ]; then
14-
DEST=$FILE
15-
fi
16-
echo "Extracting /system/$FILE ..."
17-
DIR=`dirname $FILE`
18-
if [ ! -d $2/$DIR ]; then
19-
mkdir -p $2/$DIR
20-
fi
21-
if [ "$SRC" = "adb" ]; then
22-
# Try CM target first
23-
adb pull /system/$DEST $2/$DEST
24-
# if file does not exist try OEM target
25-
if [ "$?" != "0" ]; then
26-
adb pull /system/$FILE $2/$DEST
27-
fi
28-
else
29-
cp $SRC/system/$FILE $2/$DEST
30-
# if file dot not exist try destination
31-
if [ "$?" != "0" ]; then
32-
cp $SRC/system/$DEST $2/$DEST
33-
fi
34-
fi
35-
done
36-
}
20+
DEVICE=onyx
21+
VENDOR=oneplus
22+
23+
# Load extractutils and do some sanity checks
24+
MY_DIR="${BASH_SOURCE%/*}"
25+
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
26+
27+
CM_ROOT="$MY_DIR"/../../..
28+
29+
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
30+
if [ ! -f "$HELPER" ]; then
31+
echo "Unable to find helper script at $HELPER"
32+
exit 1
33+
fi
34+
. "$HELPER"
3735

3836
if [ $# -eq 0 ]; then
3937
SRC=adb
@@ -51,9 +49,9 @@ else
5149
fi
5250
fi
5351

54-
BASE=../../../vendor/$VENDOR/$DEVICE/proprietary
55-
rm -rf $BASE/*
52+
# Initialize the helper
53+
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
5654

57-
extract ../../$VENDOR/$DEVICE/proprietary-files.txt $BASE
55+
extract "$MY_DIR"/proprietary-files.txt "$SRC"
5856

59-
./setup-makefiles.sh
57+
"$MY_DIR"/setup-makefiles.sh

setup-makefiles.sh

+22-184
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,5 @@
1-
21
#!/bin/bash
3-
4-
DEVICE=onyx
5-
VENDOR=oneplus
6-
7-
OUTDIR=vendor/$VENDOR/$DEVICE
8-
MAKEFILE=../../../$OUTDIR/$DEVICE-vendor-blobs.mk
9-
10-
(cat << EOF) > $MAKEFILE
11-
# Copyright (C) 2016 The CyanogenMod Project
12-
#
13-
# Licensed under the Apache License, Version 2.0 (the "License");
14-
# you may not use this file except in compliance with the License.
15-
# You may obtain a copy of the License at
16-
#
17-
# http://www.apache.org/licenses/LICENSE-2.0
18-
#
19-
# Unless required by applicable law or agreed to in writing, software
20-
# distributed under the License is distributed on an "AS IS" BASIS,
21-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22-
# See the License for the specific language governing permissions and
23-
# limitations under the License.
24-
25-
# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
26-
27-
PRODUCT_COPY_FILES += \\
28-
EOF
29-
30-
LINEEND=" \\"
31-
COUNT=`wc -l proprietary-files.txt | awk {'print $1'}`
32-
DISM=`egrep -c '(^#|^$)' proprietary-files.txt`
33-
COUNT=`expr $COUNT - $DISM`
34-
for FILE in `egrep -v '(^#|^$)' ../$DEVICE/proprietary-files.txt`; do
35-
COUNT=`expr $COUNT - 1`
36-
if [[ ! "$FILE" =~ ^-.* ]]; then
37-
echo " $OUTDIR/proprietary/$FILE:system/$FILE$LINEEND" >> $MAKEFILE
38-
fi
39-
done
40-
41-
(cat << EOF) > ../../../$OUTDIR/$DEVICE-vendor.mk
42-
# Copyright (C) 2016 The CyanogenMod Project
43-
#
44-
# Licensed under the Apache License, Version 2.0 (the "License");
45-
# you may not use this file except in compliance with the License.
46-
# You may obtain a copy of the License at
47-
#
48-
# http://www.apache.org/licenses/LICENSE-2.0
492
#
50-
# Unless required by applicable law or agreed to in writing, software
51-
# distributed under the License is distributed on an "AS IS" BASIS,
52-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53-
# See the License for the specific language governing permissions and
54-
# limitations under the License.
55-
56-
# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
57-
58-
# Pick up overlay for features that depend on non-open-source files
59-
PRODUCT_PACKAGES += \\
60-
com.qualcomm.location \\
61-
CNEService \\
62-
dpmserviceapp \\
63-
qcrilmsgtunnel \\
64-
shutdownlistener \\
65-
libril
66-
67-
PRODUCT_PACKAGES += \\
68-
libmm-abl \\
69-
libtime_genoff \\
70-
libTimeService \\
71-
TimeService
72-
73-
\$(call inherit-product, vendor/$VENDOR/$DEVICE/$DEVICE-vendor-blobs.mk)
74-
EOF
75-
76-
(cat << EOF) > ../../../$OUTDIR/BoardConfigVendor.mk
773
# Copyright (C) 2016 The CyanogenMod Project
784
#
795
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -87,124 +13,36 @@ EOF
8713
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8814
# See the License for the specific language governing permissions and
8915
# limitations under the License.
90-
91-
# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
92-
EOF
93-
94-
(cat << EOF) > ../../../$OUTDIR/Android.mk
95-
# Copyright (C) 2016 The CyanogenMod Project
96-
#
97-
# Licensed under the Apache License, Version 2.0 (the "License");
98-
# you may not use this file except in compliance with the License.
99-
# You may obtain a copy of the License at
100-
#
101-
# http://www.apache.org/licenses/LICENSE-2.0
10216
#
103-
# Unless required by applicable law or agreed to in writing, software
104-
# distributed under the License is distributed on an "AS IS" BASIS,
105-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
106-
# See the License for the specific language governing permissions and
107-
# limitations under the License.
108-
109-
# This file is generated by device/$VENDOR/$DEVICE/setup-makefiles.sh
110-
111-
LOCAL_PATH := \$(call my-dir)
112-
113-
ifneq (\$(filter onyx,\$(TARGET_DEVICE)),)
11417

115-
include \$(CLEAR_VARS)
116-
LOCAL_MODULE := com.qualcomm.location
117-
LOCAL_MODULE_OWNER := $VENDOR
118-
LOCAL_SRC_FILES := proprietary/priv-app/com.qualcomm.location/com.qualcomm.location.apk
119-
LOCAL_MODULE_TAGS := optional
120-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
121-
LOCAL_MODULE_CLASS := APPS
122-
LOCAL_CERTIFICATE := platform
123-
LOCAL_PRIVILEGED_MODULE := true
124-
include \$(BUILD_PREBUILT)
18+
set -e
12519

126-
LOCAL_MODULE := CNEService
127-
LOCAL_MODULE_OWNER := $VENDOR
128-
LOCAL_SRC_FILES := proprietary/priv-app/CNEService/CNEService.apk
129-
LOCAL_MODULE_TAGS := optional
130-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
131-
LOCAL_MODULE_CLASS := APPS
132-
LOCAL_CERTIFICATE := platform
133-
LOCAL_PRIVILEGED_MODULE := true
134-
include \$(BUILD_PREBUILT)
135-
136-
include \$(CLEAR_VARS)
137-
LOCAL_MODULE := dpmserviceapp
138-
LOCAL_MODULE_OWNER := $VENDOR
139-
LOCAL_SRC_FILES := proprietary/priv-app/dpmserviceapp/dpmserviceapp.apk
140-
LOCAL_MODULE_TAGS := optional
141-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
142-
LOCAL_MODULE_CLASS := APPS
143-
LOCAL_CERTIFICATE := platform
144-
LOCAL_PRIVILEGED_MODULE := true
145-
include \$(BUILD_PREBUILT)
20+
# Required!
21+
DEVICE=onyx
22+
VENDOR=oneplus
14623

147-
include \$(CLEAR_VARS)
148-
LOCAL_MODULE := qcrilmsgtunnel
149-
LOCAL_MODULE_OWNER := $VENDOR
150-
LOCAL_SRC_FILES := proprietary/priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk
151-
LOCAL_MODULE_TAGS := optional
152-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
153-
LOCAL_MODULE_CLASS := APPS
154-
LOCAL_CERTIFICATE := platform
155-
LOCAL_PRIVILEGED_MODULE := true
156-
include \$(BUILD_PREBUILT)
24+
# Load extractutils and do some sanity checks
25+
MY_DIR="${BASH_SOURCE%/*}"
26+
if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
15727

158-
include \$(CLEAR_VARS)
159-
LOCAL_MODULE := shutdownlistener
160-
LOCAL_MODULE_OWNER := $VENDOR
161-
LOCAL_SRC_FILES := proprietary/app/shutdownlistener/shutdownlistener.apk
162-
LOCAL_MODULE_TAGS := optional
163-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
164-
LOCAL_MODULE_CLASS := APPS
165-
LOCAL_CERTIFICATE := platform
166-
include \$(BUILD_PREBUILT)
28+
CM_ROOT="$MY_DIR"/../../..
16729

168-
include \$(CLEAR_VARS)
169-
LOCAL_MODULE := libmm-abl
170-
LOCAL_MODULE_OWNER := $VENDOR
171-
LOCAL_SRC_FILES := proprietary/vendor/lib/libmm-abl.so
172-
LOCAL_MODULE_PATH := \$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
173-
LOCAL_MODULE_TAGS := optional
174-
LOCAL_MODULE_SUFFIX := .so
175-
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
176-
include \$(BUILD_PREBUILT)
30+
HELPER="$CM_ROOT"/vendor/cm/build/tools/extract_utils.sh
31+
if [ ! -f "$HELPER" ]; then
32+
echo "Unable to find helper script at $HELPER"
33+
exit 1
34+
fi
35+
. "$HELPER"
17736

178-
include \$(CLEAR_VARS)
179-
LOCAL_MODULE := libtime_genoff
180-
LOCAL_MODULE_OWNER := $VENDOR
181-
LOCAL_SRC_FILES := proprietary/vendor/lib/libtime_genoff.so
182-
LOCAL_MODULE_PATH := \$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
183-
LOCAL_MODULE_TAGS := optional
184-
LOCAL_MODULE_SUFFIX := .so
185-
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
186-
include \$(BUILD_PREBUILT)
37+
# Initialize the helper
38+
setup_vendor "$DEVICE" "$VENDOR" "$CM_ROOT"
18739

188-
include \$(CLEAR_VARS)
189-
LOCAL_MODULE := TimeService
190-
LOCAL_MODULE_OWNER := $VENDOR
191-
LOCAL_SRC_FILES := proprietary/app/TimeService/TimeService.apk
192-
LOCAL_MODULE_TAGS := optional
193-
LOCAL_MODULE_SUFFIX := \$(COMMON_ANDROID_PACKAGE_SUFFIX)
194-
LOCAL_MODULE_CLASS := APPS
195-
LOCAL_CERTIFICATE := platform
196-
include \$(BUILD_PREBUILT)
40+
# Copyright headers and guards
41+
write_headers
19742

198-
include \$(CLEAR_VARS)
199-
LOCAL_MODULE := libTimeService
200-
LOCAL_MODULE_OWNER := $VENDOR
201-
LOCAL_SRC_FILES := proprietary/vendor/lib/libTimeService.so
202-
LOCAL_MODULE_PATH := \$(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
203-
LOCAL_MODULE_TAGS := optional
204-
LOCAL_MODULE_SUFFIX := .so
205-
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
206-
include \$(BUILD_PREBUILT)
43+
# The standard blobs
44+
write_makefiles "$MY_DIR"/proprietary-files.txt
20745

208-
endif
46+
# We are done!
47+
write_footers
20948

210-
EOF

0 commit comments

Comments
 (0)