@@ -235,6 +235,16 @@ if [[ -n "${user_cmd}" ]]; then
235
235
exit 1
236
236
fi
237
237
238
+ # Set proper ownership on the virtio-ports devices
239
+ if [[ -n " ${virtme_user} " ]]; then
240
+ chown ${virtme_user} :${virtme_user} \
241
+ /dev/virtio-ports/virtme.stdin \
242
+ /dev/virtio-ports/virtme.stdout \
243
+ /dev/virtio-ports/virtme.stderr \
244
+ /dev/virtio-ports/virtme.dev_stdout \
245
+ /dev/virtio-ports/virtme.dev_stderr
246
+ fi
247
+
238
248
# Fix /dev/stdout and /dev/stderr.
239
249
#
240
250
# When using a virtio serial port, the EBUSY error can occur if multiple
@@ -277,6 +287,9 @@ if [[ -z "$consdev" ]]; then
277
287
log " can't deduce console device"
278
288
exec bash --login # At least try to be helpful
279
289
fi
290
+ if [[ -n " ${virtme_user} " ]]; then
291
+ chown ${virtme_user} :${virtme_user} /dev/${consdev}
292
+ fi
280
293
281
294
deallocvt
282
295
@@ -312,6 +325,15 @@ install -d -m 0755 /tmp/roothome
312
325
export HOME=/tmp/roothome
313
326
mount --bind /tmp/roothome /root
314
327
328
+ # $XDG_RUNTIME_DIR defines the base directory relative to which user-specific
329
+ # non-essential runtime files and other file objects (such as sockets, named
330
+ # pipes, ...) should be stored.
331
+ export XDG_RUNTIME_DIR=/run/user/$( id -u ${virtme_user} )
332
+ mkdir -p $XDG_RUNTIME_DIR
333
+ if [[ -n " ${virtme_user} " ]]; then
334
+ chown ${virtme_user} :${virtme_user} $XDG_RUNTIME_DIR
335
+ fi
336
+
315
337
# Bring up a functioning shell on the console. This is a bit magical:
316
338
# We have no controlling terminal because we're attached to a fake
317
339
# console device (probably something like /dev/console), which can't
@@ -323,11 +345,6 @@ if [[ -n "${virtme_stty_con}" ]]; then
323
345
stty ${virtme_stty_con} < " /dev/$consdev "
324
346
fi
325
347
if [[ -n " ${virtme_graphics} " ]]; then
326
- # Initialize XDG_RUNTIME_DIR (required to provide a better compatibility
327
- # with graphic apps).
328
- export XDG_RUNTIME_DIR=/run/user/$( id -u ${virtme_user} )
329
- mkdir -p $XDG_RUNTIME_DIR
330
-
331
348
# Check if we need to enable the sound system.
332
349
if cat /proc/cmdline | grep -q -E ' (^| )virtme.sound($| )' ; then
333
350
pre_exec_cmd=" $( dirname $0 ) /virtme-sound-script"
@@ -340,7 +357,6 @@ if [[ -n "${virtme_graphics}" ]]; then
340
357
echo -e " ${pre_exec_cmd} \nexec /tmp/.virtme-script" > ${xinit_rc}
341
358
chmod +x /tmp/.virtme-script
342
359
if [[ -n " ${virtme_user} " ]]; then
343
- chown ${virtme_user} :${virtme_user} $XDG_RUNTIME_DIR
344
360
chown ${virtme_user} :${virtme_user} ${xinit_rc}
345
361
# Try to fix permissions on the virtual consoles, we are starting X
346
362
# directly here so we may need extra permissions on the tty devices.
0 commit comments