mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-04-23 01:55:13 +00:00
NPMPlus: update function & better create handling (user/password) (#3520)
* Update npmplus-install.sh * Update npmplus.sh
This commit is contained in:
parent
a95403ece7
commit
04f781c512
@ -20,17 +20,35 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \
|
||||
"1" "Check for Alpine Updates" ON \
|
||||
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "UPDATE MODE" --radiolist --cancel-button Exit-Script "Spacebar = Select" 14 60 2 \
|
||||
"1" "Check for Alpine Updates" OFF \
|
||||
"2" "Update NPMplus Docker Container" ON \
|
||||
3>&1 1>&2 2>&3)
|
||||
|
||||
header_info
|
||||
if [ "$UPD" == "1" ]; then
|
||||
apk update && apk upgrade
|
||||
exit
|
||||
fi
|
||||
header_info "$APP"
|
||||
|
||||
case "$UPD" in
|
||||
"1")
|
||||
msg_info "Updating Alpine OS"
|
||||
apk update && apk upgrade
|
||||
msg_ok "System updated"
|
||||
exit
|
||||
;;
|
||||
"2")
|
||||
msg_info "Updating NPMplus Container"
|
||||
cd /opt || exit 1
|
||||
msg_info "Pulling latest container image"
|
||||
$STD docker compose pull
|
||||
msg_info "Recreating container"
|
||||
$STD docker compose up -d
|
||||
msg_ok "NPMplus container updated"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
@ -15,14 +15,9 @@ update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apk add \
|
||||
newt \
|
||||
curl \
|
||||
openssh \
|
||||
tzdata \
|
||||
nano \
|
||||
gawk \
|
||||
yq \
|
||||
mc
|
||||
yq
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Docker & Compose"
|
||||
@ -95,7 +90,7 @@ customize
|
||||
msg_info "Retrieving Default Login (Patience)"
|
||||
PASSWORD_FOUND=0
|
||||
for i in {1..60}; do
|
||||
PASSWORD_LINE=$(docker logs "$CONTAINER_ID" 2>&1 | grep -m1 "Creating a new user:")
|
||||
PASSWORD_LINE=$(docker logs "$CONTAINER_ID" 2>&1 | awk '/Creating a new user:/ { print; exit }')
|
||||
if [[ -n "$PASSWORD_LINE" ]]; then
|
||||
PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}')
|
||||
echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd
|
||||
@ -107,5 +102,6 @@ for i in {1..60}; do
|
||||
done
|
||||
|
||||
if [[ $PASSWORD_FOUND -eq 0 ]]; then
|
||||
msg_ok "No default login found, use docker ps & docker logs for container password."
|
||||
msg_error "Could not retrieve default login after 60 seconds."
|
||||
echo -e "\nYou can manually check the container logs with:\n docker logs $CONTAINER_ID | grep 'Creating a new user:'\n"
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user