smb_utilities/install.sh
2025-05-25 08:16:47 +00:00

40 lines
871 B
Bash
Executable File

#!/bin/bash
echo -e "${GREEN}------------------------${NC}"
echo -e "${GREEN} SmbTools installer ${NC}"
echo -e "${GREEN}------------------------${NC}"
apt install samba -y
rm /etc/samba/smb.conf
cp config/smb.conf /etc/samba/smb.conf
mkdir -p /etc/samba/shares.d
systemctl enable smbd
systemctl restart smbd
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
ENV_LINE="export SMB_TOOLS_PATH=\"$SCRIPT_DIR\""
export SMB_TOOLS_PATH=$SCRIPT_DIR\
# Check if it's already set in .bashrc
if grep -Fxq "$ENV_LINE" "$HOME/.bashrc"; then
echo "SMB_TOOLS_PATH already set in .bashrc"
else
echo "$ENV_LINE" >> "$HOME/.bashrc"
echo "Added SMB_TOOLS_PATH to ~/.bashrc"
fi
source $HOME/.bashrc
# Set it for the current script execution too
export SMB_TOOLS_PATH="$SCRIPT_DIR"
echo "SMB_TOOLS_PATH set to: $SMB_TOOLS_PATH"
cd filebrowser
bash ./install.sh
cd ..