smb_utilities/install.sh
2025-05-25 10:07:31 +00:00

56 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Define colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
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
ALIASES_LINE="source $SMB_TOOLS_PATH/config/aliases.sh"
# Check if it's already set in .bashrc
if grep -Fxq "$ALIASES_LINE" "$HOME/.bashrc"; then
echo "SmbTools aliases already set"
else
echo "$ALIASES_LINE" >> "$HOME/.bashrc"
echo "Set SmbTools aliases"
fi
source $HOME/.bashrc
cd filebrowser
bash ./install.sh
cd ..
echo -e "${YELLOW}------------------------------------------------------${NC}"
echo -e "${YELLOW} !!! WARNING !!! ${NC}"
echo -e "${YELLOW} The computer must be restarted to complete the setup ${NC}"
echo -e "${YELLOW}------------------------------------------------------${NC}"