Skip to content

Commit

Permalink
Set up .Xauthority-allhosts for :0 user if possible on first run
Browse files Browse the repository at this point in the history
Allows immediate use if the user is booted under an aarch64 kernel
already
  • Loading branch information
sakaki- committed Oct 18, 2019
1 parent b5e7323 commit e79fd9e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ postinst() {
# but do not start them - require reboot (since we may
# still be under a 32-bit kernel etc. on first
# install)
local S
local S U UXA
for S in "${SERVICES[@]}"; do
systemctl enable "${S}"
done
Expand All @@ -140,6 +140,15 @@ postinst() {
systemctl start "${S}" || true
done
systemctl start "systemd-nspawn@${DS64_NAME}.service" || true
# bit of a hack, but if a user is logged into the :0 X-server,
# generate their .Xauthority-allhosts file now, so
# graphical apps will work immediately
if U="$(who | grep '(:0)' | cut -d' ' -f1 | head -n1)" && [[ ! -z "${U}" ]]; then
UXA="/home/${U}/.Xauthority"
if [[ -s "${UXA}" && ! -s "${UXA}-allhosts" ]]; then
su --login "${U}" -c "XAUTHORITY=${UXA} DISPLAY=:0 unify-xauth" &>/dev/null || true
fi
fi
else
echo "You need a 64-bit kernel to use ${DS64_NAME} (yours is 32-bit)." >&2
echo >&2
Expand Down

0 comments on commit e79fd9e

Please sign in to comment.