Updates
This commit is contained in:
parent
40736d1bf2
commit
4d692b51b5
0
filebrowser/.env
Normal file
0
filebrowser/.env
Normal file
61
filebrowser/install.sh
Normal file → Executable file
61
filebrowser/install.sh
Normal file → Executable file
@ -1,3 +1,64 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Helper function to check a command
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
DOCKER_OK=true
|
||||
COMPOSE_OK=true
|
||||
|
||||
# Check for Docker
|
||||
if ! command_exists docker; then
|
||||
DOCKER_OK=false
|
||||
fi
|
||||
|
||||
# Check for Docker Compose (plugin or legacy)
|
||||
if ! docker compose version >/dev/null 2>&1 && ! command_exists docker-compose; then
|
||||
COMPOSE_OK=false
|
||||
fi
|
||||
|
||||
# If either is missing, run install script
|
||||
if [[ "$DOCKER_OK" = false || "$COMPOSE_OK" = false ]]; then
|
||||
echo "Missing required tools. Running installer..."
|
||||
git clone https://git.giovanesaggio.com/Selfhosting/docker_setup.git
|
||||
./docker_setup/docker_setup.sh
|
||||
rm -r docker_setup
|
||||
fi
|
||||
|
||||
# Parse and prompt for .env variables
|
||||
ENV_FILE=".env"
|
||||
|
||||
if [[ ! -f "$ENV_FILE" ]]; then
|
||||
echo "$ENV_FILE not found. Creating a new one."
|
||||
touch "$ENV_FILE"
|
||||
fi
|
||||
|
||||
declare -A ENV_VARS
|
||||
|
||||
# Load existing env vars
|
||||
while IFS='=' read -r key value; do
|
||||
[[ "$key" =~ ^[A-Z_][A-Z0-9_]*$ ]] || continue
|
||||
ENV_VARS["$key"]="$value"
|
||||
done < "$ENV_FILE"
|
||||
|
||||
echo "Configure environment variables (press ENTER to keep current value):"
|
||||
|
||||
# Prompt for each variable
|
||||
for key in "${!ENV_VARS[@]}"; do
|
||||
current="${ENV_VARS[$key]}"
|
||||
read -p "$key [$current]: " new_value
|
||||
if [[ -n "$new_value" ]]; then
|
||||
ENV_VARS["$key"]="$new_value"
|
||||
fi
|
||||
done
|
||||
|
||||
# Overwrite .env with updated values
|
||||
> "$ENV_FILE"
|
||||
for key in "${!ENV_VARS[@]}"; do
|
||||
echo "$key=${ENV_VARS[$key]}" >> "$ENV_FILE"
|
||||
done
|
||||
|
||||
# Launch Docker
|
||||
docker compose up -d
|
||||
|
||||
|
@ -35,5 +35,5 @@ export SMB_TOOLS_PATH="$SCRIPT_DIR"
|
||||
echo "SMB_TOOLS_PATH set to: $SMB_TOOLS_PATH"
|
||||
|
||||
cd filebrowser
|
||||
bash ./install
|
||||
bash ./install.sh
|
||||
cd ..
|
@ -1,23 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Define colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Check if pdbedit is installed
|
||||
if ! command -v pdbedit &> /dev/null; then
|
||||
echo -e "${YELLOW}Error:${NC} pdbedit is not installed. Install Samba first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Display heading
|
||||
echo -e "${GREEN}------------------------${NC}"
|
||||
echo -e "${GREEN}Registered Samba users:${NC}"
|
||||
echo -e "${GREEN}------------------------${NC}"
|
||||
|
||||
# List users with color
|
||||
pdbedit -L | cut -d: -f1 | while read -r user; do
|
||||
echo -e " ${YELLOW}${user}${NC}"
|
||||
echo -e "${user}"
|
||||
done
|
||||
echo " "
|
Loading…
x
Reference in New Issue
Block a user