blob: 20e411c54bdaf5f6d75b2ce432ed19223d39cee9 [file] [log] [blame]
Zvikomborero Vincent Zvikarambaa5d2c9c2017-03-12 03:16:31 -04001#!/sbin/sh
2#
3# Copyright (C) 2017 The LineageOS 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# Detect variant and copy its specific-blobs
19BOOTLOADER=`getprop ro.bootloader`
20
21case $BOOTLOADER in
22 G530W*) VARIANT="can" ;;
23 G530T1*) VARIANT="mtr" ;;
24 G530T*) VARIANT="tmo" ;;
25 G530P*) VARIANT="spr" ;;
26 *) VARIANT="unknown" ;;
27esac
28
29echo "Device variant is $VARIANT"
30
31# exit if the device is unknown
32if [ $VARIANT == "unknown" ]; then
33 exit 1
34fi
35
36BLOBBASE=/system/blobs/$VARIANT
37
38DEVICE="gprimelte${VARIANT}"
39
40if [ -d $BLOBBASE ]; then
41
42 cd $BLOBBASE
43
44 # copy all the blobs
45 for FILE in `find . -type f` ; do
46 mkdir -p `dirname /system/$FILE`
47 echo "Copying $FILE to /system/$FILE ..."
48 cp $FILE /system/$FILE
49 done
50
51 # set permissions on binary files
52 for FILE in bin/* ; do
53 echo "Setting /system/$FILE executable ..."
54 chmod 755 /system/$FILE
55 done
56fi
57
58# update the device name in the prop
59echo "Updating device variant name ..."
60sed -i s/gprimelte/${DEVICE}/g /system/build.prop
61
62# remove the device blobs
63echo "Cleaning up ..."
64rm -rf /system/blobs
65
66exit 0