🌴 Sync 2026-03-05 23:51:42

This commit is contained in:
github-actions[bot] committed 2026-03-05 23:51:42 +08:00
1 parent 97c049ed0a
commit 0acff03804
14253 files changed
+3893239

No files matched your search

@@ -0,0 +1,14 @@
config mount
option enabled '0'
option server ''
option remote_path '/share'
option local_path '/mnt'
option smb_version ''
option iocharset 'utf8'
option ro '0'
option username ''
option password ''
option workgroup 'WORKGROUP'
option options ''
+75
View File
@@ -0,0 +1,75 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
CONF="cifs-mount"
mount_cifs() {
local cfg="$1"
local enabled
config_get_bool enabled "$cfg" "enabled" "0"
[ "$enabled" -eq "1" ] || return 1
local server remote_path local_path smb_version iocharset ro
local username password workgroup options
config_get server "$cfg" "server"
config_get remote_path "$cfg" "remote_path"
config_get local_path "$cfg" "local_path"
config_get smb_version "$cfg" "smb_version"
config_get iocharset "$cfg" "iocharset" "utf8"
config_get_bool ro "$cfg" "ro" "0"
config_get username "$cfg" "username"
config_get password "$cfg" "password"
config_get workgroup "$cfg" "workgroup"
config_get options "$cfg" "options"
if [ -z "$server" ] || [ -z "$remote_path" ] || [ -z "$local_path" ]; then
return 1
fi
mkdir -p "$local_path"
chmod 777 "$local_path"
local mount_args
if [ "$ro" -eq "1" ]; then
mount_args="ro"
else
mount_args="rw"
fi
[ -z "$smb_version" ] || append mount_args "vers=$smb_version" ","
[ "$iocharset" = "-" ] || append mount_args "iocharset=$iocharset" ","
if [ "$username" = "guest" ]; then
append mount_args "guest" ","
else
[ -z "$username" ] || append mount_args "user=$username,username=$username" ","
[ -z "$password" ] || append mount_args "password=$password" ","
fi
[ -z "$workgroup" ] || append mount_args "dom=$workgroup" ","
[ -z "$options" ] || config_list_foreach "$cfg" "options" "append mount_args " ","
mount -t cifs -o "$mount_args" "//${server}${remote_path}" "$local_path"
}
start_service() {
config_load "$CONF"
config_foreach mount_cifs "mount"
}
stop_service() {
mount | awk '/^\/\/.*type cifs/ {print $3}' | while IFS= read -r mp; do
umount -d -l "$mp"
done
}
reload_service() {
stop
sleep 2s
start
}
service_triggers() {
procd_add_reload_trigger "$CONF"
}
@@ -0,0 +1,49 @@
#!/bin/sh
. /lib/functions.sh
migrate_cifs() {
local cfg="$1"
local ncfg="$(uci -q add "cifs-mount" "mount")"
local server name natpath users pwd sec agm iocharset smbver
config_get server "$cfg" "server"
config_get name "$cfg" "name"
config_get natpath "$cfg" "natpath"
config_get users "$cfg" "users"
config_get pwd "$cfg" "pwd"
config_get sec "$cfg" "sec"
config_get agm "$cfg" "agm"
config_get iocharset "$cfg" "iocharset" "utf8"
config_get smbver "$cfg" "smbver"
if [ -z "$server" ] || [ -z "$name" ] || [ -z "$natpath" ]; then
return 1
fi
uci -q set "cifs-mount.$ncfg.enabled"="$enabled"
uci -q set "cifs-mount.$ncfg.server"="$server"
uci -q set "cifs-mount.$ncfg.local_path"="$name"
uci -q set "cifs-mount.$ncfg.remote_path"="/$natpath"
uci -q set "cifs-mount.$ncfg.username"="$users"
uci -q set "cifs-mount.$ncfg.password"="$pwd"
[ -z "$sec" ] || uci -q add_list "cifs-mount.$ncfg.options"="sec=$sec"
[ -z "$agm" ] || uci -q add_list "cifs-mount.$ncfg.options"="$agm"
uci -q set "cifs-mount.$ncfg.iocharset"="$iocharset"
uci -q set "cifs-mount.$ncfg.smb_version"="$smbver"
uci -q set "cifs-mount.$ncfg.workgroup"="$workgroup"
}
grep -q "natshare" "/etc/config/cifs" 2>"/dev/null" || exit 0
enabled="$(uci -q get "cifs.@cifs[0].enabled")"
[ "$enabled" -eq "1" ] || enabled="0"
workgroup="$(uci -q get "cifs.@cifs[0].workgroup")"
config_load "cifs"
config_foreach migrate_cifs "natshare"
uci -q commit "cifs-mount"
rm -f "/etc/config/cifs"
exit 0
@@ -0,0 +1,13 @@
{
"admin/nas/cifs-mount": {
"title": "Mount SMB NetShare",
"action": {
"type": "view",
"path": "cifs-mount"
},
"depends": {
"acl": [ "luci-app-cifs-mount" ],
"uci": { "cifs-mount": true }
}
}
}
@@ -0,0 +1,11 @@
{
"luci-app-cifs-mount": {
"description": "Grant UCI access for luci-app-cifs-mount",
"read": {
"uci": [ "cifs-mount" ]
},
"write": {
"uci": [ "cifs-mount" ]
}
}
}