2013-01-23 17:28:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# anaconda-generator: generate services needed for anaconda operation
|
|
|
|
|
|
|
|
# set up dirs
|
|
|
|
systemd_dir=/lib/systemd/system
|
|
|
|
target_dir=$systemd_dir/anaconda.target.wants
|
|
|
|
mkdir -p $target_dir
|
|
|
|
|
|
|
|
# create symlink anaconda.target.wants/SERVICE@TTY.service
|
|
|
|
service_on_tty() {
|
|
|
|
local service="$1" tty="$2"
|
|
|
|
local service_instance="${service/@.service/@$tty.service}"
|
|
|
|
ln -sf $systemd_dir/$service $target_dir/$service_instance
|
|
|
|
}
|
|
|
|
|
|
|
|
# find the real tty for /dev/console
|
|
|
|
tty="console"
|
|
|
|
while [ -f /sys/class/tty/$tty/active ]; do
|
|
|
|
tty=$(< /sys/class/tty/$tty/active)
|
|
|
|
tty=${tty##* } # last item in the list
|
|
|
|
done
|
|
|
|
consoletty="$tty"
|
|
|
|
|
2015-03-23 11:36:12 +00:00
|
|
|
# put anaconda's tmux session on the console
|
|
|
|
service_on_tty anaconda-tmux@.service $consoletty
|
2013-01-23 17:28:19 +00:00
|
|
|
|
2015-03-23 11:36:12 +00:00
|
|
|
# put a shell on the first virtualization console we find
|
|
|
|
for tty in hvc0 hvc1 xvc0 hvsi0 hvsi1 hvsi2; do
|
2013-01-23 17:28:19 +00:00
|
|
|
[ "$tty" = "$consoletty" ] && continue
|
|
|
|
if [ -d /sys/class/tty/$tty ]; then
|
|
|
|
service_on_tty anaconda-shell@.service $tty
|
|
|
|
fi
|
|
|
|
done
|