Guest User

Olio Watch update.sh

a guest
Aug 23rd, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 20.09 KB | None | 0 0
  1. #!/system/busybox/sh
  2. #
  3. # runme_android_template.sh - template for updating android scripts
  4. #
  5. # Description:
  6. # ============
  7. # This is the foundation for the android part of an OTA update. It
  8. # needs to do a few things: Check that the file transfer happened
  9. # correctly, set up the device for a reboot into linux, and kick
  10. # off that reboot.
  11. #
  12. # This file contains a template for that script. Some parts are
  13. # replaced by code generated by the make_android_ota_package script.
  14. # Text marked by ***TEXT*** gets replaced.
  15. #
  16. # Modification History
  17. # ====================
  18. # 01a, 20150427, mfj  Created
  19. # 01b, 20150916, mfj  Updated to do most of the work from Android
  20.  
  21. SCRIPTNAME=`basename $0`
  22.  
  23. MD5SUM=***MD5SUM***
  24. LINUX_UPDATE_FILE=***LINUX_UPDATE_FILE***
  25. UPDATE_NAME=update_1.10.220_release.zip
  26. CREATION_DATE=2016-11-29
  27. UPDATE_NOTES="Version 1.10.220 release Build"
  28. VERSION_NUMBER=1.10.220
  29.  
  30. MODEL_NAME="Olio Model One"
  31.  
  32. OLIO_FOLDER="/data/media/0/olio/"
  33. TARGET_FOLDER="$OLIO_FOLDER/firmware_updates_apply"
  34.  
  35.  
  36. UPDATE_LINUX=false
  37. UPDATE_LINUX_PATH="firmware_updates_apply/$LINUX_UPDATE_FILE"
  38.  
  39. FIRMWARE_MD5=""
  40. LINUX_BOOT="run ramfdtboot"
  41.  
  42. # ---------------------------------------------------------------------------
  43. # FILES TO UPDATE
  44.  
  45. BLUETOOTH_CLIENT="$TARGET_FOLDER/BluetoothClient-debug.apk"
  46. LOOKS="$TARGET_FOLDER/looks.zip"
  47. UIMAGE="$TARGET_FOLDER/uImage"
  48. UIMAGE_PARTITION="kernel"
  49. RAMFS="$TARGET_FOLDER/rootfs.cpio.uboot"
  50. RAMFS_PARTITION="initramfs"
  51. DTB="$TARGET_FOLDER/omap3_h1.dtb"
  52. DTB_PARTITION="devicetree"
  53. UBOOT="$TARGET_FOLDER/u-boot.img"
  54. UBOOT_PARTITION="U-Boot"
  55. DRV2605="$TARGET_FOLDER/drv2605.ko"
  56. ATMEL_CFG="$TARGET_FOLDER/atmel_cfg.raw"
  57. CHARGER_FW="$TARGET_FOLDER/charger_fw.bin" # TRICKY, how to do on Android?
  58. INITRC="$TARGET_FOLDER/init.h1.rc"
  59. FLASH_IMAGE="$TARGET_FOLDER/flash_image"
  60. POWER_HAL="$TARGET_FOLDER/power.h1.so"
  61. SERVICES_JAR="$TARGET_FOLDER/services.jar"
  62. OLIO_FB="$TARGET_FOLDER/olio_fb_setup.sh"
  63.  
  64. # ===========================================================================
  65. # Result reporting
  66. # ===========================================================================
  67.  
  68. report_fail ()
  69. {
  70.     local testcase=$1
  71.     local exectime=$2
  72.     local date=`date +%Y-%m-%d_%H:%M`
  73.  
  74.     echo -e "==> RESULT | $testcase | FAIL | $exectime | $date"
  75. }
  76.  
  77. report_success ()
  78. {
  79.     local testcase=$1
  80.     local exectime=$2
  81.     local date=`date +%Y-%m-%d_%H:%M`
  82.  
  83.     echo -e "==> RESULT | $testcase | PASS | $exectime | $date"
  84. }
  85.  
  86.  
  87. # ---------------------------------------------------------------------------
  88. # update_bootlines
  89. #
  90. # Set the environment variables that are needed before reboot
  91.  
  92. update_bootlines ()
  93. {
  94.  
  95.     echo "$0: Setting bootlines."
  96.  
  97.     fw_setenv bootcmd "$LINUX_BOOT"
  98.     fw_setenv reboot_reason "SYS_UPDATE"
  99.     fw_setenv update_file "$LINUX_UPDATE_FILE"
  100.  
  101.     report_success "bootlines updated." "1.0"
  102. }
  103.  
  104. # ---------------------------------------------------------------------------
  105. # linux_update_prep
  106. #
  107. # In preparation for running the update on Linux, make the linux script
  108. # executable and place it in the right location
  109.  
  110. linux_update_prep ()
  111. {
  112.     mkdir -p $OLIO_FOLDER/update
  113.     mv $TARGET_FOLDER/runme_linux.sh $OLIO_FOLDER/update/
  114.     mv $TARGET_FOLDER/$LINUX_UPDATE_FILE $OLIO_FOLDER/
  115.     chmod +x $OLIO_FOLDER/update/runme_linux.sh
  116.  
  117.     report_success "Prepared for low-level updates." "1.0"
  118. }
  119.  
  120.  
  121. # ---------------------------------------------------------------------------
  122. # check_md5_sum
  123. #
  124. # Check that file was properly transferred. This checks the linux update
  125. # portion only, since that hasn't been checked by the backend.
  126.  
  127. check_md5_sum ()
  128. {
  129.     local zipfile_md5=`/system/busybox/md5sum $TARGET_FOLDER/$LINUX_UPDATE_FILE | cut -f 1 -d " "`
  130.  
  131.     echo -n "$0: Verifying integrity of bundle ..."
  132.  
  133.     if [ "$zipfile_md5" != "$MD5SUM" ]
  134.     then
  135.         echo ""
  136.         echo "$0: ERROR! Incorrect md5sum. Exiting."
  137.         echo "$0: (Expected $MD5SUM, found $zipfile_md5)"
  138.         echo "$0: Can't install update, "
  139.     report_fail "md5 sum of included bundle is WRONG." "1.0"
  140.  
  141.         exit 0
  142.     fi
  143.  
  144.     report_success "md5 sum of included bundle OK." "1.0"
  145. }
  146.  
  147. # ---------------------------------------------------------------------------
  148. # get_md5_log
  149. #
  150. # This function finds the md5 for the full zip-file, used for recording this
  151. # update in the log file. TODO: What if an update fails to apply? Probably
  152. # the olio_fb_setup script should be smarter ... or maybe the update script
  153. # should be.
  154.  
  155. calc_md5_sum ()
  156. {
  157.     # Look for the first entry in firmware_next
  158.  
  159.     local firmware_bundle="$TARGET_FOLDER/../firmware_next/olio-firmware.zip"
  160.  
  161.     if [ -e $firmware_bundle ]
  162.     then
  163.         FIRMWARE_MD5=`/system/busybox/md5sum $firmware_bundle | cut -f 1 -d " "`
  164.     else
  165.         firmware_bundle="$TARGET_FOLDER/../temp/olio-firmware.zip"
  166.        
  167.         if [ -e $firmware_bundle ]
  168.         then
  169.             FIRMWARE_MD5=`/system/busybox/md5sum $firmware_bundle | cut -f 1 -d " "`
  170.         else
  171.             FIRMWARE_MD5="n/a"
  172.         fi
  173.     fi
  174.    
  175.     echo "firmware md5 sum is $firmware_md5"
  176.  
  177.     return
  178. }
  179.  
  180. # ---------------------------------------------------------------------------
  181. # create_version_log
  182. #
  183. # We'll create a log entry which goes into two places - appended to a list of
  184. # changes that logs each software update, and a file that only contains the
  185. # latest entry.
  186.  
  187. create_version_log ()
  188. {
  189.     calc_md5_sum
  190.     local hash=$FIRMWARE_MD5
  191.  
  192.     local current_date=`date +%Y-%m-%d`
  193.     local log_string="$VERSION_NUMBER, $MODEL_NAME, $CREATION_DATE, $current_date, $hash, $UPDATE_NAME, \"$UPDATE_NOTES\""
  194.  
  195.     echo $log_string > $TARGET_FOLDER/../firmware_update_latest.txt
  196.     echo $log_string >> $TARGET_FOLDER/../firmware_updates_applied.csv
  197.  
  198.     chmod 666 $TARGET_FOLDER/../firmware_update_latest.txt
  199.     chmod 666 $TARGET_FOLDER/../firmware_update_latest.txt
  200.     chown 1000:1000 $TARGET_FOLDER/../firmware_updates_applied.csv
  201.     chown 1000:1000 $TARGET_FOLDER/../firmware_updates_applied.csv
  202. }
  203.  
  204. # ---------------------------------------------------------------------------
  205. # set_path_permissions
  206. #
  207. # We've had issues sometimes when a path couldn't be accessed because the
  208. # permissions were wrong.
  209. #
  210.  
  211. set_path_permissions ()
  212. {
  213.     echo "$0: Setting permissions for all steps in $TARGET_FOLDER"
  214.  
  215.     chmod 771 /data
  216.     chmod 770 /data/media
  217.     chmod 770 /data/media/0
  218.     chmod 775 /data/media/0/olio
  219.     chmod 775 $TARGET_FOLDER
  220.  
  221.     chown 1023:1023 $TARGET_FOLDER
  222. }
  223.  
  224. # ---------------------------------------------------------------------------
  225. # run_android_updates
  226. #
  227. # RUN FROM ANDROID!
  228. #
  229. # Install the Olio app. This can't be done until the system is done booting,
  230. # but we have no way of knowing when this is done. Hence we simply try again
  231. # until it works.                                              
  232.  
  233.  
  234. # ---------------------------------------------------------------------------
  235. # install_apk_updates - install regular android packages
  236.  
  237. # arg 1: apk with full path
  238. # arg 2: installed package name, e.g. com.olio.experiments
  239.  
  240. install_apk_update ()
  241. {
  242.     echo "$0: Installing $1"
  243.  
  244.     local install_package="$1"
  245.     local uninstall_package="$2"
  246.  
  247.     # Make sure device stays awake during the update. This will get cleared out after a reboot
  248.     echo m > /sys/power/wake_lock
  249.    
  250.     if [ -e $install_package ]
  251.     then
  252.         # Wait until the pm system is up and running
  253.  
  254.     RESULT=`/system/bin/pm list packages 2>&1 | /system/bin/grep "Error"`
  255.    
  256.     while [ "$RESULT" != "" ]
  257.     do
  258.             sleep 2
  259.             RESULT=`/system/bin/pm list packages 2>&1 | /system/bin/grep "Error"`
  260.     done
  261.  
  262.         # PM is running. Go ahead and do what we need to do.
  263.         # Check whether it's installed in the first place.
  264.     fi
  265.  
  266.     RESULT=`/system/bin/pm list packages | grep "$uninstall_package"`
  267.    
  268.     if [ "$RESULT" == "" ]
  269.     then
  270.         echo "$0: $uninstall_package not installed"
  271.     else
  272.     RESULT=`/system/bin/pm uninstall $uninstall_package 2>&1`
  273.         RESULT=`echo $RESULT | /system/bin/grep "Error"`
  274.        
  275.     while [ "$RESULT" != "" ]
  276.         do
  277.         echo "Uninstall failed. Retrying\n" >> /system/vendor/fb_error.txt
  278.         RESULT=`/system/bin/pm uninstall "$uninstall_package" 2>&1`
  279.         echo -e "$RESULT \n" >> /system/vendor/fb_error.txt
  280.             RESULT=`echo $RESULT | /system/bin/grep "Error"`
  281.         sleep 1                        
  282.     done
  283.     fi
  284.    
  285.     echo "$0: $uninstall_package no longer on system, now installing $install_package"
  286.    
  287.     chmod 664 $install_package
  288.     chown 1000:1000 $install_package
  289.    
  290.     RESULT=`/system/bin/pm install $install_package 2>&1`
  291.     RESULT=`echo $RESULT | /system/bin/grep "Error"`            
  292.    
  293.     while [ "$RESULT" != "" ]
  294.     do                                                                      
  295.     echo "Install failed. Retrying\n" >> /system/vendor/fb_error.txt
  296.     RESULT=`/system/bin/pm install $install_package 2>&1`
  297.     echo -e "$RESULT \n" >> /system/vendor/fb_error.txt
  298.         RESULT=`echo $RESULT | /system/bin/grep "Error"`
  299.     sleep 1                        
  300.     done
  301. }
  302.  
  303.  
  304. # ---------------------------------------------------------------------------
  305. # hwlib_update - update any hardware library.
  306. #
  307. # Argument: the library (with full path).
  308.  
  309. hw_lib_update ()
  310. {
  311.     local hwlib=$1
  312.  
  313.     chown 1000:1000 $hwlib
  314.     chmod 775 $hwlib
  315.  
  316.     cp -p $hwlib /system/lib/hw/
  317.    
  318.     report_success "Installed $hwlib" "1.0"
  319. }
  320.  
  321.  
  322. # ---------------------------------------------------------------------------
  323. # android_apks_remove
  324. #
  325. # Remove apks that a) are included by Android default, and b) Olio doesn't
  326. # need. To keep things reversible, we're not actually removing them, just
  327. # copying them over to a safe location.
  328.  
  329. android_apks_remove ()
  330. {
  331.     privapp_to_remove="BackupRestoreConfirmation.apk BackupRestoreConfirmation.odex DefaultContainerService.apk DefaultContainerService.odex DownloadProvider.apk DownloadProvider.odex ExternalStorageProvider.apk ExternalStorageProvider.odex FusedLocation.apk FusedLocation.odex InputDevices.apk InputDevices.odex Keyguard.apk Keyguard.odex Launcher2.odex MediaProvider.apk MediaProvider.odex MusicFX.apk MusicFX.odex OneTimeInitializer.apk OneTimeInitializer.odex ProxyHandler.apk ProxyHandler.odex SharedStorageBackup.apk SharedStorageBackup.odex Shell.apk Shell.odex SystemUI.apk SystemUI.odex VpnDialogs.apk VpnDialogs.odex WallpaperCropper.apk WallpaperCropper.odex"
  332.  
  333.     app_to_remove="AvrcpMediaPlayer.odex DeskClock.apk DeskClock.odex Development.apk Development.odex DocumentsUI.apk DocumentsUI.odex DownloadProviderUi.apk DownloadProviderUi.odex HIDDeviceApp.odex LatinIME.apk LatinIME.odex MapclientTestApp.odex Music.apk Music.odex PacProcessor.apk PacProcessor.odex PackageInstaller.apk PackageInstaller.odex PbapClientTestApp.odex PicoTts.apk PicoTts.odex PrintSpooler.apk PrintSpooler.odex Provision.apk Provision.odex BrcmHfDeviceTestApp.odex"
  334.  
  335.     mkdir -p /system/priv-app-old
  336.     mkdir -p /system/app-old    
  337.  
  338.     echo "OLIO: Moving applications out of priv-app folder."
  339.  
  340.     for app in $privapp_to_remove
  341.     do
  342.     mv /system/priv-app/$app /system/priv-app-old/
  343.     done
  344.  
  345.     echo "OLIO: Moving applications out of app folder."
  346.  
  347.     for app in $app_to_remove
  348.     do
  349.     mv /system/app/$app /system/app-old/
  350.     done
  351.  
  352.     echo "OLIO: android_apks_remove done."
  353. }
  354.  
  355. # ---------------------------------------------------------------------------
  356. # install_software - master function for installing software.
  357.  
  358. install_software_android ()
  359. {
  360.     if [ -e $TARGET_FOLDER/olio_fix.sh ]
  361.     then
  362.         chown 1000:1000 $TARGET_FOLDER/olio_fix.sh
  363.         chmod 775 $TARGET_FOLDER/olio_fix.sh
  364.         source $TARGET_FOLDER/olio_fix.sh
  365.         report_success "ALS calibration fixed" "1.0"
  366.     fi
  367.    
  368.     if [ -e $TARGET_FOLDER/power-log.awk ]
  369.     then
  370.         cp $TARGET_FOLDER/power-log.awk /system/vendor/bin/
  371.         chown 1000:1000 /system/vendor/bin/power-log.awk
  372.         chmod 775 /system/vendor/bin/power-log.awk
  373.         report_success "Power log installed" "1.0"
  374.     fi
  375.    
  376.         if [ -e $TARGET_FOLDER/power-log.sh ]
  377.     then
  378.         cp $TARGET_FOLDER/power-log.sh /system/vendor/bin/
  379.         chown 1000:1000 /system/vendor/bin/power-log.sh
  380.         chmod 775 /system/vendor/bin/power-log.sh
  381.         report_success "Power log installed" "1.0"
  382.     fi
  383.    
  384.     if [ -e $LOOKS ]
  385.     then
  386.     rm -rf /data/media/0/olio/looks
  387.     mkdir -p /data/media/0/olio/
  388.     unzip -o $LOOKS -d /data/media/0/olio/
  389.         chown -R 1023:1023 /data/media/0/olio/looks
  390.         chmod -R 775 /data/media/0/olio/looks
  391.     fi
  392.    
  393.     if [ -e $TARGET_FOLDER/vold ]
  394.     then
  395.         cp $TARGET_FOLDER/vold /system/bin/vold
  396.         chown 1000:1000 /system/bin/vold
  397.         chmod 775 /system/bin/vold
  398.         report_success "Vold installed" "1.0"
  399.     fi
  400.  
  401.     if [ -e $TARGET_FOLDER/libJsonSuperPack.so ]
  402.     then
  403.         cp $TARGET_FOLDER/libJsonSuperPack.so /system/lib/libJsonSuperPack.so
  404.         chown 1000:1000 /system/lib/libJsonSuperPack.so
  405.         chmod 775 /system/lib/libJsonSuperPack.so
  406.     fi
  407.  
  408.     if [ -e $TARGET_FOLDER/Experiments-debug.apk ]
  409.     then
  410.         rm /system/app/Experiments-debug.apk
  411.         cp $TARGET_FOLDER/Experiments-debug.apk /system/priv-app/Experiments-debug.apk
  412.         chown 1000:1000 /system/priv-app/Experiments-debug.apk
  413.         chmod 664 /system/priv-app/Experiments-debug.apk
  414.         report_success "Experiments installed" "1.0"
  415.     fi
  416.  
  417.     if [ -e $TARGET_FOLDER/app-debug.apk ]
  418.     then
  419.         cp $TARGET_FOLDER/app-debug.apk /system/priv-app/app-debug.apk
  420.         chown 1000:1000 /system/priv-app/app-debug.apk
  421.         chmod 664 /system/priv-app/app-debug.apk
  422.         report_success "Wake detector installed" "1.0"
  423.     fi
  424.  
  425.     if [ -e $TARGET_FOLDER/bplus.default.so ]
  426.     then
  427.     hw_lib_update $TARGET_FOLDER/bplus.default.so
  428.     fi
  429.  
  430.     if [ -e $TARGET_FOLDER/audio.primary.omap3.so ]
  431.     then
  432.     hw_lib_update $TARGET_FOLDER/audio.primary.omap3.so
  433.     fi
  434.  
  435.     if [ -e $TARGET_FOLDER/libtinyalsa.so ]
  436.     then
  437.     cp $TARGET_FOLDER/libtinyalsa.so /system/lib/libtinyalsa.so
  438.     chown 1000:1000 /system/lib/libtinyalsa.so
  439.     chmod 775 /system/lib/libtinyalsa.so
  440.     fi
  441.  
  442.     if [ -e $TARGET_FOLDER/libbluetooth_jni.so ]
  443.     then
  444.     cp $TARGET_FOLDER/libbluetooth_jni.so /system/lib/libbluetooth_jni.so
  445.     chown 1000:1000 /system/lib/libbluetooth_jni.so
  446.     chmod 775 /system/lib/libbluetooth_jni.so
  447.     fi
  448.  
  449.     if [ -e $TARGET_FOLDER/bt_vendor.conf ]
  450.     then
  451.     cp $TARGET_FOLDER/bt_vendor.conf /system/etc/bluetooth/bt_vendor.conf
  452.     chmod 664 /system/etc/bluetooth/bt_vendor.conf
  453.     chown 1000:1000 /system/etc/bluetooth/bt_vendor.conf
  454.     fi
  455.  
  456.     if [ -e $TARGET_FOLDER/audio_policy.conf ]
  457.     then
  458.     cp $TARGET_FOLDER/audio_policy.conf /system/etc/audio_policy.conf
  459.     chmod 664 /system/etc/audio_policy.conf
  460.     chown 1000:1000 /system/etc/audio_policy.conf
  461.     fi
  462.    
  463.     if [ -e $TARGET_FOLDER/Bluetooth.apk ]
  464.     then
  465.     mkdir -p /system/app-old/
  466.     mv /system/app/Bluetooth.odex /system/app-old/
  467.     cp $TARGET_FOLDER/Bluetooth.apk /system/app/Bluetooth.apk
  468.     chown 1000:1000 /system/app/Bluetooth.apk
  469.     chmod 664 /system/app/Bluetooth.apk
  470.     report_success "Bluetooth apk installed" "1.0"
  471.     fi
  472.  
  473.     if [ -e $BLUETOOTH_CLIENT ]
  474.     then
  475.     rm /system/priv-app/BluetoothClient-debug.apk
  476.     cp $BLUETOOTH_CLIENT /system/priv-app/BluetoothClient-debug.apk
  477.     chown 1000:1000 /system/priv-app/BluetoothClient-debug.apk
  478.     chmod 664 /system/priv-app/BluetoothClient-debug.apk
  479.     report_success "Bluetooth client installed" "1.0"
  480.     fi
  481.    
  482.     if [ -e $POWER_HAL ]
  483.     then
  484.         cp $POWER_HAL /system/lib/hw/power.h1.so
  485.         chown 1000:1000 /system/lib/hw/power.h1.so
  486.         chmod 775 /system/lib/hw/power.h1.so
  487.         report_success "Power HAL installed" "1.0"
  488.     fi
  489.  
  490.     if [ -e $OLIO_FB ]
  491.     then
  492.         cp $OLIO_FB /system/vendor/bin/olio_fb_setup.sh
  493.         chown 1000:1000 /system/vendor/bin/olio_fb_setup.sh
  494.         chmod 775 /system/vendor/bin/olio_fb_setup.sh
  495.         #  If Olio fb setup is included, assume we want a factory reset
  496.         rm /data/data/com.olio.bluetoothancs/databases/*
  497.         rm /data/media/0/olio/bt_client_fb_stamp
  498.         # This can get leftover from a reflash, so make sure it's removed
  499.         rm /system/priv-app/btdebug.apk
  500.         # This needs to be removed so that olio_fb_setup runs again
  501.         rm /system/vendor/olio
  502.         report_success "New Olio boot script installed" "1.0"
  503.     fi
  504.  
  505.     if [ -e $TARGET_FOLDER/framework.jar ]
  506.     then
  507.     mkdir -p /system/framework-old
  508.     mv /system/framework/framework.odex /system/framework-old/
  509.         cp $TARGET_FOLDER/framework.jar /system/framework/framework.jar
  510.         chown 1000:1000 /system/framework/framework.jar
  511.         chmod 664 /system/framework/framework.jar
  512.         report_success "Services jar installed" "1.0"
  513.     fi
  514.  
  515.     if [ -e $SERVICES_JAR ]
  516.     then
  517.     mkdir -p /system/framework-old
  518.     mv /system/framework/services.odex /system/framework-old/
  519.         cp $SERVICES_JAR /system/framework/services.jar
  520.         chown 1000:1000 /system/framework/services.jar
  521.         chmod 664 /system/framework/services.jar
  522.         report_success "Services jar installed" "1.0"
  523.     fi
  524.     # Doing the flash tool before the things that depend on it.
  525.  
  526.     if [ -e $FLASH_IMAGE ]
  527.     then
  528.     echo "OLIO: Installing new flash_image tool."
  529.     mv $FLASH_IMAGE /system/bin/flash_image
  530.     chmod 777 /system/bin/flash_image
  531.     report_success "Installed new flash_image tool" "1.0"
  532.     fi
  533.  
  534.     if [ -e $UIMAGE ]
  535.     then
  536.     flash_image $UIMAGE_PARTITION $UIMAGE
  537.     report_success "$UIMAGE installed" "1.0"
  538.     fi
  539.  
  540.     if [ -e $RAMFS ]
  541.     then
  542.     flash_image $RAMFS_PARTITION $RAMFS
  543.     report_success "$RAMFS installed" "1.0"
  544.     fi
  545.  
  546.     if [ -e $DTB ]
  547.     then
  548.     flash_image $DTB_PARTITION $DTB
  549.     report_success "$DTB installed" "1.0"
  550.     fi
  551.  
  552.     if [ -e $UBOOT ]
  553.     then
  554.     flash_image $UBOOT_PARTITION $UBOOT
  555.     report_success "$UBOOT installed" "1.0"
  556.     fi
  557.  
  558.     if [ -e $DRV2605 ]
  559.     then
  560.     echo "OLIO: Installing new driver for the drv2605."
  561.     mv $DRV2605 /system/vendor/modules/drv2605.ko
  562.     chmod 644 /system/vendor/modules/drv2605.ko
  563.     chown 1000:1000 /system/vendor/modules/drv2605.ko
  564.     report_success "$DRV2605 installed" "1.0"
  565.     fi
  566.  
  567.     if [ -e $ATMEL_CFG ]
  568.     then
  569.     echo "OLIO: Installing new touch firmware."
  570.     mv $ATMEL_CFG /system/vendor/firmware/atmel_cfg.raw
  571.     chmod 644 /system/vendor/firmware/atmel_cfg.raw
  572.     chown 1000:1000 /system/vendor/firmware/atmel_cfg.raw
  573.     # For now steel and sapphire use the same tuning
  574.     cp /system/vendor/firmware/atmel_cfg.raw /system/vendor/firmware/atmel_cfg-2.raw
  575.     chmod 644 /system/vendor/firmware/atmel_cfg-2.raw
  576.     chown 1000:1000 /system/vendor/firmware/atmel_cfg-2.raw
  577.     fi
  578.  
  579.     if [ -e $CHARGER_FW ]
  580.     then
  581.     echo "Can't (yet) install $CHARGER_FW from Android"
  582.     fi
  583.  
  584.     if [ -e $INITRC ]
  585.     then
  586.     echo "OLIO: Installing new init.h1.rc file."
  587.     mv $INITRC /init.h1.rc
  588.     chmod 644 /init.h1.rc
  589.     chown 1000:1000 /init.h1.rc
  590.     fi
  591.    
  592.     if [ -e $TARGET_FOLDER/init.rc ]
  593.     then
  594.     echo "OLIO: Installing new init.h1.rc file."
  595.     mv $TARGET_FOLDER/init.rc /init.rc
  596.     chmod 644 /init.rc
  597.     chown 1000:1000 /init.rc
  598.     fi
  599.  
  600.     echo "$0: Applications Installed, now doing firmware"
  601.  
  602. }
  603.  
  604.  
  605. # ---------------------------------------------------------------------------
  606. # Main stuff
  607. #
  608. # Android packages: Experiments-debug.apk == com.olio.experiments
  609. #                   app-debug.apk         == com.olio.wakedetector
  610.  
  611.  
  612. # Just in case...
  613.  
  614. # Make sure device stays awake during the update. This will get cleared out after a reboot
  615.  
  616. echo m > /sys/power/wake_lock
  617. set_path_permissions
  618.  
  619. install_software_android  # Add Olio stuff
  620. android_apks_remove       # Remove cruft
  621.  
  622. # ONLY IF THERE'S LINUX STUFF:
  623.  
  624. if [ "$UPDATE_LINUX" == "true" ]
  625. then
  626.     check_md5_sum
  627.     linux_update_prep
  628.     update_bootlines
  629. fi
  630.  
  631. create_version_log
  632.  
  633. # Remove this script from FS
  634.  
  635. echo "$0: Cleaning up"
  636.  
  637. echo "$0: Turning on Dalvik"
  638.  
  639. stop
  640. setprop persist.sys.dalvik.vm.lib libart.so
  641. setprop persist.sys.strictmode.visual 0
  642. setprop persist.sys.strictmode.disable 1
  643.  
  644. echo "$0: Done, now rebooting"
  645.  
  646. if [ -e $RAMFS ]
  647. then
  648.     fw_setenv bootcmd run ramfdtboot
  649.     rm $TARGET_FOLDER/*
  650. else
  651.     mv $TARGET_FOLDER/update_2.sh $TARGET_FOLDER/../update.sh
  652.     rm $TARGET_FOLDER/*
  653.     mv $TARGET_FOLDER/../update.sh $TARGET_FOLDER/update.sh
  654. fi
  655.  
  656. sync
  657.  
  658. sleep 20
  659.  
  660. /system/bin/reboot
Add Comment
Please, Sign In to add comment