-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup
executable file
·38 lines (32 loc) · 1.24 KB
/
setup
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
#!/bin/bash
ID=$(id -ur)
if [ $ID != 0 ]; then
echo "This script should be run as root (when used in console mode), use sudo." >&2
exit 1
fi
UPDATEVM=`qubes-prefs --force-root updatevm`
USBVM="sys-usb"
if [ -z "$UPDATEVM" ]; then
echo "UpdateVM not set, exiting"
exit 1
fi
# Create directories and copy files
mkdir -p /usr/share/qubes-fwupd/
cp -R src/ /usr/share/qubes-fwupd/
cp -R test/ /usr/share/qubes-fwupd/
qvm-run --nogui -q -u root $UPDATEVM 'mkdir /usr/lib/qubes-fwupd'
qvm-run --nogui -q -u root $USBVM 'mkdir /usr/share/qubes-fwupd'
# Create symlink
rm /bin/qubes-fwupdmgr
ln -s /usr/share/qubes-fwupd/src/qubes_fwupdmgr.py /bin/qubes-fwupdmgr
# Copy script to updateVM
cat src/updatevm/fwupd-download-updates.sh | qvm-run --pass-io -u root $UPDATEVM \
'cat > /usr/lib/qubes-fwupd/fwupd-download-updates.sh'
qvm-run --nogui -q -u root $UPDATEVM \
'chmod +x /usr/lib/qubes-fwupd/fwupd-download-updates.sh' || exit 1
# Copy script to sys-usb
cat src/usbvm/fwupd_usbvm_validate.py | qvm-run --pass-io -u root $USBVM \
'cat > /usr/share/qubes-fwupd/fwupd_usbvm_validate.py'
qvm-run --nogui -q -u root $USBVM \
'chmod +x /usr/share/qubes-fwupd/fwupd_usbvm_validate.py' || exit 1
echo "fwupd wrapper installed successfully"