[PATCH 1/2] Don't use tmux for inst.noshell (#1058607)
Will Woods
wwoods at redhat.com
Mon Feb 24 16:20:48 UTC 2014
If we're running with 'inst.noshell', then the system administrator
wants this to be a hands-off install. And tmux is very hands-on, and it
lets you create new shells if you want. So we should probably disable
tmux when running with inst.noshell.
This patch moves the logic for deciding when to use
anaconda-direct.service or anaconda.service out of anaconda-generator
and into the units themselves. The behavior should mostly be the same as
before, i.e.:
anaconda-direct on s390, otherwise anaconda+tmux
But now we want to use anaconda-direct instead of tmux when we have
inst.noshell, so it's:
anaconda-direct on s390 or with inst.noshell, otherwise anaconda+tmux
---
data/systemd/anaconda-direct.service | 4 ++++
data/systemd/anaconda-generator | 8 ++------
data/systemd/anaconda-tmux at .service | 10 ++++++++--
data/systemd/anaconda.service | 2 ++
data/systemd/anaconda.target | 1 +
5 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/data/systemd/anaconda-direct.service b/data/systemd/anaconda-direct.service
index 61df8ca..b4c1f2f 100644
--- a/data/systemd/anaconda-direct.service
+++ b/data/systemd/anaconda-direct.service
@@ -6,6 +6,10 @@ Description=the anaconda installation program
Wants=instperf.service rsyslog.service systemd-udev-settle.service NetworkManager.service
After=instperf.service rsyslog.service systemd-udev-settle.service NetworkManager.service anaconda-sshd.service
Requires=anaconda.service
+# TODO: use ConditionArchitecture in systemd v210 or later
+ConditionPathIsDirectory=|/sys/hypervisor/s390
+ConditionKernelCommandLine=|noshell
+ConditionKernelCommandLine=|inst.noshell
[Service]
Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr
diff --git a/data/systemd/anaconda-generator b/data/systemd/anaconda-generator
index 1118d92..3f89fcf 100755
--- a/data/systemd/anaconda-generator
+++ b/data/systemd/anaconda-generator
@@ -24,12 +24,8 @@ while [ -f /sys/class/tty/$tty/active ]; do
done
consoletty="$tty"
-# put anaconda on the real console if not s390x, otherwise put anaconda direct
-if [ $(uname -m) = "s390x" ]; then
- ln -sf $systemd_dir/anaconda-direct.service $target_dir/
-else
- service_on_tty anaconda-tmux at .service $consoletty
-fi
+# put anaconda's tmux session on the console
+service_on_tty anaconda-tmux at .service $consoletty
# put a shell on the first virtualization console we find
for tty in hvc0 hvc1 xvc0 hvsi0 hvsi1 hvsi2; do
diff --git a/data/systemd/anaconda-tmux at .service b/data/systemd/anaconda-tmux at .service
index 0b83765..6a3f58d 100644
--- a/data/systemd/anaconda-tmux at .service
+++ b/data/systemd/anaconda-tmux at .service
@@ -2,14 +2,20 @@
Description=Anaconda Text Console
Requires=anaconda.service
After=anaconda.target anaconda.service
+ConditionKernelCommandLine=!noshell
+ConditionKernelCommandLine=!inst.noshell
[Service]
-Type=simple
+Type=idle
WorkingDirectory=/root
Environment=LANG=en_US.UTF-8
ExecStartPre=/usr/bin/echo -e \033%G
ExecStart=/usr/bin/tmux -u attach -t anaconda
-StandardInput=tty-force
+StandardInput=tty
+StandardOutput=tty
TTYPath=/dev/%I
TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
Restart=always
+RestartSec=0
diff --git a/data/systemd/anaconda.service b/data/systemd/anaconda.service
index 0946d70..e6104b0 100644
--- a/data/systemd/anaconda.service
+++ b/data/systemd/anaconda.service
@@ -1,6 +1,8 @@
[Unit]
Description=Anaconda
After=anaconda.target
+ConditionKernelCommandLine=!noshell
+ConditionKernelCommandLine=!inst.noshell
[Service]
Type=forking
diff --git a/data/systemd/anaconda.target b/data/systemd/anaconda.target
index 77e42ff..a5c8724 100644
--- a/data/systemd/anaconda.target
+++ b/data/systemd/anaconda.target
@@ -8,3 +8,4 @@ Wants=rsyslog.service
Wants=systemd-udev-settle.service
Wants=NetworkManager.service
Wants=plymouth-quit.service plymouth-quit-wait.service
+Wants=anaconda-direct.service anaconda.service
--
1.8.5.3
More information about the anaconda-patches
mailing list