Skip to content

Commit ae84750

Browse files
committed
edit func
1 parent 57b8017 commit ae84750

3 files changed

Lines changed: 132 additions & 132 deletions

File tree

ct/slskd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
2+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/build.func)
33
# Copyright (c) 2021-2026 community-scripts ORG
44
# Author: vhsdream
55
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE

misc/build.func

Lines changed: 127 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ variables() {
8080
fi
8181
}
8282

83-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/api.func)
83+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/api.func)
8484

8585
if command -v curl >/dev/null 2>&1; then
86-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
87-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
86+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/core.func)
87+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/error_handler.func)
8888
load_functions
8989
catch_errors
9090
elif command -v wget >/dev/null 2>&1; then
91-
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
92-
source <(wget -qO- https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
91+
source <(wget -qO- https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/core.func)
92+
source <(wget -qO- https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/error_handler.func)
9393
load_functions
9494
catch_errors
9595
fi
@@ -217,7 +217,7 @@ update_motd_ip() {
217217
local current_os="$(grep ^NAME /etc/os-release | cut -d= -f2 | tr -d '"') - Version: $(grep ^VERSION_ID /etc/os-release | cut -d= -f2 | tr -d '"')"
218218
local current_hostname="$(hostname)"
219219
local current_ip="$(hostname -I | awk '{print $1}')"
220-
220+
221221
# Update only if values actually changed
222222
if ! grep -q "OS:.*$current_os" "$PROFILE_FILE" 2>/dev/null; then
223223
sed -i "s|OS:.*|OS: \${GN}$current_os\${CL}\\\"|" "$PROFILE_FILE"
@@ -385,7 +385,7 @@ validate_hostname() {
385385

386386
# Split by dots and validate each label
387387
local IFS='.'
388-
read -ra labels <<< "$hostname"
388+
read -ra labels <<<"$hostname"
389389
for label in "${labels[@]}"; do
390390
# Each label: 1-63 chars, alphanumeric, hyphens allowed (not at start/end)
391391
if [[ -z "$label" ]] || [[ ${#label} -gt 63 ]]; then
@@ -489,7 +489,7 @@ validate_ipv6_address() {
489489
# Check that no segment exceeds 4 hex chars
490490
local IFS=':'
491491
local -a segments
492-
read -ra segments <<< "$addr"
492+
read -ra segments <<<"$addr"
493493
for seg in "${segments[@]}"; do
494494
if [[ ${#seg} -gt 4 ]]; then
495495
return 1
@@ -539,14 +539,14 @@ validate_gateway_in_subnet() {
539539

540540
# Convert IPs to integers
541541
local IFS='.'
542-
read -r i1 i2 i3 i4 <<< "$ip"
543-
read -r g1 g2 g3 g4 <<< "$gateway"
542+
read -r i1 i2 i3 i4 <<<"$ip"
543+
read -r g1 g2 g3 g4 <<<"$gateway"
544544

545-
local ip_int=$(( (i1 << 24) + (i2 << 16) + (i3 << 8) + i4 ))
546-
local gw_int=$(( (g1 << 24) + (g2 << 16) + (g3 << 8) + g4 ))
545+
local ip_int=$(((i1 << 24) + (i2 << 16) + (i3 << 8) + i4))
546+
local gw_int=$(((g1 << 24) + (g2 << 16) + (g3 << 8) + g4))
547547

548548
# Check if both are in same network
549-
if (( (ip_int & mask) != (gw_int & mask) )); then
549+
if (((ip_int & mask) != (gw_int & mask))); then
550550
return 1
551551
fi
552552

@@ -1079,117 +1079,117 @@ load_vars_file() {
10791079
# Validate values before setting (skip empty values - they use defaults)
10801080
if [[ -n "$var_val" ]]; then
10811081
case "$var_key" in
1082-
var_mac)
1083-
if ! validate_mac_address "$var_val"; then
1084-
msg_warn "Invalid MAC address '$var_val' in $file, ignoring"
1085-
continue
1086-
fi
1087-
;;
1088-
var_vlan)
1089-
if ! validate_vlan_tag "$var_val"; then
1090-
msg_warn "Invalid VLAN tag '$var_val' in $file (must be 1-4094), ignoring"
1091-
continue
1092-
fi
1093-
;;
1094-
var_mtu)
1095-
if ! validate_mtu "$var_val"; then
1096-
msg_warn "Invalid MTU '$var_val' in $file (must be 576-65535), ignoring"
1097-
continue
1098-
fi
1099-
;;
1100-
var_tags)
1101-
if ! validate_tags "$var_val"; then
1102-
msg_warn "Invalid tags '$var_val' in $file (alphanumeric, -, _, ; only), ignoring"
1103-
continue
1104-
fi
1105-
;;
1106-
var_timezone)
1107-
if ! validate_timezone "$var_val"; then
1108-
msg_warn "Invalid timezone '$var_val' in $file, ignoring"
1109-
continue
1110-
fi
1111-
;;
1112-
var_brg)
1113-
if ! validate_bridge "$var_val"; then
1114-
msg_warn "Bridge '$var_val' not found in $file, ignoring"
1115-
continue
1116-
fi
1117-
;;
1118-
var_gateway)
1119-
if ! validate_gateway_ip "$var_val"; then
1120-
msg_warn "Invalid gateway IP '$var_val' in $file, ignoring"
1121-
continue
1122-
fi
1123-
;;
1124-
var_hostname)
1125-
if ! validate_hostname "$var_val"; then
1126-
msg_warn "Invalid hostname '$var_val' in $file, ignoring"
1127-
continue
1128-
fi
1129-
;;
1130-
var_cpu)
1131-
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 1 || var_val > 128)); then
1132-
msg_warn "Invalid CPU count '$var_val' in $file (must be 1-128), ignoring"
1133-
continue
1134-
fi
1135-
;;
1136-
var_ram)
1137-
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 256)); then
1138-
msg_warn "Invalid RAM '$var_val' in $file (must be >= 256 MiB), ignoring"
1139-
continue
1140-
fi
1141-
;;
1142-
var_disk)
1143-
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 1)); then
1144-
msg_warn "Invalid disk size '$var_val' in $file (must be >= 1 GB), ignoring"
1145-
continue
1146-
fi
1147-
;;
1148-
var_unprivileged)
1149-
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1150-
msg_warn "Invalid unprivileged value '$var_val' in $file (must be 0 or 1), ignoring"
1151-
continue
1152-
fi
1153-
;;
1154-
var_nesting)
1155-
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1156-
msg_warn "Invalid nesting value '$var_val' in $file (must be 0 or 1), ignoring"
1157-
continue
1158-
fi
1159-
# Warn about potential issues with systemd-based OS when nesting is disabled via vars file
1160-
if [[ "$var_val" == "0" && "${var_os:-debian}" != "alpine" ]]; then
1161-
msg_warn "Nesting disabled in $file - modern systemd-based distributions may require nesting for proper operation"
1162-
fi
1163-
;;
1164-
var_keyctl)
1165-
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1166-
msg_warn "Invalid keyctl value '$var_val' in $file (must be 0 or 1), ignoring"
1167-
continue
1168-
fi
1169-
;;
1170-
var_net)
1171-
# var_net can be: dhcp, static IP/CIDR, or IP range
1172-
if [[ "$var_val" != "dhcp" ]]; then
1173-
if is_ip_range "$var_val"; then
1174-
: # IP range is valid, will be resolved at runtime
1175-
elif ! validate_ip_address "$var_val"; then
1176-
msg_warn "Invalid network '$var_val' in $file (must be dhcp or IP/CIDR), ignoring"
1177-
continue
1178-
fi
1179-
fi
1180-
;;
1181-
var_fuse|var_tun|var_gpu|var_ssh|var_verbose|var_protection)
1182-
if [[ "$var_val" != "yes" && "$var_val" != "no" ]]; then
1183-
msg_warn "Invalid boolean '$var_val' for $var_key in $file (must be yes/no), ignoring"
1184-
continue
1185-
fi
1186-
;;
1187-
var_ipv6_method)
1188-
if [[ "$var_val" != "auto" && "$var_val" != "dhcp" && "$var_val" != "static" && "$var_val" != "none" ]]; then
1189-
msg_warn "Invalid IPv6 method '$var_val' in $file (must be auto/dhcp/static/none), ignoring"
1082+
var_mac)
1083+
if ! validate_mac_address "$var_val"; then
1084+
msg_warn "Invalid MAC address '$var_val' in $file, ignoring"
1085+
continue
1086+
fi
1087+
;;
1088+
var_vlan)
1089+
if ! validate_vlan_tag "$var_val"; then
1090+
msg_warn "Invalid VLAN tag '$var_val' in $file (must be 1-4094), ignoring"
1091+
continue
1092+
fi
1093+
;;
1094+
var_mtu)
1095+
if ! validate_mtu "$var_val"; then
1096+
msg_warn "Invalid MTU '$var_val' in $file (must be 576-65535), ignoring"
1097+
continue
1098+
fi
1099+
;;
1100+
var_tags)
1101+
if ! validate_tags "$var_val"; then
1102+
msg_warn "Invalid tags '$var_val' in $file (alphanumeric, -, _, ; only), ignoring"
1103+
continue
1104+
fi
1105+
;;
1106+
var_timezone)
1107+
if ! validate_timezone "$var_val"; then
1108+
msg_warn "Invalid timezone '$var_val' in $file, ignoring"
1109+
continue
1110+
fi
1111+
;;
1112+
var_brg)
1113+
if ! validate_bridge "$var_val"; then
1114+
msg_warn "Bridge '$var_val' not found in $file, ignoring"
1115+
continue
1116+
fi
1117+
;;
1118+
var_gateway)
1119+
if ! validate_gateway_ip "$var_val"; then
1120+
msg_warn "Invalid gateway IP '$var_val' in $file, ignoring"
1121+
continue
1122+
fi
1123+
;;
1124+
var_hostname)
1125+
if ! validate_hostname "$var_val"; then
1126+
msg_warn "Invalid hostname '$var_val' in $file, ignoring"
1127+
continue
1128+
fi
1129+
;;
1130+
var_cpu)
1131+
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 1 || var_val > 128)); then
1132+
msg_warn "Invalid CPU count '$var_val' in $file (must be 1-128), ignoring"
1133+
continue
1134+
fi
1135+
;;
1136+
var_ram)
1137+
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 256)); then
1138+
msg_warn "Invalid RAM '$var_val' in $file (must be >= 256 MiB), ignoring"
1139+
continue
1140+
fi
1141+
;;
1142+
var_disk)
1143+
if ! [[ "$var_val" =~ ^[0-9]+$ ]] || ((var_val < 1)); then
1144+
msg_warn "Invalid disk size '$var_val' in $file (must be >= 1 GB), ignoring"
1145+
continue
1146+
fi
1147+
;;
1148+
var_unprivileged)
1149+
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1150+
msg_warn "Invalid unprivileged value '$var_val' in $file (must be 0 or 1), ignoring"
1151+
continue
1152+
fi
1153+
;;
1154+
var_nesting)
1155+
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1156+
msg_warn "Invalid nesting value '$var_val' in $file (must be 0 or 1), ignoring"
1157+
continue
1158+
fi
1159+
# Warn about potential issues with systemd-based OS when nesting is disabled via vars file
1160+
if [[ "$var_val" == "0" && "${var_os:-debian}" != "alpine" ]]; then
1161+
msg_warn "Nesting disabled in $file - modern systemd-based distributions may require nesting for proper operation"
1162+
fi
1163+
;;
1164+
var_keyctl)
1165+
if [[ "$var_val" != "0" && "$var_val" != "1" ]]; then
1166+
msg_warn "Invalid keyctl value '$var_val' in $file (must be 0 or 1), ignoring"
1167+
continue
1168+
fi
1169+
;;
1170+
var_net)
1171+
# var_net can be: dhcp, static IP/CIDR, or IP range
1172+
if [[ "$var_val" != "dhcp" ]]; then
1173+
if is_ip_range "$var_val"; then
1174+
: # IP range is valid, will be resolved at runtime
1175+
elif ! validate_ip_address "$var_val"; then
1176+
msg_warn "Invalid network '$var_val' in $file (must be dhcp or IP/CIDR), ignoring"
11901177
continue
11911178
fi
1192-
;;
1179+
fi
1180+
;;
1181+
var_fuse | var_tun | var_gpu | var_ssh | var_verbose | var_protection)
1182+
if [[ "$var_val" != "yes" && "$var_val" != "no" ]]; then
1183+
msg_warn "Invalid boolean '$var_val' for $var_key in $file (must be yes/no), ignoring"
1184+
continue
1185+
fi
1186+
;;
1187+
var_ipv6_method)
1188+
if [[ "$var_val" != "auto" && "$var_val" != "dhcp" && "$var_val" != "static" && "$var_val" != "none" ]]; then
1189+
msg_warn "Invalid IPv6 method '$var_val' in $file (must be auto/dhcp/static/none), ignoring"
1190+
continue
1191+
fi
1192+
;;
11931193
esac
11941194
fi
11951195

