Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/system/bin/sh
- check_root()
- {
- if [ `id -u` != 0 ]; then
- echo "Must be root to run script!"
- exit 1
- fi
- }
- mount_partitions()
- {
- echo "Mounting partitions..."
- mkdir /mnt/boot
- mount -o rw -t vfat /dev/block/mmcblk0p1 /mnt/boot
- }
- change_properties()
- {
- echo "Changing properties..."
- sed -i 's/hdmi_group=1/hdmi_group=2/' /mnt/boot/config.txt
- sed -i 's/hdmi_mode=4/hdmi_mode=87/' /mnt/boot/config.txt
- sed -i 's/disable_overscan=1/hdmi_cvt=800 480 60 6 0 0 0/' /mnt/boot/config.txt
- }
- restore_properties()
- {
- echo "Restoring properties..."
- sed -i 's/hdmi_group=2/hdmi_group=1/' /mnt/boot/config.txt
- sed -i 's/hdmi_mode=47/hdmi_mode=4/' /mnt/boot/config.txt
- sed -i 's/hdmi_cvt=800 480 60 6 0 0 0/disable_overscan=1/' /mnt/boot/config.txt
- }
- unmount_partitions()
- {
- echo "Unmounting partitions..."
- umount /mnt/boot
- rm -rf /mnt/boot
- }
- finish()
- {
- echo "Done, reboot device!"
- exit 0
- }
- if [ -z $1 ]; then
- check_root
- mount_partitions
- change_properties
- unmount_partitions
- finish
- elif [ $1 == "restore" ]; then
- check_root
- mount_partitions
- restore_properties
- unmount_partitions
- finish
- else
- echo "Usage: rpi3-display.sh [restore]"
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement