Zvikomborero Vincent Zvikaramba | a5d2c9c | 2017-03-12 03:16:31 -0400 | [diff] [blame] | 1 | #!/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 |
| 19 | BOOTLOADER=`getprop ro.bootloader` |
| 20 | |
| 21 | case $BOOTLOADER in |
| 22 | G530W*) VARIANT="can" ;; |
| 23 | G530T1*) VARIANT="mtr" ;; |
| 24 | G530T*) VARIANT="tmo" ;; |
| 25 | G530P*) VARIANT="spr" ;; |
| 26 | *) VARIANT="unknown" ;; |
| 27 | esac |
| 28 | |
| 29 | echo "Device variant is $VARIANT" |
| 30 | |
| 31 | # exit if the device is unknown |
| 32 | if [ $VARIANT == "unknown" ]; then |
| 33 | exit 1 |
| 34 | fi |
| 35 | |
| 36 | BLOBBASE=/system/blobs/$VARIANT |
| 37 | |
| 38 | DEVICE="gprimelte${VARIANT}" |
| 39 | |
| 40 | if [ -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 |
| 56 | fi |
| 57 | |
| 58 | # update the device name in the prop |
| 59 | echo "Updating device variant name ..." |
| 60 | sed -i s/gprimelte/${DEVICE}/g /system/build.prop |
| 61 | |
| 62 | # remove the device blobs |
| 63 | echo "Cleaning up ..." |
| 64 | rm -rf /system/blobs |
| 65 | |
| 66 | exit 0 |