-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvirtual_display_setup.sh
More file actions
executable file
·63 lines (56 loc) · 1.98 KB
/
Copy pathvirtual_display_setup.sh
File metadata and controls
executable file
·63 lines (56 loc) · 1.98 KB
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
#!/usr/bin/env bash
prompt_reboot() {
echo
read -rn1 -p "Press 'r' to reboot now, or any other key to exit: " REBOOT_KEY
echo
if [ "$REBOOT_KEY" = "r" ]; then
echo "Rebooting..."
systemctl reboot
else
echo "Reboot skipped."
fi
}
echo "=== Checking prerequisites ==="
missing_pkgs=()
for pkg in ruby-devel rubygems rpm-build; do
if ! rpm -q "$pkg" >/dev/null 2>&1; then
missing_pkgs+=("$pkg")
fi
done
if [ "${#missing_pkgs[@]}" -gt 0 ]; then
echo "Layering missing packages (${missing_pkgs[*]}) via rpm-ostree (requires reboot)..."
rpm-ostree install "${missing_pkgs[@]}"
echo "Reboot required to apply layered packages."
prompt_reboot
exit 0
else
echo "All prerequisite RPM packages already installed; skipping rpm-ostree install."
fi
echo "Checking for fpm gem..."
if ! gem list -i fpm >/dev/null 2>&1; then
echo "Installing fpm gem with sudo..."
sudo gem install fpm
else
echo "fpm gem already installed; skipping."
fi
echo "=== Make and install the rpm package from the bin ==="
mkdir -p ~/edid_patch/usr/lib/firmware/edid
read -rp "Enter the EDID .bin filename (e.g., my_edid.bin): " EDID_BIN
EDID_NAME="$(basename "$EDID_BIN")"
echo "Copying $EDID_BIN into firmware/edid as $EDID_NAME..."
cp "$EDID_BIN" ~/edid_patch/usr/lib/firmware/edid/"$EDID_NAME"
cd ~/edid_patch
echo "Building edid_patch RPM with fpm..."
fpm -s dir -t rpm -n edid_patch .
echo "Resetting development layered patches before installing"
rpm-ostree reset
echo "Installing generated RPM (update name if it differs)..."
rpm-ostree install $EDID_NAME
echo "=== Update initramfs with custom EDID ==="
echo "install_items+=\" /usr/lib/firmware/edid/$EDID_NAME \"" | sudo tee /etc/dracut.conf.d/99-local.conf
rpm-ostree initramfs --enable
echo "=== Add kernel argument and reboot ==="
rpm-ostree kargs --append="drm.edid_firmware=HDMI-A-1:edid/$EDID_NAME"
rpm-ostree kargs --append="video=HDMI-A-1:e"
echo "[Optional] You can specify a specific output port such as HDMI-A-1:edid/$EDID_NAME"
prompt_reboot