bssh/setup_bssh.sh

42 lines
941 B
Bash
Raw Normal View History

#!/bin/bash
GIT_URL="https://git.zelz.net/saige/bssh/raw/branch/main/bssh.sh"
INSTALL_DIR="/usr/local/bin"
2024-07-02 14:29:32 -05:00
DEPENDENCIES="curl sshpass"
install_dependencies() {
echo "Checking and installing dependencies..."
sudo apt-get update
sudo apt-get install -y ${DEPENDENCIES}
}
setup_bssh() {
echo "Downloading bssh script..."
2024-07-02 15:06:54 -05:00
sudo curl -sSL "${GIT_URL}" -o "${INSTALL_DIR}/bssh"
2024-07-02 15:06:54 -05:00
sudo chmod +x "${INSTALL_DIR}/bssh"
if [ ! -x "${INSTALL_DIR}/bssh" ]; then
echo "Error: Failed to make bssh executable."
exit 1
fi
echo "bssh setup completed."
}
main() {
if command -v bssh >/dev/null 2>&1; then
2024-07-02 15:06:54 -05:00
rm -rf ${INSTALL_DIR}/bssh
echo "bSSH Uninstalled. Run the Script Again to Reinstall."
exit 0
fi
install_dependencies
setup_bssh
echo "bssh is installed in ${INSTALL_DIR}."
echo "You can now use 'bssh -h' to view the help message."
}
main