diff --git a/rootfs/gen b/rootfs/gen index 5fa7495..1bafdbe 100755 --- a/rootfs/gen +++ b/rootfs/gen @@ -66,6 +66,7 @@ if [[ -e "$PWD/build/qrexec/agent/qrexec-agent" ]]; then export LD_LIBRARY_PATH="$PWD/build/padist/lib:$PWD/build/padist/lib/pulseaudio:$PWD/build/qrexec/libqrexec" fi inst build/padist/usr/local/bin/pulseaudio /bin/pulseaudio + inst build/padist/usr/local/bin/pactl /bin/pactl for mod in build/padist/lib/module-*.so; do inst "$mod" "/lib/$(basename "$mod")" done @@ -88,7 +89,7 @@ inst build/qrexec/agent/qrexec-agent /bin/qrexec-agent inst build/qrexec/agent/qrexec-client-vm /bin/qrexec-client-vm inst build/qrexec/agent/qrexec-fork-server /bin/qrexec-fork-server echo "root:x:0:0:root:/root:/bin/sh" > "$rootfs_dir"/etc/passwd -echo "bus/usb/00[1-9]/00[2-9] 0:0 660 *sh /bin/qusb.sh" > "$rootfs_dir"/etc/mdev.conf +echo "bus/usb/00[1-9]/00[2-9] 0:0 660 *sh /bin/qusb.sh" > "$rootfs_dir"/etc/mdev.conf fi for i in write watch rm ls list; do @@ -107,6 +108,12 @@ inst "rootfs/qemu-ifup" "/etc/qemu-ifup" inst "rootfs/qemu-ifdown" "/etc/qemu-ifdown" inst "rootfs/init" "/init" +mkdir -p "$rootfs_dir"/etc/qubes-rpc +inst "rootfs/qubes.SetAudioVM" /etc/qubes-rpc/qubes.SetAudioVM + +### Uncomment only for development +#inst "rootfs/qubes.VMShell" /etc/qubes-rpc/qubes.VMShell + mkdir "$rootfs_dir"/lib.new (find "$rootfs_dir"/{,usr/,usr/local/}lib{,64} -type f -print0 || true) | xargs -0r mv -t "$rootfs_dir"/lib.new/ rm -rf "${rootfs_dir:?}"/{,usr/,usr/local/}lib{,64} diff --git a/rootfs/init b/rootfs/init index 0a11b41..7d5b698 100755 --- a/rootfs/init +++ b/rootfs/init @@ -21,7 +21,7 @@ vm_path=$(xenstore-read "/local/domain/$domid/vm") dm_args=$(xenstore-read $(xenstore-list -p "$vm_path/image/dm-argv"|sort)) usb_args= -if test -e /bin/qrexec-agent; then +if test -e /bin/qrexec-agent; then usb_args=$'-device\nnec-usb-xhci,id=xhci' mkdir -p /var/run/qubes USER=root qrexec-agent & @@ -29,7 +29,7 @@ if test -e /bin/qrexec-agent; then mdev -d fi -# add audiodev conf to cmdline and run pulseaudio +# add audiodev conf to cmdline and run pulseaudio audio_model=$(echo "$dm_args" | sed -n '/^\(intel-hda\|ac97\|adlib\|es1370\|cs4231a\|gus\|sb16\)$/ {p}') if [ -n "$audio_model" ] ; then model_args= @@ -40,6 +40,10 @@ if [ -n "$audio_model" ] ; then pa_args=$'-audiodev\npa,id=qemupa,server=unix:/tmp/pa.sock'$model_args; pulseaudio --use-pid-file=no --daemonize=no --exit-idle-time=-1 -n \ -L "module-native-protocol-unix auth-anonymous=1 socket=/tmp/pa.sock" \ + -L "module-always-sink" \ + -L "module-always-source" \ + -L "module-null-sink" \ + -L "module-null-source" \ -L "module-vchan-sink domid=0" & fi diff --git a/rootfs/qubes.SetAudioVM b/rootfs/qubes.SetAudioVM new file mode 100755 index 0000000..1e6b1e8 --- /dev/null +++ b/rootfs/qubes.SetAudioVM @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +# Default to dom0 +domid="${1:-0}" + +export PULSE_SERVER=unix:/tmp/pa.sock + +pactl unload-module module-vchan-sink +pactl load-module module-vchan-sink domid="$domid" + +pactl set-default-sink vchan_output +pactl set-default-source vchan_input diff --git a/rootfs/qubes.VMShell b/rootfs/qubes.VMShell new file mode 100755 index 0000000..1e15837 --- /dev/null +++ b/rootfs/qubes.VMShell @@ -0,0 +1,2 @@ +#!/bin/sh +exec /bin/sh