Try to pick user login shell instead of assuming bash

The trick is inspired by `gnome-session`.
This commit is contained in:
Kirill Chibisov
2023-10-17 18:46:03 +04:00
committed by Ivan Molodetskikh
parent 58f6b30325
commit f3e04981d8
+12 -1
View File
@@ -1,4 +1,15 @@
#!/bin/bash --login
#!/bin/sh
if [ -n "$SHELL" ] &&
grep -q "$SHELL" /etc/shells &&
! (echo "$SHELL" | grep -q "false") &&
! (echo "$SHELL" | grep -q "nologin"); then
if [ "$1" != '-l' ]; then
exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"
else
shift
fi
fi
# Make sure there's no already running session.
if systemctl --user -q is-active niri.service; then