This commit is contained in:
Alex 2024-12-12 17:54:27 -04:00
parent 8a74720fb5
commit 1ec4b47da6

View File

@ -106,7 +106,7 @@ spirilink-driver:
.PHONY: configure-spirilink .PHONY: configure-spirilink
configure-spirilink: configure-spirilink:
@echo "Configuring SpiriLink interface as spir0..." @echo "Configuring SpiriLink interface as spir0..."
spirilink_iface=$$(iw dev | awk '$$1=="Interface"{print $$2}' | head -n 1); \ @spirilink_iface=$$(iw dev | awk '$$1=="Interface"{print $$2}' | head -n 1); \
if [ -z "$$spirilink_iface" ]; then \ if [ -z "$$spirilink_iface" ]; then \
echo "Error: SpiriLink interface not detected."; \ echo "Error: SpiriLink interface not detected."; \
exit 1; \ exit 1; \
@ -114,23 +114,24 @@ configure-spirilink:
echo "Detected SpiriLink interface: $$spirilink_iface"; \ echo "Detected SpiriLink interface: $$spirilink_iface"; \
mac_address=$$(cat /sys/class/net/$$spirilink_iface/address); \ mac_address=$$(cat /sys/class/net/$$spirilink_iface/address); \
echo "Detected MAC address: $$mac_address"; \ echo "Detected MAC address: $$mac_address"; \
echo 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="'$$mac_address'", NAME="spir0"' | $(SUDO) tee /etc/udev/rules.d/99-spirilink.rules; \ echo 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="'$$mac_address'", NAME="spir0"' | $(SUDO) tee /etc/udev/rules.d/99-spirilink.rules > /dev/null; \
$(SUDO) udevadm control --reload-rules; \ $(SUDO) udevadm control --reload-rules; \
$(SUDO) udevadm trigger; $(SUDO) udevadm trigger;
@echo "Adding spir0 to unmanaged devices in NetworkManager..." @echo "Adding spir0 to unmanaged devices in NetworkManager..."
$(SUDO) mkdir -p /etc/NetworkManager @$(SUDO) mkdir -p /etc/NetworkManager
$(SUDO) touch /etc/NetworkManager/NetworkManager.conf @$(SUDO) touch /etc/NetworkManager/NetworkManager.conf
@if ! grep -q "\[keyfile\]" /etc/NetworkManager/NetworkManager.conf; then \ @if ! grep -q "\[keyfile\]" /etc/NetworkManager/NetworkManager.conf; then \
echo "[keyfile]" | $(SUDO) tee -a /etc/NetworkManager/NetworkManager.conf > /dev/null; \ echo "[keyfile]" | $(SUDO) tee -a /etc/NetworkManager/NetworkManager.conf > /dev/null; \
fi fi
@if ! grep -q "unmanaged-devices=interface-name:spir0" /etc/NetworkManager/NetworkManager.conf; then \ @if ! grep -q "unmanaged-devices=interface-name:spir0" /etc/NetworkManager/NetworkManager.conf; then \
echo "unmanaged-devices=interface-name:spir0" | $(SUDO) tee -a /etc/NetworkManager/NetworkManager.conf > /dev/null; \ echo "unmanaged-devices=interface-name:spir0" | $(SUDO) tee -a /etc/NetworkManager/NetworkManager.conf > /dev/null; \
fi fi
$(SUDO) systemctl restart NetworkManager @$(SUDO) systemctl restart NetworkManager
@echo "Configuring wifibroadcast default interface..." @echo "Configuring wifibroadcast default interface..."
$(SUDO) bash -c 'echo "WFB_NICS=\"spir0\"" > /etc/default/wifibroadcast' @$(SUDO) bash -c 'echo "WFB_NICS=\"spir0\"" > /etc/default/wifibroadcast'
@echo "SpiriLink configuration complete." @echo "SpiriLink configuration complete."
# Install SpiriLink software # Install SpiriLink software
.PHONY: spirilink-software .PHONY: spirilink-software
spirilink-software: spirilink-software: