-
Notifications
You must be signed in to change notification settings - Fork 15
/
install.sh
executable file
·113 lines (96 loc) · 3.55 KB
/
install.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
# Configure package manager here if necessary:
if [[ -x "$(command -v yay)" ]]; then
PKGMAN="yay -S --noconfirm"
elif [[ -x "$(command -v /bin/paru)" ]]; then
PKGMAN="paru -S --noconfirm"
else
echo "ERROR: Couldn't find a package manager, please install either yay or paru"
exit 1
fi
# Configure makepkg here if necessary:
MAKEPKG="makepkg -si --noconfirm"
error() {
echo "ERROR: ${1}"
exit 1
}
build_and_install() {
echo "# Build and install package: ${1}"
pushd "${1}" || error "Not a directory: ${1}"
eval "${MAKEPKG}"
local installation_state="${?}"
popd || error "Unable to go back to working directory."
if [[ "${installation_state}" -eq 0 ]]; then
echo "=> SUCCESS"
else
error "Failed to install: ${1}"
fi
}
# ------------------------------------------------------------------------------
# Need to have the correct headers installed before proceding with DKMS
if pacman -Qq linux >/dev/null 2>/dev/null; then
eval "${PKGMAN} --needed linux-headers"
fi
if pacman -Qq linux-lts >/dev/null 2>/dev/null; then
eval "${PKGMAN} --needed linux-lts-headers"
fi
if pacman -Qq linux-zen >/dev/null 2>/dev/null; then
eval "${PKGMAN} --needed linux-zen-headers"
fi
if pacman -Qq linux-hardened >/dev/null 2>/dev/null; then
eval "${PKGMAN} --needed linux-hardened-headers"
fi
# General dependencies to make the webcam work:
general_dependencies="intel-ivsc-driver-dkms-git intel-ivsc-firmware icamerasrc-git gst-plugin-pipewire"
build_and_install "intel-ipu6-dkms-git"
# Install dependency for intel-ipu6ep-camera-hal-git
echo "# Install dependency for intel-ipu6ep-camera-hal-git"
if eval "${PKGMAN} intel-ipu6ep-camera-bin"; then
echo "=> SUCCESS"
else
error "# Failed to install: intel-ipu6ep-camera-bin"
fi
build_and_install "intel-ipu6ep-camera-hal-git"
build_and_install "v4l2-looback-dkms-git"
build_and_install "v4l2-relayd"
# Install general dependencies
echo "# Install general dependencies"
if eval "${PKGMAN} ${general_dependencies}"; then
echo "=> SUCCESS"
else
error "Failed to install: ${general_dependencies}"
fi
echo "# Enable: v4l2-relayd.service"
if sudo systemctl enable v4l2-relayd.service; then
echo "=> SUCCESS"
else
error "# Failed to enable: v4l2-relayd.service"
fi
echo "# Start: v4l2-relayd.service"
if sudo systemctl start v4l2-relayd.service; then
echo "=> SUCCESS"
else
error "Failed to start: v4l2-relayd.service"
fi
if [[ "${1}" == "--workaround" ]]; then
echo "# Creating /etc/systemd/system/v4l2-relayd.service.d/override.conf"
sudo mkdir -p /etc/systemd/system/v4l2-relayd.service.d && \
echo -e "[Service]\nExecStart=\nExecStart=/bin/sh -c 'DEVICE=\$(grep -l -m1 -E \"^\${CARD_LABEL}\$\" /sys/devices/virtual/video4linux/*/name | cut -d/ -f6); exec /usr/bin/v4l2-relayd -i \"\${VIDEOSRC}\" \$\${SPLASHSRC:+-s \"\${SPLASHSRC}\"} -o \"appsrc name=appsrc caps=video/x-raw,format=\${FORMAT},width=\${WIDTH},height=\${HEIGHT},framerate=\${FRAMERATE} ! videoconvert ! video/x-raw,format=YUY2 ! v4l2sink name=v4l2sink device=/dev/\$\${DEVICE}\"'" | \
if sudo tee /etc/systemd/system/v4l2-relayd.service.d/override.conf >/dev/null ; then
echo "=> SUCCESS"
else
error "Failed to write: /etc/systemd/system/v4l2-relayd.service.d/override.conf"
fi
echo "# Reloading systemd daemon"
if sudo systemctl daemon-reload; then
echo "=> SUCCESS"
else
error "Failed to reload systemd daemon"
fi
echo "# Restart: v4l2-relayd.service"
if sudo systemctl restart v4l2-relayd.service; then
echo "=> SUCCESS"
else
error "Failed to restart: v4l2-relayd.service"
fi
fi