mirror of
https://github.com/riptidewave93/UNVR-NAS.git
synced 2025-03-09 15:40:13 +00:00
feat: Add UNVR support (#11)
* Move partition mounts to PARTLABEL instead of paths * Add dual firmware building support, specify the build type using the BOARD env var when using make * Update to Unifi 4.0.5 pre-release firmware * Move ulcmd init to be our "user interface" setup script, will handle LEDs on the UNVR4 in the future * Update README with updated instructions * Add udev rules to support /dev/boot which is what Unifi uses for some stupid reason for their emmc. This is required for systemd to mount correctly after chroot. * Fixup small bugs found along the way
This commit is contained in:
parent
8e2262e121
commit
3f90bd2357
18 changed files with 210 additions and 79 deletions
26
overlay/filesystem/usr/lib/init/boot/ubnt-ulcmd.sh
Executable file
26
overlay/filesystem/usr/lib/init/boot/ubnt-ulcmd.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
# ULCMD wrapper, used to start ulcmd on the UNVR Pro, or setup the status LED on the UNVR-4
|
||||
|
||||
case "$(ubnteeprom -systeminfo -key shortname)" in
|
||||
"UNVRPRO")
|
||||
# Is ulcmd running already? if so, assume it was not done via systemd so let's
|
||||
# kill and respawn as this is our systemd entry script for the service, and we
|
||||
# need to have it foregrounded as we act as the "daemon" here.
|
||||
if ! pidof -q ulcmd; then
|
||||
killall ulcmd
|
||||
fi
|
||||
# Restart ulcmd
|
||||
exec ulcmd
|
||||
;;
|
||||
"UNVR4")
|
||||
# TODO: LED setup (2=white, 1=blue) against /sys/class/leds/ulogo_ctrl
|
||||
# Start our "daemon" loop so systemd stays happy
|
||||
while true; do
|
||||
sleep 3600
|
||||
done
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/python3
|
||||
import os
|
||||
from functools import lru_cache
|
||||
|
||||
"""
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# Support for Ubiquiti /dev/boot devices with udev
|
||||
|
||||
ACTION=="remove", GOTO="persistent_emmc"
|
||||
|
||||
SUBSYSTEM!="block", GOTO="persistent_emmc"
|
||||
KERNEL!="boot*", GOTO="persistent_emmc"
|
||||
|
||||
# For partitions import parent disk ID_* information, except ID_FS_*.
|
||||
#
|
||||
# This is particularly important on media where a filesystem superblock and
|
||||
# partition table are found on the same level, e.g. common Linux distro ISO
|
||||
# installation media.
|
||||
#
|
||||
# In the case where a partition device points to the same filesystem that
|
||||
# was detected on the parent disk, the ID_FS_* information is already
|
||||
# present on the partition devices as well as the parent, so no need to
|
||||
# propagate it. In the case where the partition device points to a different
|
||||
# filesystem, merging the parent ID_FS_ properties would lead to
|
||||
# inconsistencies, so we avoid doing so.
|
||||
ENV{DEVTYPE}=="partition", \
|
||||
IMPORT{parent}="ID_[!F]*", IMPORT{parent}="ID_", \
|
||||
IMPORT{parent}="ID_F[!S]*", IMPORT{parent}="ID_F", \
|
||||
IMPORT{parent}="ID_FS[!_]*", IMPORT{parent}="ID_FS"
|
||||
|
||||
# probe filesystem metadata of disks
|
||||
KERNEL!="sr*|mmcblk[0-9]boot[0-9]", IMPORT{builtin}="blkid"
|
||||
|
||||
# by-label/by-uuid links (filesystem metadata)
|
||||
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
|
||||
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
|
||||
|
||||
# by-path
|
||||
ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id"
|
||||
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
|
||||
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
|
||||
|
||||
# by-partlabel/by-partuuid links (partition metadata)
|
||||
IMPORT{builtin}="blkid"
|
||||
ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}"
|
||||
ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}"
|
||||
|
||||
LABEL="persistent_emmc"
|
Loading…
Add table
Add a link
Reference in a new issue