Updated installer (custom folder)

This commit is contained in:
root 2025-05-25 10:27:47 +00:00
parent b5cde53127
commit 94e63329c4
4 changed files with 26 additions and 3 deletions

View File

@ -6,7 +6,7 @@ services:
restart: always
entrypoint: ./start.sh
volumes:
- /data:/srv #Change to match your directory
- $SMB_DATA_FOLDER:/srv #Change to match your directory
- /selfhosting/apps/smb_utilities/filebrowser/filebrowser.db:/database/filebrowser.db #Change to match your directory
- /selfhosting/apps/smb_utilities/filebrowser/settings.json:/config/settings.json #Change to match your directory
- /selfhosting/apps/smb_utilities/filebrowser/start.sh:/start.sh

View File

@ -6,7 +6,7 @@ if [ "$#" -ne 2 ]; then
exit 1
fi
FOLDER_PATH="/data/$2/$1"
FOLDER_PATH="$SMB_DATA_FOLDER/$2/$1"
USERNAME="$2"
SMBCONF="/etc/samba/smb.conf"
SHARE_CONFIG_DIR="/etc/samba/shares.d"

View File

@ -14,7 +14,7 @@ SHARE_NAME="$1"
SHARE_CONFIG_DIR="/etc/samba/shares.d"
SMBCONF="/etc/samba/smb.conf"
SHARE_CONFIG_FILE="$SHARE_CONFIG_DIR/$SHARE_NAME.conf"
TRASH_BASE="/data/trash"
TRASH_BASE="$SMB_DATA_FOLDER/trash"
# 1. Read the .conf file if it exists
if [ ! -f "$SHARE_CONFIG_FILE" ]; then

View File

@ -44,6 +44,29 @@ else
echo "Set SmbTools aliases"
fi
# Ask the user to input a data folder
echo
read -rp "Enter path to data folder (e.g., /data/smb): " DATA_FOLDER
# Validate and create it if it doesn't exist
if [ ! -d "$DATA_FOLDER" ]; then
echo "Directory doesn't exist. Creating: $DATA_FOLDER"
mkdir -p "$DATA_FOLDER"
fi
# Set environment variable
ENV_LINE="export SMB_DATA_FOLDER=\"$DATA_FOLDER\""
export SMB_DATA_FOLDER="$DATA_FOLDER"
# Check if it's already set in .bashrc
if grep -Fxq "$ENV_LINE" "$HOME/.bashrc"; then
echo "SMB_DATA_FOLDER already set in .bashrc"
else
echo "$ENV_LINE" >> "$HOME/.bashrc"
echo "Added SMB_DATA_FOLDER to ~/.bashrc"
fi
source $HOME/.bashrc
cd filebrowser