From 3a98875f5435967c434f9c65ddca01c32b1a21e9 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Fri, 8 Nov 2024 23:24:13 +0100 Subject: [PATCH] v9.9 - DietPi-Software | MineOS: Fix install on Bookworm by using latest userid Node module version. The defined v1.0.0-beta.9 fails to build on all Bookworm systems, for unknown reasons, the latest stable v1.2.5 however builds fine. - DietPi-Software | Create again a dedicated mineos login user to manage the Minecraft servers. We switched to root, due to insufficient permissions, but I could not replicate any issues, after changing owner of /mnt/dietpi_userdata/mineos/serverdata accordingly. Apply SHA512 password algorithm for this user explicitly, as MineOS does not support the new default yescrypt: https://github.com/MichaIng/DietPi/issues/5759 --- dietpi/dietpi-software | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index 1b2954a593..3d8a6eb8d1 100755 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -8433,6 +8433,9 @@ _EOF_ G_EXEC git config core.filemode false G_EXEC chmod +x mineos_console.js webui.js update_webui.sh reset_webui.sh generate-sslcert.sh + # Bookworm: Workaround for failing userid 1.0.0-beta.9 build on weirdly Bookworm only. Latest stable 1.2.5 seems to work well: https://github.com/MichaIng/DietPi/issues/7265 + G_CONFIG_INJECT '"userid"' ' "userid": "1.2.5",' package.json + # Workaround: Node.js posix needs to be installed alone first: https://github.com/MichaIng/DietPi/issues/5181 G_EXEC_OUTPUT=1 G_EXEC npm i --no-audit --no-package-lock posix@latest @@ -8453,7 +8456,7 @@ _EOF_ G_EXEC cd "$G_WORKING_DIR" # Service - cat << _EOF_ > /etc/systemd/system/mineos.service + cat << '_EOF_' > /etc/systemd/system/mineos.service [Unit] Description=MineOS (DietPi) Wants=network-online.target @@ -8463,12 +8466,19 @@ After=network-online.target SyslogIdentifier=MineOS WorkingDirectory=/mnt/dietpi_userdata/mineos/minecraft Environment="SHELL=/bin/bash" "HOME=/root" -ExecStart=$(command -v node) webui.js +ExecStart=/usr/local/bin/node webui.js KillMode=process [Install] WantedBy=multi-user.target _EOF_ + # User and permissions + local new_user=0 + getent passwd mineos &> /dev/null || new_user=1 + Create_User -d /mnt/dietpi_userdata/mineos/serverdata -p "$GLOBAL_PW" mineos + G_EXEC chown -R mineos /mnt/dietpi_userdata/mineos/serverdata + # - Assure SHA512 password hash algorithm, as MineOS does not support yescrypt, default since Bullseye: https://github.com/hexparrot/mineos-node/issues/441 + (( $new_user )) && G_EXEC eval "chpasswd --crypt-method SHA512 <<< 'mineos:$GLOBAL_PW'" fi if To_Install 46 qbittorrent # qBittorrent @@ -13598,10 +13608,10 @@ _EOF_ if To_Uninstall 53 # MineOS then - Remove_Service mineos 1 1 # User and group for pre-v6.34 + Remove_Service mineos 1 1 [[ -d '/mnt/dietpi_userdata/mineos' ]] && G_EXEC rm -R /mnt/dietpi_userdata/mineos [[ -f '/etc/mineos.conf' ]] && G_EXEC rm /etc/mineos.conf - G_EXEC rm -Rf /var/games/minecraft /usr/local/bin/mineos # Symlinks + G_EXEC rm -Rf /var/games/minecraft /usr/local/bin/mineos /etc/ssl/certs/mineos.* # Symlinks and SSL cert [[ -d '/home/mineos' ]] && G_EXEC rm -R /home/mineos # pre-v6.34 fi