diff options
author | jogo <jogo@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-27 12:39:42 +0000 |
---|---|---|
committer | jogo <jogo@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2013-03-27 12:39:42 +0000 |
commit | 7cfbb153cd8b407bb7da221569390ee41d218acf (patch) | |
tree | 9680968a10bdb9003dab60de2cbeee62520e996e /package/base-files | |
parent | b515082051f34b53a75c6902bb89b75e8ce81898 (diff) |
base-files: firstboot: only ask for confirmation on TTY
Also allow '-y' to force the reset.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36133 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/sbin/firstboot | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/package/base-files/files/sbin/firstboot b/package/base-files/files/sbin/firstboot index e7c0851ad..06b64c313 100755 --- a/package/base-files/files/sbin/firstboot +++ b/package/base-files/files/sbin/firstboot @@ -21,11 +21,13 @@ if [ "${0##*/}" = "firstboot" ]; then if [ "$1" = "switch2jffs" ]; then boot_run_hook switch2jffs else - local input + if [ -t 0 ] && [ "$1" != "-y" ]; then + local input - echo -n "firstboot will erase all settings and remove any installed packages. Are you sure? [N/y]" - read input - [ "$input" = "y" ] || [ "$input" = "Y" ] || return 0 + echo -n "firstboot will erase all settings and remove any installed packages. Are you sure? [N/y]" + read input + [ "$input" = "y" ] || [ "$input" = "Y" ] || return 0 + fi if [ -n "$jffs" ]; then reset_has_fo=true |