-
Notifications
You must be signed in to change notification settings - Fork 24
/
ds64-shell
executable file
·44 lines (41 loc) · 1.54 KB
/
ds64-shell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Open a shell for (remote) user inside the container
#
# Copyright (c) 2019-20 sakaki <[email protected]>
# License: GPL 3.0+
# NO WARRANTY
DS64_CONF="/etc/ds64.conf"
[[ -s "${DS64_CONF}" ]] && source "${DS64_CONF}"
DS64_NAME="${DS64_NAME:-debian-buster-64}"
DS64_DIR="${DS64_DIR:-/var/lib/machines/${DS64_NAME}}"
GUEST_LIBGL_ALWAYS_SOFTWARE="${GUEST_LIBGL_ALWAYS_SOFTWARE:-1}"
HAS_ZENITY=0
which zenity &>/dev/null && [[ ${DISPLAY:-} ]] && HAS_ZENITY=1
check-aarch64 || exit 1
if ! ds64-running; then
if ((HAS_ZENITY==1)); then
zenity --error --no-wrap \
--title="Error starting 64-bit shell" \
--text="The ${DS64_NAME} container is not running!\nPlease start it and try again." \
--timeout=5
else
>&2 echo -e "Error starting 64-bit shell: the ${DS64_NAME} container is not running!\nPlease start it and try again."
fi
exit 1
fi
U="$(id --user)"
exec sudo machinectl shell \
--setenv=QT_AUTO_SCREEN_SCALE_FACTOR=0 \
--setenv=DISPLAY="${DISPLAY}" \
--setenv=XAUTHORITY="${XAUTHORITY}-allhosts" \
--setenv=LIBGL_ALWAYS_SOFTWARE="${GUEST_LIBGL_ALWAYS_SOFTWARE}" \
--setenv=USER="${USER}" \
--setenv=LANG="${LANG}" \
--setenv=NO_AT_BRIDGE="${NO_AT_BRIDGE}" \
--setenv=DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/${U}/bus" \
--setenv=PULSE_SERVER="unix:/run/host-user/${U}/pulse/native" \
--setenv=PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games" \
--uid=${U} \
"${DS64_NAME}" \
/bin/bash \
"${@}"