apk: /etc/apk/interactive enables interactive mode for tty sessions

In case someone prefers extra quesions while running apk in a
terminal. The file is always from the real root; not from --root
so that we will not accidentally enable interactive mode when in
initramfs bootstrap.
cute-signatures
Timo Teräs 2012-02-23 15:53:35 +02:00
parent ba3ee3f863
commit 92d6e99144
1 changed files with 4 additions and 1 deletions

View File

@ -255,8 +255,11 @@ static void on_sigwinch(int s)
static void setup_terminal(void)
{
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
if (isatty(STDOUT_FILENO) && isatty(STDERR_FILENO) && isatty(STDIN_FILENO))
if (isatty(STDOUT_FILENO) && isatty(STDERR_FILENO) && isatty(STDIN_FILENO)) {
apk_flags |= APK_PROGRESS;
if (access("/etc/apk/interactive", F_OK) == 0)
apk_flags |= APK_INTERACTIVE;
}
signal(SIGWINCH, on_sigwinch);
}