mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-19 15:18:06 +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
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \
|
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" ON \
|
"1" "Check for Alpine Updates" OFF \
|
||||||
|
"2" "Update NPMplus Docker Container" ON \
|
||||||
3>&1 1>&2 2>&3)
|
3>&1 1>&2 2>&3)
|
||||||
|
|
||||||
header_info
|
header_info "$APP"
|
||||||
if [ "$UPD" == "1" ]; then
|
|
||||||
|
case "$UPD" in
|
||||||
|
"1")
|
||||||
|
msg_info "Updating Alpine OS"
|
||||||
apk update && apk upgrade
|
apk update && apk upgrade
|
||||||
|
msg_ok "System updated"
|
||||||
exit
|
exit
|
||||||
fi
|
;;
|
||||||
|
"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
|
start
|
||||||
build_container
|
build_container
|
||||||
description
|
description
|
||||||
|
@ -15,14 +15,9 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apk add \
|
$STD apk add \
|
||||||
newt \
|
|
||||||
curl \
|
|
||||||
openssh \
|
|
||||||
tzdata \
|
tzdata \
|
||||||
nano \
|
|
||||||
gawk \
|
gawk \
|
||||||
yq \
|
yq
|
||||||
mc
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Docker & Compose"
|
msg_info "Installing Docker & Compose"
|
||||||
@ -95,7 +90,7 @@ customize
|
|||||||
msg_info "Retrieving Default Login (Patience)"
|
msg_info "Retrieving Default Login (Patience)"
|
||||||
PASSWORD_FOUND=0
|
PASSWORD_FOUND=0
|
||||||
for i in {1..60}; do
|
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
|
if [[ -n "$PASSWORD_LINE" ]]; then
|
||||||
PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}')
|
PASSWORD=$(echo "$PASSWORD_LINE" | awk -F 'password: ' '{print $2}')
|
||||||
echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd
|
echo -e "username: admin@example.org\npassword: $PASSWORD" >/opt/.npm_pwd
|
||||||
@ -107,5 +102,6 @@ for i in {1..60}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [[ $PASSWORD_FOUND -eq 0 ]]; then
|
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
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user