summaryrefslogtreecommitdiff
path: root/src/ubpasswd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ubpasswd.sh')
-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))
;;