Filebrowser-Quantum: change initial config to newer default (#8497)

This commit is contained in:
CanbiZ 2025-10-20 09:35:38 +02:00 committed by GitHub
parent 8fd8bb407e
commit 932de62b38
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2025 community-scripts ORG
# Author: Author: MickLesk
# Author: MickLesk
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
function header_info() {
@ -53,20 +53,9 @@ fi
header_info
function msg_info() {
local msg="$1"
echo -e "${INFO} ${YW}${msg}...${CL}"
}
function msg_ok() {
local msg="$1"
echo -e "${CM} ${GN}${msg}${CL}"
}
function msg_error() {
local msg="$1"
echo -e "${CROSS} ${RD}${msg}${CL}"
}
function msg_info() { echo -e "${INFO} ${YW}$1...${CL}"; }
function msg_ok() { echo -e "${CM} ${GN}$1${CL}"; }
function msg_error() { echo -e "${CROSS} ${RD}$1${CL}"; }
# Detect legacy FileBrowser installation
LEGACY_DB="/usr/local/community-scripts/filebrowser.db"
@ -96,42 +85,32 @@ if [[ -f "$LEGACY_DB" || -f "$LEGACY_BIN" && ! -f "$CONFIG_PATH" ]]; then
fi
fi
# Check existing installation
if [[ -f "$INSTALL_PATH" ]]; then
echo -e "${YW}⚠️ ${APP} is already installed.${CL}"
echo -n "Uninstall ${APP}? (y/N): "
read -r uninstall_prompt
if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Uninstalling ${APP}"
if [[ "$OS" == "Debian" ]]; then
systemctl disable --now filebrowser.service &>/dev/null
rm -f "$SERVICE_PATH"
else
rc-service filebrowser stop &>/dev/null
rc-update del filebrowser &>/dev/null
rm -f "$SERVICE_PATH"
fi
rm -f "$INSTALL_PATH" "$CONFIG_PATH"
msg_ok "${APP} has been uninstalled."
exit 0
# Existing installation
if [[ -f "$INSTALL_PATH" ]]; then
echo -e "${YW}⚠️ ${APP} is already installed.${CL}"
echo -n "Uninstall ${APP}? (y/N): "
read -r uninstall_prompt
if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Uninstalling ${APP}"
if [[ "$OS" == "Debian" ]]; then
systemctl disable --now filebrowser.service &>/dev/null
rm -f "$SERVICE_PATH"
else
rc-service filebrowser stop &>/dev/null
rc-update del filebrowser &>/dev/null
rm -f "$SERVICE_PATH"
fi
echo -n "Update ${APP}? (y/N): "
read -r update_prompt
rm -f "$INSTALL_PATH" "$CONFIG_PATH"
msg_ok "${APP} has been uninstalled."
exit 0
fi
echo -n "Update ${APP}? (y/N): "
read -r update_prompt
if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Updating ${APP}"
tmp="${INSTALL_PATH}.tmp.$$"
if ! curl -fSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$tmp"; then
msg_error "Download failed"
rm -f "$tmp"
exit 1
fi
chmod 0755 "$tmp"
if ! mv -f "$tmp" "$INSTALL_PATH"; then
msg_error "Install failed (cannot move into $INSTALL_PATH)"
rm -f "$tmp"
exit 1
fi
curl -fsSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$INSTALL_PATH"
chmod +x "$INSTALL_PATH"
msg_ok "Updated ${APP}"
exit 0
else
@ -147,72 +126,80 @@ PORT=${PORT:-$DEFAULT_PORT}
echo -n "Install ${APP}? (y/n): "
read -r install_prompt
if [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
msg_info "Installing ${APP} on ${OS}"
$PKG_MANAGER curl ffmpeg &>/dev/null
curl -fsSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$INSTALL_PATH"
chmod +x "$INSTALL_PATH"
msg_ok "Installed ${APP}"
if ! [[ "${install_prompt,,}" =~ ^(y|yes)$ ]]; then
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
exit 0
fi
msg_info "Preparing configuration directory"
mkdir -p /usr/local/community-scripts
chown root:root /usr/local/community-scripts
chmod 755 /usr/local/community-scripts
msg_ok "Directory prepared"
msg_info "Installing ${APP} on ${OS}"
$PKG_MANAGER curl ffmpeg &>/dev/null
curl -fsSL https://github.com/gtsteffaniak/filebrowser/releases/latest/download/linux-amd64-filebrowser -o "$INSTALL_PATH"
chmod +x "$INSTALL_PATH"
msg_ok "Installed ${APP}"
echo -n "Use No Authentication? (y/N): "
read -r noauth_prompt
msg_info "Preparing configuration directory"
mkdir -p /usr/local/community-scripts
chown root:root /usr/local/community-scripts
chmod 755 /usr/local/community-scripts
msg_ok "Directory prepared"
if [[ "${noauth_prompt,,}" =~ ^(y|yes)$ ]]; then
cat <<EOF >"$CONFIG_PATH"
echo -n "Use No Authentication? (y/N): "
read -r noauth_prompt
# === YAML CONFIG GENERATION ===
if [[ "${noauth_prompt,,}" =~ ^(y|yes)$ ]]; then
cat <<EOF >"$CONFIG_PATH"
server:
port: $PORT
sources:
- path: "$SRC_DIR"
- path: "$SRC_DIR"
name: "RootFS"
config:
denyByDefault: false
disableIndexing: false
indexingIntervalMinutes: 240
exclude:
folderPaths:
- "/proc"
- "/sys"
- "/dev"
- "/run"
- "/tmp"
- "/lost+found"
conditionals:
rules:
- neverWatchPath: "/proc"
- neverWatchPath: "/sys"
- neverWatchPath: "/dev"
- neverWatchPath: "/run"
- neverWatchPath: "/tmp"
- neverWatchPath: "/lost+found"
auth:
methods:
noauth: true
EOF
msg_ok "Configured with no authentication"
else
cat <<EOF >"$CONFIG_PATH"
msg_ok "Configured with no authentication"
else
cat <<EOF >"$CONFIG_PATH"
server:
port: $PORT
sources:
- path: "$SRC_DIR"
name: "RootFS"
config:
denyByDefault: false
disableIndexing: false
indexingIntervalMinutes: 240
exclude:
folderPaths:
- "/proc"
- "/sys"
- "/dev"
- "/run"
- "/tmp"
- "/lost+found"
conditionals:
rules:
- neverWatchPath: "/proc"
- neverWatchPath: "/sys"
- neverWatchPath: "/dev"
- neverWatchPath: "/run"
- neverWatchPath: "/tmp"
- neverWatchPath: "/lost+found"
auth:
adminUsername: admin
adminPassword: helper-scripts.com
EOF
msg_ok "Configured with default admin (admin / helper-scripts.com)"
fi
msg_ok "Configured with default admin (admin / helper-scripts.com)"
fi
msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH"
msg_info "Creating service"
if [[ "$OS" == "Debian" ]]; then
cat <<EOF >"$SERVICE_PATH"
[Unit]
Description=FileBrowser Quantum
After=network.target
@ -226,9 +213,9 @@ Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl enable --now filebrowser &>/dev/null
else
cat <<EOF >"$SERVICE_PATH"
systemctl enable --now filebrowser &>/dev/null
else
cat <<EOF >"$SERVICE_PATH"
#!/sbin/openrc-run
command="/usr/local/bin/filebrowser"
@ -241,14 +228,10 @@ depend() {
need net
}
EOF
chmod +x "$SERVICE_PATH"
rc-update add filebrowser default &>/dev/null
rc-service filebrowser start &>/dev/null
fi
msg_ok "Service created successfully"
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://$IP:$PORT${CL}"
else
echo -e "${YW}⚠️ Installation skipped. Exiting.${CL}"
exit 0
chmod +x "$SERVICE_PATH"
rc-update add filebrowser default &>/dev/null
rc-service filebrowser start &>/dev/null
fi
msg_ok "Service created successfully"
echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://$IP:$PORT${CL}"