From 9e600a56a7b0f8ae1ac9fb02cff6f9fc8e055bc1 Mon Sep 17 00:00:00 2001 From: Yuichiro Tsuchiya Date: Fri, 5 Jul 2019 19:48:25 +0900 Subject: [PATCH 1/2] Add set -eu to all files --- LCD-hdmi | 2 ++ LCD24-3A+-show | 2 ++ LCD24-show | 2 ++ LCD28-show | 2 ++ LCD32-show | 2 ++ LCD35-show | 2 ++ LCD5-show | 2 ++ LCD7B-show | 2 ++ LCD7C-show | 2 ++ MHS24-show | 3 +++ MHS32-show | 2 ++ MHS35-show | 2 ++ MHS40-show | 2 ++ MIS35-show | 3 +++ MPI3508-show | 3 +++ MPI3508_480_320-show | 3 +++ MPI3510-show | 3 +++ MPI4008-show | 2 ++ MPI5001-show | 2 ++ rotate.sh | 3 +++ system_backup.sh | 3 +++ system_restore.sh | 3 +++ 22 files changed, 52 insertions(+) diff --git a/LCD-hdmi b/LCD-hdmi index e5764de..af03113 100755 --- a/LCD-hdmi +++ b/LCD-hdmi @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + dev=`grep -rn "Option" /usr/share/X11/xorg.conf.d/99-fbturbo.conf | grep "fbdev" |awk -F\" '{printf $4}'` if test "$dev" = "/dev/fb0";then echo "The system is already output for HDMI and does not need to be set up any more" diff --git a/LCD24-3A+-show b/LCD24-3A+-show index 82b3feb..67be514 100755 --- a/LCD24-3A+-show +++ b/LCD24-3A+-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/LCD24-show b/LCD24-show index aea1bb1..1b004d3 100755 --- a/LCD24-show +++ b/LCD24-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/LCD28-show b/LCD28-show index aea1bb1..1b004d3 100755 --- a/LCD28-show +++ b/LCD28-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/LCD32-show b/LCD32-show index aea1bb1..1b004d3 100755 --- a/LCD32-show +++ b/LCD32-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/LCD35-show b/LCD35-show index e91b98b..1522b79 100755 --- a/LCD35-show +++ b/LCD35-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/LCD5-show b/LCD5-show index 99aa565..033f0a9 100755 --- a/LCD5-show +++ b/LCD5-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh root_dev=`grep -oPr "root=[^\s]*" /boot/cmdline.txt | awk -F= '{printf $NF}'` diff --git a/LCD7B-show b/LCD7B-show index 319c831..1b1daf7 100755 --- a/LCD7B-show +++ b/LCD7B-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh root_dev=`grep -oPr "root=[^\s]*" /boot/cmdline.txt | awk -F= '{printf $NF}'` diff --git a/LCD7C-show b/LCD7C-show index 8d62f50..b9862e0 100755 --- a/LCD7C-show +++ b/LCD7C-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh root_dev=`grep -oPr "root=[^\s]*" /boot/cmdline.txt | awk -F= '{printf $NF}'` diff --git a/MHS24-show b/MHS24-show index cbb9cd3..f8d7c91 100755 --- a/MHS24-show +++ b/MHS24-show @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo mkdir -p /etc/X11/xorg.conf.d sudo cp ./usr/mhs24-overlay.dtb /boot/overlays/ diff --git a/MHS32-show b/MHS32-show index 69f5a06..a830d63 100755 --- a/MHS32-show +++ b/MHS32-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/MHS35-show b/MHS35-show index ad387bb..0d698e8 100755 --- a/MHS35-show +++ b/MHS35-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/MHS40-show b/MHS40-show index 5588cd0..5e3782b 100755 --- a/MHS40-show +++ b/MHS40-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh if [ -f /etc/X11/xorg.conf.d/40-libinput.conf ]; then diff --git a/MIS35-show b/MIS35-show index b2d2dcf..466957f 100755 --- a/MIS35-show +++ b/MIS35-show @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo mkdir -p /etc/X11/xorg.conf.d sudo cp ./usr/mis35-overlay.dtb /boot/overlays/ diff --git a/MPI3508-show b/MPI3508-show index 6fcfdfa..d1e416f 100755 --- a/MPI3508-show +++ b/MPI3508-show @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + sudo ./system_backup.sh hw_version=`tr -d '\0' < /proc/device-tree/model` diff --git a/MPI3508_480_320-show b/MPI3508_480_320-show index c3c2829..2ef9777 100755 --- a/MPI3508_480_320-show +++ b/MPI3508_480_320-show @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + sudo rm -rf /etc/X11/xorg.conf.d/40-libinput.conf sudo cp -rf ./boot/config-35-480X320.txt /boot/config.txt if [ -b /dev/mmcblk0p7 ]; then diff --git a/MPI3510-show b/MPI3510-show index 2ce75b7..8f1562b 100755 --- a/MPI3510-show +++ b/MPI3510-show @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + sudo cp -rf ./boot/config-35DPI.txt /boot/config.txt #sudo cp ./usr/bcm2709-rpi-2-b.dtb /boot/ #sudo cp ./usr/bcm2710-rpi-3-b.dtb /boot/ diff --git a/MPI4008-show b/MPI4008-show index 38d7b6c..ab99d0e 100755 --- a/MPI4008-show +++ b/MPI4008-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh root_dev=`grep -oPr "root=[^\s]*" /boot/cmdline.txt | awk -F= '{printf $NF}'` diff --git a/MPI5001-show b/MPI5001-show index 8efdb95..42f391c 100755 --- a/MPI5001-show +++ b/MPI5001-show @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + sudo ./system_backup.sh root_dev=`grep -oPr "root=[^\s]*" /boot/cmdline.txt | awk -F= '{printf $NF}'` diff --git a/rotate.sh b/rotate.sh index 2b7a30b..2235791 100755 --- a/rotate.sh +++ b/rotate.sh @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + cur_dir=`pwd` if [ ! -f $cur_dir/.have_installed ]; then echo "Please install the LCD driver first" diff --git a/system_backup.sh b/system_backup.sh index 5acdab1..750f512 100755 --- a/system_backup.sh +++ b/system_backup.sh @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + if [ ! -d "./.system_backup" ]; then sudo mkdir ./.system_backup fi diff --git a/system_restore.sh b/system_restore.sh index 46edb0f..29f27f8 100755 --- a/system_restore.sh +++ b/system_restore.sh @@ -1,4 +1,7 @@ #!/bin/bash + +set -eu + #Just finished the system, no need to restore if [ ! -d "./.system_backup" ]; then echo "The system is the original version and does not need to be restored" From 86592bc8d296b6e3902d727c6a7a565270e55dd4 Mon Sep 17 00:00:00 2001 From: Yuichiro Tsuchiya Date: Thu, 18 Jul 2019 13:19:12 +0900 Subject: [PATCH 2/2] Update system_backup.sh for type command to work correctly even when set -e --- system_backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system_backup.sh b/system_backup.sh index 750f512..bf85711 100755 --- a/system_backup.sh +++ b/system_backup.sh @@ -58,7 +58,7 @@ sudo cp -rf /etc/inittab ./.system_backup sudo rm -rf /etc/inittab fi -type fbcp > /dev/null 2>&1 +type fbcp > /dev/null 2>&1 && : if [ $? -eq 0 ]; then sudo touch ./.system_backup/have_fbcp sudo rm -rf /usr/local/bin/fbcp