优化:USB UUID 自动挂载 + frpc local_ip 修复 + usb-storage-uas
- 新增 usb-automount 包:开机按 UUID 自动挂载 USB 盘,解决设备名漂移 - 修复 frpc-config:local_ip 改为 192.168.100.1(适配 --network=host 容器) - r6c.config 增加 kmod-usb-storage / kmod-usb-storage-uas(UAS 提高 USB 性能) - r6c.config 增加 CONFIG_PACKAGE_usb-automount - 清理仓库脏文件
This commit is contained in:
parent
d169cefa76
commit
ed0f4e0251
@ -14,42 +14,42 @@ config conf common
|
||||
|
||||
config conf ssh
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 22
|
||||
option remote_port 2222
|
||||
option name ssh
|
||||
|
||||
config conf jellyfin
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 8096
|
||||
option remote_port 8096
|
||||
option name jellyfin
|
||||
|
||||
config conf navidrome
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 4533
|
||||
option remote_port 4533
|
||||
option name navidrome
|
||||
|
||||
config conf immich
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 2283
|
||||
option remote_port 2283
|
||||
option name immich
|
||||
|
||||
config conf watch
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 5000
|
||||
option remote_port 5000
|
||||
option name watch
|
||||
|
||||
config conf n8n
|
||||
option type tcp
|
||||
option local_ip 127.0.0.1
|
||||
option local_ip 192.168.100.1
|
||||
option local_port 5678
|
||||
option remote_port 5678
|
||||
option name n8n
|
||||
|
||||
40
package/diy/usb-automount/Makefile
Normal file
40
package/diy/usb-automount/Makefile
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2026 xiexiaobao
|
||||
#
|
||||
# This is free software, licensed under the GPL 2.0 license.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=usb-automount
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/usb-automount
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Auto-mount USB drives by UUID, handle device name drift
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+block-mount +e2fsprogs
|
||||
endef
|
||||
|
||||
define Package/usb-automount/description
|
||||
On every boot, scan /dev/sd*1 partitions and mount known USB drives
|
||||
by their UUID. Solves the problem of USB device names changing
|
||||
between sda/sdb/sdc after reboot or reconnect.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/usb-automount/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/usb-automount.init $(1)/etc/init.d/usb-automount
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,usb-automount))
|
||||
74
package/diy/usb-automount/files/usb-automount.init
Normal file
74
package/diy/usb-automount/files/usb-automount.init
Normal file
@ -0,0 +1,74 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# USB automount by UUID
|
||||
# START=40 — runs before docker, after block devices are ready
|
||||
# Scans all /dev/sd*1 partitions and mounts known USB drives by UUID
|
||||
|
||||
START=40
|
||||
USE_PROCD=1
|
||||
|
||||
# Define known USB drives: "UUID=/path"
|
||||
# Users can add more entries below
|
||||
KNOWN_DRIVES="f0e7fd47-d44c-5148-92e7-7deec77ec257=/mnt/usb2-1
|
||||
5d55739a-9818-804e-b783-bf04f384b02b=/mnt/usb2-2
|
||||
cd73ceed-363a-754a-b889-fa98af68453b=/mnt/usb2-3
|
||||
29D6AEFCF598A1A9=/mnt/usb2-4"
|
||||
|
||||
start_service() {
|
||||
local mounted=""
|
||||
|
||||
for entry in $KNOWN_DRIVES; do
|
||||
local uuid="${entry%%=*}"
|
||||
local target="${entry#*=}"
|
||||
|
||||
# Already mounted?
|
||||
mount | grep -q "on $target " && {
|
||||
logger -t usb-automount "$target already mounted"
|
||||
continue
|
||||
}
|
||||
|
||||
# Find device by UUID
|
||||
local dev=""
|
||||
for d in /dev/sd*1 /dev/sd*2 /dev/sd*3 /dev/sd*4; do
|
||||
[ -b "$d" ] || continue
|
||||
local duuid
|
||||
duuid=$(blkid -s UUID -o value "$d" 2>/dev/null)
|
||||
[ "$duuid" = "$uuid" ] && { dev="$d"; break; }
|
||||
done
|
||||
|
||||
[ -z "$dev" ] && {
|
||||
logger -t usb-automount "device with UUID $uuid not found, skipping"
|
||||
continue
|
||||
}
|
||||
|
||||
# Create mount point if missing
|
||||
mkdir -p "$target"
|
||||
|
||||
# Detect filesystem type and mount
|
||||
local fstype
|
||||
fstype=$(blkid -s TYPE -o value "$dev" 2>/dev/null)
|
||||
case "$fstype" in
|
||||
ext4)
|
||||
mount -t ext4 "$dev" "$target" 2>/dev/null
|
||||
;;
|
||||
ntfs)
|
||||
mount -t ntfs3 "$dev" "$target" 2>/dev/null || mount -t ntfs-3g "$dev" "$target" 2>/dev/null
|
||||
;;
|
||||
*)
|
||||
mount "$dev" "$target" 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
|
||||
if mount | grep -q "on $target "; then
|
||||
logger -t usb-automount "mounted $dev ($uuid) -> $target [${fstype:-auto}]"
|
||||
mounted=1
|
||||
else
|
||||
logger -t usb-automount "FAILED to mount $dev ($uuid) -> $target"
|
||||
fi
|
||||
done
|
||||
|
||||
[ -n "$mounted" ] && procd_set_param respawn
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "usb-automount"
|
||||
}
|
||||
@ -166,6 +166,8 @@ CONFIG_TARGET_ROOTFS_PARTSIZE=512
|
||||
CONFIG_PACKAGE_kmod-video-uvc=y
|
||||
CONFIG_PACKAGE_kmod-video-core=y
|
||||
CONFIG_PACKAGE_kmod-video-videobuf2=y
|
||||
CONFIG_PACKAGE_kmod-usb-storage=y
|
||||
CONFIG_PACKAGE_kmod-usb-storage-uas=y
|
||||
CONFIG_PACKAGE_kmod-usb-video=y
|
||||
CONFIG_PACKAGE_jellyfin-autoinit=y
|
||||
CONFIG_PACKAGE_docker-restore=y
|
||||
@ -209,8 +211,9 @@ CONFIG_PACKAGE_branding=y
|
||||
CONFIG_PACKAGE_kmod-rk_vcodec=y
|
||||
CONFIG_PACKAGE_kmod-rga3=y
|
||||
CONFIG_PACKAGE_kmod-rknpu=y
|
||||
|
||||
CONFIG_PACKAGE_aircrack-ng=y
|
||||
# Build-time branding
|
||||
CONFIG_DISTRIB_ID="MapleOS"
|
||||
CONFIG_PACKAGE_install-to-emmc=y
|
||||
CONFIG_PACKAGE_kmod-ipt-conntrack-extra=y
|
||||
CONFIG_PACKAGE_usb-automount=y
|
||||
|
||||
Loading…
Reference in New Issue
Block a user