summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2012-02-23 15:53:35 +0200
committerTimo Teräs <timo.teras@iki.fi>2012-02-23 15:53:35 +0200
commit92d6e99144a4b7227ad29c69fe10e97478bc63bb (patch)
tree5374e66bf8d619d28bcf3ad53a6c3c03f1c37115 /src
parentba3ee3f86396f05123f732da7c7879c8ed016c9d (diff)
downloadapk-tools-92d6e99144a4b7227ad29c69fe10e97478bc63bb.tar.gz
apk-tools-92d6e99144a4b7227ad29c69fe10e97478bc63bb.tar.bz2
apk-tools-92d6e99144a4b7227ad29c69fe10e97478bc63bb.tar.xz
apk-tools-92d6e99144a4b7227ad29c69fe10e97478bc63bb.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/apk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/apk.c b/src/apk.c
index 4fce15b..8fb0924 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -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);
}