Advertisement
Guest User

Untitled

a guest
Aug 25th, 2018
137
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/system/bin/sh
  2.  
  3. check_root()
  4. {
  5. if [ `id -u` != 0 ]; then
  6. echo "Must be root to run script!"
  7. exit 1
  8. fi
  9. }
  10.  
  11. mount_partitions()
  12. {
  13. echo "Mounting partitions..."
  14. mkdir /mnt/boot
  15. mount -o rw -t vfat /dev/block/mmcblk0p1 /mnt/boot
  16. }
  17.  
  18. change_properties()
  19. {
  20. echo "Changing properties..."
  21. sed -i 's/hdmi_group=1/hdmi_group=2/' /mnt/boot/config.txt
  22. sed -i 's/hdmi_mode=4/hdmi_mode=87/' /mnt/boot/config.txt
  23. sed -i 's/disable_overscan=1/hdmi_cvt=800 480 60 6 0 0 0/' /mnt/boot/config.txt
  24. }
  25.  
  26. restore_properties()
  27. {
  28. echo "Restoring properties..."
  29. sed -i 's/hdmi_group=2/hdmi_group=1/' /mnt/boot/config.txt
  30. sed -i 's/hdmi_mode=47/hdmi_mode=4/' /mnt/boot/config.txt
  31. sed -i 's/hdmi_cvt=800 480 60 6 0 0 0/disable_overscan=1/' /mnt/boot/config.txt
  32. }
  33.  
  34. unmount_partitions()
  35. {
  36. echo "Unmounting partitions..."
  37. umount /mnt/boot
  38. rm -rf /mnt/boot
  39. }
  40.  
  41. finish()
  42. {
  43. echo "Done, reboot device!"
  44. exit 0
  45. }
  46.  
  47. if [ -z $1 ]; then
  48. check_root
  49. mount_partitions
  50. change_properties
  51. unmount_partitions
  52. finish
  53. elif [ $1 == "restore" ]; then
  54. check_root
  55. mount_partitions
  56. restore_properties
  57. unmount_partitions
  58. finish
  59. else
  60. echo "Usage: rpi3-display.sh [restore]"
  61. fi
Advertisement
RAW Paste Data Copied
Advertisement