mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-12 00:47:37 +00:00
Code refactoring
This commit is contained in:
@ -117,13 +117,9 @@ motd_ssh() {
|
||||
}
|
||||
|
||||
customize() {
|
||||
if [[ "$PASSWORD" == "" ]]; then
|
||||
msg_info "Customizing Container"
|
||||
bash -c "passwd -d root" >/dev/null 2>&1
|
||||
msg_ok "Customized Container"
|
||||
}
|
||||
|
||||
root() {
|
||||
if ! getent shadow root | grep -q '^root:[^:]*:\?\$'; then
|
||||
customize
|
||||
fi
|
||||
}
|
||||
}
|
@ -169,7 +169,7 @@ advanced_settings() {
|
||||
if PW1=$(whiptail --inputbox "\nSet Root Password (needed for root ssh access)" 9 58 --title "PASSWORD(leave blank for automatic login)" 3>&1 1>&2 2>&3); then
|
||||
if [ -z $PW1 ]; then
|
||||
PW1="Automatic Login"
|
||||
PW=" "
|
||||
PW=""
|
||||
else
|
||||
PW="-password $PW1"
|
||||
fi
|
||||
|
@ -116,6 +116,7 @@ motd_ssh() {
|
||||
}
|
||||
|
||||
customize() {
|
||||
if [[ "$PASSWORD" == "" ]]; then
|
||||
msg_info "Customizing Container"
|
||||
GETTY_OVERRIDE="/etc/systemd/system/container-getty@1.service.d/override.conf"
|
||||
mkdir -p $(dirname $GETTY_OVERRIDE)
|
||||
@ -127,10 +128,5 @@ EOF
|
||||
systemctl daemon-reload
|
||||
systemctl restart $(basename $(dirname $GETTY_OVERRIDE) | sed 's/\.d//')
|
||||
msg_ok "Customized Container"
|
||||
}
|
||||
|
||||
root() {
|
||||
if ! getent shadow root | grep -q "^root:[^\!*]"; then
|
||||
customize
|
||||
fi
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user