Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ISC Open Source Projects
Kea
Commits
30368501
Verified
Commit
30368501
authored
Apr 05, 2022
by
Andrei Pavel
🐧
Browse files
[
#2293
] assume a default for kea-admin on non-interactive shells
parent
3116ab4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/admin/kea-admin.in
View file @
30368501
...
...
@@ -413,8 +413,17 @@ check_file_overwrite () {
if
[
-e
"
${
file
}
"
]
then
echo
"Output file,
$file
, exists and will be overwritten."
echo
"Do you wish to continue? (y/n)"
read
-r
ans
echo
"Do you wish to continue? (y/N)"
# Ask for an answer only on an interactive shell to prevent blocking in
# automated or non-interactive scenarios where the answer defaults to no.
if
test
-t
0
;
then
read
-r
ans
else
log_warning
'Non-interactive tty detected. Assuming no.'
ans
=
'N'
fi
if
[
"
${
ans
}
"
!=
"y"
]
then
echo
"
$command
aborted by user."
...
...
@@ -845,13 +854,18 @@ do
shift
db_password
=
${
1
}
else
# Otherwise read from standard input while hiding feedback to
# the terminal.
printf
'Password: '
stty
-echo
read
-r
db_password
stty echo
printf
'\n'
# If it's an interactive shell...
if
test
-t
0
;
then
# Read from standard input while hiding feedback to the terminal.
printf
'Password: '
stty
-echo
read
-r
db_password
stty echo
printf
'\n'
else
log_warning
'Non-interactive tty detected. Assuming empty password.'
db_password
=
''
fi
fi
;;
# Specify database name
...
...
Andrei Pavel
🐧
@andrei
mentioned in merge request
!1626 (merged)
·
May 23, 2022
mentioned in merge request
!1626 (merged)
mentioned in merge request !1626
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment