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