zsh + coreutils + unclutter + amixer + xterm (Arch Linux)
Peguei a resposta do @ TheDoctor e corri com ela. Esta versão possui muitas melhorias e é 99% convincente para um usuário experiente (eu) no meu sistema Arch Linux. Eu uso o Zsh, pois ele possui um bom suporte de matriz e número de ponto flutuante.
Dependências: feh, unclutter, amixer, zsh, xterm
Melhorias:
1) Use o número impresso na primeira coluna por dmesg, que é o tempo desde a inicialização (por exemplo, [0,000000]) para determinar o tempo de espera. Sem isso, parece muito irreal na minha máquina. Esses horários são analisados antes do loop (em uma chamada inicial para suspensão), pois a análise dentro do loop é muito lenta.
2) Não imprima linhas onde o tempo de inicialização é maior que 16 segundos. Esse número específico depende da máquina, mas o objetivo é evitar a impressão de coisas dmesg posteriores que sejam inseridas / removidas de pen drives, etc. e não estejam relacionadas à inicialização.
3) Faça tudo isso em uma janela de terminal em tela cheia com fundo preto e texto em branco. Parabéns ao Mechanical Snail por este truque usado em: Faça uma imagem PNG com "Hello World!" com APIs de programação, no menor código possível
4) Silencie o áudio no desligamento, restaure o volume quando o script terminar.
5) Oculte o cursor do mouse, restaure quando o script terminar.
6) Mostre as telas iniciais do BIOS e do Syslinux.
Correr com: xterm -fu -fg white -bg black -e '/ usr / bin / zsh fake-reboot.sh'
Código:
#!/usr/bin/zsh
# Remove (undisplay) the mouse pointer
unclutter -idle 0 -jitter 255 &
# Since there is no easily-accessible (i.e. without being root) shutdown log, we
# fake these messages.
echo "The system is going down for maintenance NOW."
sleep 2.0
echo "[21656.404742] systemd[1]: Shutting down."
echo "[21656.404742] systemd[1]: Stopping Session 1 of user `id -u -n`."
echo "[21656.404742] systemd[1]: Stopped Session 1 of user `id -u -n`."
echo "[21656.404742] systemd[1]: Stopping Sound Card."
# For added effect, store volume and then mute sound
volume=`amixer -- sget Master | awk -F'[][]' 'END{print $2}'`
amixer -- sset Master 0% &> /dev/null
echo "[21656.404742] systemd[1]: Stopped target Sound Card."
sleep 0.5
echo "[21656.919792] systemd[1]: Stopping system-systemd\x2dfsck.slice."
echo "[21656.919792] systemd[1]: Removed slice system-systemd\x2dfsck.slice."
echo "[21656.919792] systemd[1]: Stopping system-netctl\x2difplugd.slice."
echo "[21656.919793] systemd[1]: Removed slice system-netctl\x2difplugd.slice."
echo "[21656.919793] systemd[1]: Stopping User Manager for UID `id -u`..."
sleep 0.7
echo "[21657.624741] systemd[1]: Stopping Graphical Interface."
echo "[21657.624742] systemd[1]: Stopped target Graphical Interface."
echo "[21657.624745] systemd[1]: Stopping Multi-User System."
sleep 0.9
echo "[21658.606561] systemd[1]: Stopped target Multi-User System."
echo "[21658.606562] systemd[1]: Stopping Paths."
echo "[21658.606562] systemd[1]: Stopped D-Bus System Message Bus."
echo "[21658.606562] systemd[1]: Stopped target Paths."
echo "[21658.606568] systemd[1]: Stopping Timers."
echo "[21658.606568] systemd[1]: Stopped target Timers."
echo "[21658.606568] systemd[1]: Stopping Sockets."
echo "[21658.606568] systemd[1]: Stopped target Sockets."
echo "[21658.606568] systemd[1]: Starting Shutdown."
echo "[21658.606571] systemd[1]: Reached target Shutdown."
echo "[21658.606571] systemd[1]: Starting Exit the Session..."
echo "[21658.606571] systemd[1]: Received SIGRTMIN+26 from PID 10988 (kill)."
echo "[21658.606571] systemd[1]: Deactivated swap."
sleep 0.4
echo "[21659.001741] systemd[1]: Starting Unmount All Filesystems."
echo "[21659.001742] systemd[1]: Unmounted /home."
echo "[21659.001742] systemd[1]: Reached target Unmount All Filesystems."
echo "[21659.001742] systemd[1]: Stopping Remount Root and Kernel File Systems..."
echo "[21659.001742] systemd[1]: Stopped Remount Root and Kernel File Systems."
echo "[21659.001743] systemd[1]: Reached target Shutdown."
echo "[21659.001743] systemd[1]: Starting Final Step."
echo "[21659.001743] systemd[1]: Reached target Final Step."
echo "[21659.001754] systemd[1]: Shutting down."
sleep 0.3
echo "[21659.304341] systemd-journal[250]: Journal stopped"
sleep 0.2
echo "System halted."
sleep 2
clear
sleep 1
# Get the BIOS splash screen and display it
wget http://pvv.ntnu.no/~asmunder/bios.jpg &> /dev/null
feh -Z -x -F -N --force-aliasing bios.jpg &
pid=$! # Store PID of Feh, so we can kill it later
# While showing the BIOS splash, use the time to parse dmesg output into arrays
tim=`dmesg | awk '{print $2}' | sed 's/]//' | grep "[0-9][0-9][0-9][0-9][0-9]"`
tim=($=tim)
dmsg=("${(@f)$(dmesg)}")
sleep 2.5
kill $pid
sleep 0.5
# Get the Syslinux splash and display it
wget http://pvv.ntnu.no/~asmunder/syslinux.png &> /dev/null
feh -Z -x -F -N --force-aliasing syslinux.png &
pid=$!
sleep 1.3
kill $pid
# Loop through the arrays we created. Calculate the time we have to wait before
# displaying this line. If the wait time is less than 0.1 sec, we skip waiting.
T1=0.0
T2=0.0
n=0
for d in $dmsg; do
T1=$T2
T2=${tim[$n]}
((dT = $T2-$T1))
if (( $dT > 0.1));then
sleep $dT
fi
echo $d
if (( $T2 > 16.0 )); then
break
fi
((n=$n+1))
done
sleep 1
clear
# It's normally agetty that parses /etc/issue and handles escape codes in a
# special way. Thus we skip the first line of /etc/issue and do that manually.
echo "Arch Linux "`uname -r`" (tty1)"
tail -n +2 /etc/issue
echo `hostname`" login:"
sleep 10
# Reset the mouse pointer so it is visible again
unclutter -idle 5 -jitter 0 &
# Reset the audio volume
amixer -- sset Master $volume &> /dev/null