summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-06-04 12:57:00 -0500
committerJohn Klug <john.klug@multitech.com>2018-06-04 12:57:00 -0500
commit2c0dd783f8909a47875d0269b2ea6c6c1165ae8e (patch)
tree6da2cf761e1528da39ffe3d54f8bb0ee67680c6e /src
parent05706393a5787bdae3dd7859d3a2716b486ebc50 (diff)
downloadmts-id-eeprom-2c0dd783f8909a47875d0269b2ea6c6c1165ae8e.tar.gz
mts-id-eeprom-2c0dd783f8909a47875d0269b2ea6c6c1165ae8e.tar.bz2
mts-id-eeprom-2c0dd783f8909a47875d0269b2ea6c6c1165ae8e.zip
Allow mts-ubpasswd to determine if feature is preset, or if U-Boot currently requires a password.0.3.7
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ubpasswd.sh24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/ubpasswd.sh b/src/ubpasswd.sh
index 9fea52d..65e35eb 100755
--- a/src/ubpasswd.sh
+++ b/src/ubpasswd.sh
@@ -27,6 +27,10 @@ usage() {
echo "ubpasswd [-u] [-d] [-s salt] [password]"
echo " -u means u-boot only (not UNIX password)"
echo " -s salt is user supplied salt"
+ echo " -r returns true if U-Boot password"
+ echo " is currently required"
+ echo " -f returns true if U-Boot password"
+ echo " feature is available."
echo " -d debug"
echo " password is a user supplied password"
echo "A salt not supplied is generated."
@@ -37,8 +41,17 @@ usage() {
((hassalt=0))
((debug=0))
((upwd=0))
-while getopts ":dus:" opt; do
+while getopts ":dfrs:u" opt; do
case $opt in
+ f)
+ if ! /bin/fgrep "mts password protected" /dev/mtdblock2 >/dev/null 2>&1; then
+ echo "U-Boot does not support password protection."
+ exit 1
+ else
+ echo "U-Boot supports password protection."
+ exit 0
+ fi
+ ;;
u)
((ubonly=1))
;;
@@ -46,6 +59,15 @@ while getopts ":dus:" opt; do
salt="$OPTARG"
((hassalt=1))
;;
+ r)
+ if /usr/bin/u-boot printenv mtsp >/dev/null 2>&1 ; then
+ echo "U-Boot password protection is on"
+ exit 0
+ else
+ echo "U-Boot password protection is off"
+ exit 1
+ fi
+ ;;
d)
((debug=1))
;;