#!/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 ALIASES_LINE="source $SMB_TOOLS_PATH/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 # Set it for the current script execution too export SMB_TOOLS_PATH="$SCRIPT_DIR" echo "SMB_TOOLS_PATH set to: $SMB_TOOLS_PATH"