Update webmin.sh

A full code overhaul.
This commit is contained in:
tteckster 2023-10-27 12:21:36 -04:00 committed by GitHub
parent d45f386407
commit b5c28fd921
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,40 +5,57 @@
# License: MIT # License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE # https://github.com/tteck/Proxmox/raw/main/LICENSE
YW=$(echo "\033[33m") function header_info {
RD=$(echo "\033[01;31m") clear
BL=$(echo "\033[36m") cat <<"EOF"
CM='\xE2\x9C\x94\033' _ __ __ _
GN=$(echo "\033[1;92m") | | /| / /__ / / __ _ (_)__
CL=$(echo "\033[m") | |/ |/ / -_) _ \/ ' \/ / _ \
while true; do |__/|__/\__/_.__/_/_/_/_/_//_/
read -p "This will Install Webmin, Proceed(y/n)?" yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
esac
done
clear
echo -en "${GN} Installing Prerequisites... " EOF
}
set -eEuo pipefail
YW=$(echo "\033[33m")
BL=$(echo "\033[36m")
BGN=$(echo "\033[4;92m")
GN=$(echo "\033[1;92m")
DGN=$(echo "\033[32m")
CL=$(echo "\033[m")
CM="${GN}${CL}"
BFR="\\r\\033[K"
HOLD="-"
msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
header_info
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Webmin Installer" --yesno "This Will Install Webmin on this LXC Container. Proceed?" 10 58 || exit
msg_info "Installing Prerequisites"
apt update &>/dev/null apt update &>/dev/null
apt-get -y install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl unzip shared-mime-info &>/dev/null apt-get -y install libnet-ssleay-perl libauthen-pam-perl libio-pty-perl unzip shared-mime-info &>/dev/null
echo -e "${CM}${CL} \r" msg_ok "Installed Prerequisites"
echo -en "${GN} Downloading Webmin... " LATEST=$(curl -sL https://api.github.com/repos/webmin/webmin/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
wget http://prdownloads.sourceforge.net/webadmin/webmin_2.021_all.deb &>/dev/null
echo -e "${CM}${CL} \r"
echo -en "${GN} Installing Webmin... " msg_info "Downloading Webmin"
dpkg --install webmin_2.021_all.deb &>/dev/null wget -q https://github.com/webmin/webmin/releases/download/$LATEST/webmin_${LATEST}_all.deb
echo -e "${CM}${CL} \r" msg_ok "Downloaded Webmin"
echo -en "${GN} Setting Default Webmin usermame & password to root... " msg_info "Installing Webmin"
dpkg -i webmin_${LATEST}_all.deb &>/dev/null
/usr/share/webmin/changepass.pl /etc/webmin root root &>/dev/null /usr/share/webmin/changepass.pl /etc/webmin root root &>/dev/null
rm -rf /root/webmin_2.021_all.deb rm -rf /root/webmin_${LATEST}_all.deb
echo -e "${CM}${CL} \r" msg_ok "Installed Webmin"
IP=$(hostname -I | cut -f1 -d ' ')
echo -e "Successfully Installed!! Webmin should be reachable by going to https://${IP}:10000"
# bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/misc/webmin.sh)" IP=$(hostname -I | cut -f1 -d ' ')
echo -e "Successfully Installed!! Webmin should be reachable by going to ${BL}https://${IP}:10000${CL}"