From 91e27c051bebc554fbd5ad5f86047733d73f3817 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Thu, 11 May 2017 20:06:44 +0300 Subject: [PATCH 1/3] add gpio.sh handy bash command --- board/common/overlay/usr/bin/gpio.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 board/common/overlay/usr/bin/gpio.sh diff --git a/board/common/overlay/usr/bin/gpio.sh b/board/common/overlay/usr/bin/gpio.sh new file mode 100755 index 0000000000..c291e7c6c8 --- /dev/null +++ b/board/common/overlay/usr/bin/gpio.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +GPIO=$1 + +usage() { + echo "Usage: $0 [0|1]" 1>&2 + exit 1 +} + +test -z "$GPIO" && usage +test -e /sys/class/gpio/gpio$GPIO || echo $GPIO > /sys/class/gpio/export + +if [ -n "$2" ]; then + echo out > /sys/class/gpio/gpio$GPIO/direction + echo $2 > /sys/class/gpio/gpio$GPIO/value +else + echo in > /sys/class/gpio/gpio$GPIO/direction + cat /sys/class/gpio/gpio$GPIO/value +fi + From a414a9d714fed1b72717ac7f036970f004028fae Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Tue, 23 May 2017 22:40:56 +0300 Subject: [PATCH 2/3] fwupdate: add upgrade command --- board/common/overlay/sbin/fwupdate | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/board/common/overlay/sbin/fwupdate b/board/common/overlay/sbin/fwupdate index 2f55c500ca..a7795d361f 100755 --- a/board/common/overlay/sbin/fwupdate +++ b/board/common/overlay/sbin/fwupdate @@ -11,6 +11,7 @@ function exit_usage() { echo " fwupdate flashboot (flashes the boot partition from extracted image)" echo " fwupdate flashreboot (prepares for reboot + root partititon flash)" echo " fwupdate status (shows the current firmware updating status; see below)" + echo " fwupdate upgrade (performs all the operations necessary for upgrading)" echo "" echo "Statuses:" echo " idle" @@ -321,6 +322,27 @@ function show_status() { echo "idle" } + +#### upgrade #### + +function do_upgrade() { + echo "upgrading to $1" + + set -e + + do_download "$2" + show_status + + do_extract + show_status + + flash_boot + show_status + + flash_reboot +} + + function new_version() { cat $FW_DIR/$VER_FILE } @@ -340,7 +362,7 @@ case "$1" in exit_usage fi - do_download $2 + do_download "$2" show_status ;; @@ -362,6 +384,14 @@ case "$1" in show_status ;; + upgrade) + if [ -z "$2" ]; then + exit_usage + fi + + do_upgrade "$2" + ;; + *) exit_usage ;; From a2773f700b94762006620156f0be13a0b1983140 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 28 May 2017 19:50:08 +0300 Subject: [PATCH 3/3] generalize admin password mechanism --- board/common/overlay/etc/init.d/S21passwd | 5 ++++- board/common/overlay/etc/init.d/adminpw | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/board/common/overlay/etc/init.d/S21passwd b/board/common/overlay/etc/init.d/S21passwd index 45fdde678b..03a1d7d6b6 100755 --- a/board/common/overlay/etc/init.d/S21passwd +++ b/board/common/overlay/etc/init.d/S21passwd @@ -15,7 +15,10 @@ case "$1" in fi # set root and admin passwords - password=$(/etc/init.d/adminpw) + password="" + if [ -x /etc/init.d/adminpw ]; then + password=$(/etc/init.d/adminpw) + fi msg_begin "Setting root password" rm -f /data/etc/shadow+ diff --git a/board/common/overlay/etc/init.d/adminpw b/board/common/overlay/etc/init.d/adminpw index 8e45d40e1c..2dbbc137ca 100755 --- a/board/common/overlay/etc/init.d/adminpw +++ b/board/common/overlay/etc/init.d/adminpw @@ -1,6 +1,4 @@ #!/bin/bash -if [ -f /data/etc/motion.conf ]; then - cat /data/etc/motion.conf | grep admin_password | grep -v _hash | cut -d ' ' -f 3- -fi +# echo your admin password here