@@ -3327,7 +3327,7 @@ configure_ssh_settings() {
33273327
# - Otherwise: shows update/setting menu and runs update_script with cleanup
33283328
# ------------------------------------------------------------------------------
33293329
start() {
3330-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
3330+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/tools.func)
33313331
if command -v pveversion >/dev/null 2>&1; then
33323332
install_script || return 0
33333333
return 0
@@ -3459,9 +3459,9 @@ build_container() {
34593459
TEMP_DIR=$(mktemp -d)
34603460
pushd "$TEMP_DIR" >/dev/null
34613461
if [ "$var_os" == "alpine" ]; then
3462-
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/alpine-install.func)"
3462+
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/alpine-install.func)"
34633463
else
3464-
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)"
3464+
export FUNCTIONS_FILE_PATH="$(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/install.func)"
34653465
fi
34663466

34673467
# Core exports for install.func
@@ -3951,7 +3951,7 @@ EOF'
39513951
set +Eeuo pipefail # Disable ALL error handling temporarily
39523952
trap - ERR # Remove ERR trap completely
39533953

3954-
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/install/${var_install}.sh)"
3954+
lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/install/${var_install}.sh)"
39553955
local lxc_exit=$?
39563956

39573957
set -Eeuo pipefail # Re-enable error handling
@@ -4035,7 +4035,7 @@ EOF'
40354035
if [[ "${DEV_MODE_MOTD:-false}" == "true" ]]; then
40364036
echo -e "${TAB}${HOLD}${DGN}Setting up MOTD and SSH for debugging...${CL}"
40374037
if pct exec "$CTID" -- bash -c "
4038-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/install.func)
4038+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/install.func)
40394039
declare -f motd_ssh >/dev/null 2>&1 && motd_ssh || true
40404040
" >/dev/null 2>&1; then
40414041
local ct_ip=$(pct exec "$CTID" ip a s dev eth0 2>/dev/null | awk '/inet / {print $2}' | cut -d/ -f1)

misc/install.func

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ if ! command -v curl >/dev/null 2>&1; then
3232
apt update >/dev/null 2>&1
3333
apt install -y curl >/dev/null 2>&1
3434
fi
35-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func)
36-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/error_handler.func)
35+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/core.func)
36+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/error_handler.func)
3737
load_functions
3838
catch_errors
3939

@@ -207,7 +207,7 @@ EOF
207207
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
208208
msg_ok "Updated Container OS"
209209

210-
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func)
210+
source <(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/misc/tools.func)
211211
}
212212

213213
# ==============================================================================
@@ -277,7 +277,7 @@ EOF
277277
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
278278
msg_ok "Customized Container"
279279
fi
280-
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/${app}.sh)\"" >/usr/bin/update
280+
echo "bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/vhsdream/ProxmoxVE/refs/heads/slskd/ct/${app}.sh)\"" >/usr/bin/update
281281
chmod +x /usr/bin/update
282282

283283
if [[ -n "${SSH_AUTHORIZED_KEY}" ]]; then

0 commit comments

Comments
 (0)