Having a shell on tty2 or hvc1 is convenient.. if you have tty2 or hvc1. But not everyone does - think s390, or POWER, or remote virt guests.
Instead, let's run anaconda inside a tmux session, with windows pre-configured with a shell, anaconda.log, program.log, and storage.log.
We set this up by using two services: anaconda.service, and anaconda-tmux@.service.
anaconda.service starts anaconda (and starts watching the logs) inside a detached tmux session, on screen 1. It also starts a shell on screen 2, and 'tail -F' on anaconda.log, storage.log, and program.log on screens 3, 4, and 5.
anaconda-tmux@.service will be instantiated on the default console (tty1, hvc0, ttyS0, whatever) and connect to the running tmux session, which will show screen 1 - and thus the text UI (if any) appears.
Exiting tmux just restarts anaconda-tmux@.service, which reconnects to the existing session, so you can't accidentally kill the installer by leaving tmux. --- anaconda | 5 ----- data/Makefile.am | 3 +++ data/systemd/Makefile.am | 3 ++- data/systemd/anaconda-cleanup-initramfs.service | 2 +- data/systemd/anaconda-generator | 2 +- data/systemd/anaconda-tmux@.service | 15 +++++++++++++++ data/systemd/anaconda.service | 9 +++++++++ data/systemd/anaconda.target | 1 - data/systemd/anaconda@.service | 13 ------------- data/tmux.conf | 16 ++++++++++++++++ 10 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 data/systemd/anaconda-tmux@.service create mode 100644 data/systemd/anaconda.service delete mode 100644 data/systemd/anaconda@.service create mode 100644 data/tmux.conf
diff --git a/anaconda b/anaconda index 15d13e6..59bcd9e 100755 --- a/anaconda +++ b/anaconda @@ -717,11 +717,6 @@ if __name__ == "__main__": " (pre-release)" if not product.isFinal else "", )
- # to set UTF8 mode on the terminal, we need LANG to be set usefully - if os.environ.get("LANG", "C") == "C": - os.environ['LANG'] = DEFAULT_LANG - print "\033%G" # UTF8 power go! - import gettext _ = lambda x: gettext.ldgettext("anaconda", x)
diff --git a/data/Makefile.am b/data/Makefile.am index cc82ae5..5708281 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -29,6 +29,9 @@ langdir = $(datadir)/$(PACKAGE_NAME) lang_DATA = lang-names dist_lang_DATA = lang-table
+tmuxdir = $(datadir)/$(PACKAGE_NAME) +dist_tmux_DATA = tmux.conf + if IS_S390 shareddir = $(datadir)/$(PACKAGE_NAME) dist_shared_SCRIPTS = linuxrc.s390 diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am index 8579ece..96bd8f0 100644 --- a/data/systemd/Makefile.am +++ b/data/systemd/Makefile.am @@ -20,8 +20,9 @@ systemddir = /lib/systemd/system generatordir = /lib/systemd/system-generators
-dist_systemd_DATA = anaconda@.service \ +dist_systemd_DATA = anaconda.service \ anaconda.target \ + anaconda-tmux@.service \ anaconda-shell@.service \ instperf.service \ anaconda-sshd.service \ diff --git a/data/systemd/anaconda-cleanup-initramfs.service b/data/systemd/anaconda-cleanup-initramfs.service index 1d10bfc..cc49357 100644 --- a/data/systemd/anaconda-cleanup-initramfs.service +++ b/data/systemd/anaconda-cleanup-initramfs.service @@ -1,6 +1,6 @@ [Unit] Description=Clean Up Initramfs -Before=anaconda@.service +Before=anaconda.service ConditionPathIsDirectory=/run/initramfs/usr/lib/modules
[Service] diff --git a/data/systemd/anaconda-generator b/data/systemd/anaconda-generator index cb47040..71e35e7 100755 --- a/data/systemd/anaconda-generator +++ b/data/systemd/anaconda-generator @@ -25,7 +25,7 @@ done consoletty="$tty"
# put anaconda on the real console -service_on_tty anaconda@.service $consoletty +service_on_tty anaconda-tmux@.service $consoletty
# put a shell on tty2 and the first virtualization console we find for tty in tty2 hvc0 hvc1 xvc0 hvsi0 hvsi1 hvsi2; do diff --git a/data/systemd/anaconda-tmux@.service b/data/systemd/anaconda-tmux@.service new file mode 100644 index 0000000..0b83765 --- /dev/null +++ b/data/systemd/anaconda-tmux@.service @@ -0,0 +1,15 @@ +[Unit] +Description=Anaconda Text Console +Requires=anaconda.service +After=anaconda.target anaconda.service + +[Service] +Type=simple +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 +TTYPath=/dev/%I +TTYReset=yes +Restart=always diff --git a/data/systemd/anaconda.service b/data/systemd/anaconda.service new file mode 100644 index 0000000..5629e00 --- /dev/null +++ b/data/systemd/anaconda.service @@ -0,0 +1,9 @@ +[Unit] +Description=Anaconda +After=anaconda.target + +[Service] +Type=forking +Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin LANG=en_US.UTF-8 +WorkingDirectory=/root +ExecStart=/usr/bin/tmux -u -f /etc/anaconda-tmux.conf start diff --git a/data/systemd/anaconda.target b/data/systemd/anaconda.target index 9a95c66..597adfd 100644 --- a/data/systemd/anaconda.target +++ b/data/systemd/anaconda.target @@ -3,7 +3,6 @@ Description=Anaconda System Services Requires=basic.target After=basic.target AllowIsolate=yes -Before=anaconda@.service Wants=anaconda-cleanup-initramfs.service Wants=instperf.service Wants=rsyslog.service diff --git a/data/systemd/anaconda@.service b/data/systemd/anaconda@.service deleted file mode 100644 index 03ecabb..0000000 --- a/data/systemd/anaconda@.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Anaconda -After=anaconda.target - -[Service] -Environment=HOME=/root MALLOC_CHECK_=2 MALLOC_PERTURB_=204 PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin -Type=oneshot -WorkingDirectory=/root -ExecStart=/usr/sbin/anaconda -StandardInput=tty-force -TTYPath=/dev/%I -TTYReset=yes -TimeoutSec=0 diff --git a/data/tmux.conf b/data/tmux.conf new file mode 100644 index 0000000..3639fcb --- /dev/null +++ b/data/tmux.conf @@ -0,0 +1,16 @@ +# tmux.conf for the anaconda environment +set-option -s exit-unattached off +set-option -g base-index 1 + +new-session -s anaconda -n main "anaconda" + +set-option set-remain-on-exit on +set-option status-right "" +set-option status-right-length 0 + +new-window -d -n shell "bash --login" +new-window -d -n log "tail -F /tmp/anaconda.log" +new-window -d -n storage-log "tail -F /tmp/storage.log" +new-window -d -n program-log "tail -F /tmp/program.log" + +detach-client -s anaconda
Having a shell on tty2 or hvc1 is convenient.. if you have tty2 or hvc1. But not everyone does - think s390, or POWER, or remote virt guests.
Instead, let's run anaconda inside a tmux session, with windows pre-configured with a shell, anaconda.log, program.log, and storage.log.
We set this up by using two services: anaconda.service, and anaconda-tmux@.service.
anaconda.service starts anaconda (and starts watching the logs) inside a detached tmux session, on screen 1. It also starts a shell on screen 2, and 'tail -F' on anaconda.log, storage.log, and program.log on screens 3, 4, and 5.
anaconda-tmux@.service will be instantiated on the default console (tty1, hvc0, ttyS0, whatever) and connect to the running tmux session, which will show screen 1 - and thus the text UI (if any) appears.
Exiting tmux just restarts anaconda-tmux@.service, which reconnects to the existing session, so you can't accidentally kill the installer by leaving tmux.
Do you know if tmux does anything crazy by default like also listening on the network, or anything like that? This patch looks fine and it is a good idea. I just want to make sure there's no lurking surprises.
- Chris
On Thu, 2012-07-19 at 10:25 -0400, Chris Lumens wrote:
Do you know if tmux does anything crazy by default like also listening on the network, or anything like that? This patch looks fine and it is a good idea. I just want to make sure there's no lurking surprises.
AFAICT tmux doesn't know anything about the network at all. It just deals with terminals.
It's in the OpenBSD base system, if that gives you some idea about how surprise-free it should be.
-w
anaconda-patches@lists.fedorahosted.org