27 lines
558 B
Bash
27 lines
558 B
Bash
#!/bin/bash
|
|
|
|
install_pkg() {
|
|
pkg="$1"
|
|
if ! dpkg -s "$pkg" >/dev/null 2>&1; then
|
|
apt update && apt install -y "$pkg"
|
|
echo -e "${PURPLE}${BOLD}${pkg} installed${RESET}"
|
|
fi
|
|
}
|
|
|
|
get_username() {
|
|
if [[ -z "$username" ]]; then
|
|
username=$(getent passwd 1001 | cut -d: -f1)
|
|
fi
|
|
}
|
|
|
|
get_ip() {
|
|
if [[ -z "$ip" ]]; then
|
|
ip=$(hostname -I | cut -d' ' -f1)
|
|
fi
|
|
}
|
|
|
|
get_ssh_port() {
|
|
if [[ -z "$ssh_port" ]]; then
|
|
ssh_port=$(cat /etc/ssh/sshd_config.d/custom.conf | grep "Port " | sed 's/^Port //')
|
|
fi
|
|
} |