Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions runs/install_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,64 @@ sudo apt-get -q -y install \
xserver-xorg x11-xserver-utils openbox-lxde-session lightdm lightdm-autologin-greeter accountsservice \
chromium chromium-l10n
echo "done"

# Apply the PHP 7.4 package fix for php2shell on supported Debian 11 platforms.
. /etc/os-release
php74_fix_url=""
if [ "${VERSION_ID:-}" = "11" ] && [ "$(dpkg --print-architecture)" = "armhf" ] && [ "${ID:-}" = "raspbian" ]; then
php74_fix_url="https://openwb.de/update/openwb-php74-fix-r2-raspbian11-armhf.tar.xz"
elif [ "${VERSION_ID:-}" = "11" ] && [ "$(dpkg --print-architecture)" = "amd64" ] && [ "${ID:-}" = "debian" ]; then
php74_fix_url="https://openwb.de/update/openwb-php74-fix-r2-debian11-amd64.tar.xz"
fi

php74_fix_needed=$(dpkg-query -W -f='${db:Status-Status} ${Version}\n' \
php7.4-cli php7.4-common libapache2-mod-php7.4 2>/dev/null |
awk '$1 == "installed" && index($2, "+owphp2shell1") == 0 { needed = 1 } END { print needed + 0 }')

if [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 1 ]; then
(
set -e
workdir=$(mktemp -d "$HOME/php-fix-r2.XXXXXX")
apache_stopped=0
restart_apache() {
if [ "$apache_stopped" -eq 1 ]; then
sudo systemctl start apache2 || true
fi
}
cleanup() {
restart_apache
rm -rf "$workdir"
}
trap cleanup EXIT

echo "Applying PHP 7.4 package fix..."
curl -fL -o "$workdir/php74-fix.tar.xz" "$php74_fix_url"
tar -xf "$workdir/php74-fix.tar.xz" -C "$workdir"
package_dir=$(find "$workdir" -mindepth 1 -maxdepth 2 -type f -name SHA256SUMS -printf '%h\n' -quit)
if [ -z "$package_dir" ] || [ ! -d "$package_dir/pakete" ]; then
echo "PHP 7.4 package archive has an unexpected structure." >&2
exit 1
fi
cd "$package_dir"
sha256sum -c SHA256SUMS
sudo apt-get --simulate --no-remove install -y ./pakete/*.deb
apache_stopped=1
sudo systemctl stop apache2
sudo apt-get --no-remove install -y ./pakete/*.deb
sudo apache2ctl configtest
sudo systemctl start apache2
apache_stopped=0
dpkg-query -W php7.4-cli php7.4-common libapache2-mod-php7.4
status=$(sudo systemctl is-active "apache2" || true)
printf 'apache2: %s\n' "$status"
)
php74_fix_status=$?
if [ "$php74_fix_status" -ne 0 ]; then
echo "PHP 7.4 package fix failed." >&2
exit "$php74_fix_status"
fi
elif [ -n "$php74_fix_url" ] && [ "$php74_fix_needed" -eq 0 ]; then
echo "PHP 7.4 package fix for php2shell is already applied."
elif [ -z "$php74_fix_url" ]; then
echo "PHP 7.4 package fix for php2shell is not supported on this platform."
fi
16 changes: 10 additions & 6 deletions web/maintenance/systeminfo.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -101,12 +101,16 @@ <h2 id="details-modal-header">Details</h2>
for (const subKey in value) {
if (Object.hasOwn(value, subKey)) {
const v = value[subKey];
html += `<tr><th>${subKey}`;
const label =
key === "softwareInfo" && subKey === "php_version"
? "PHP-Version"
: subKey;
html += `<tr><th>${label}`;
// Falls "details" vorhanden, einen runden Info-Button anzeigen
if (v && typeof v === "object" && "details" in v) {
const infoBtnId = `info_${key}_${subKey}`.replace(
/\W/g,
"_"
"_",
);
html += ` <button class="details-button" data-details="${v.details}">i</button>`;
}
Expand Down Expand Up @@ -171,7 +175,7 @@ <h2 id="details-modal-header">Details</h2>
}, 2000);
alert(
"Fehler beim Neustart: " +
(result.message || result.output || "")
(result.message || result.output || ""),
);
}
} catch (err) {
Expand Down Expand Up @@ -291,7 +295,7 @@ <h2>${key}</h2>
const data = value.map((e) =>
typeof e.v === "object" && e.v !== null && "value" in e.v
? Number(e.v.value)
: Number(e.v)
: Number(e.v),
);
// Einheit für Achsenlabel holen
let unit = "";
Expand Down Expand Up @@ -347,7 +351,7 @@ <h2>${key}</h2>
const data = arr.map((e) =>
typeof e.v === "object" && e.v !== null && "value" in e.v
? Number(e.v.value)
: Number(e.v)
: Number(e.v),
);
const chartKey = `${key}_${subKey}`;
// Einheit für Achsenlabel holen
Expand Down
14 changes: 14 additions & 0 deletions web/maintenance/systeminfo_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ function getSoftwareInfo()
$version = 'unbekannt';
// $branch = 'unbekannt';
$commit = 'unbekannt';
$phpVersion = 'unbekannt';
$phpPackage = 'php' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '-cli';
$phpPackageInfo = trim((string)@shell_exec(
"dpkg-query -W -f='\${db:Status-Status}|\${Version}' " .
escapeshellarg($phpPackage) .
" 2>/dev/null"
));
if (strpos($phpPackageInfo, 'installed|') === 0) {
$phpVersion = substr($phpPackageInfo, strlen('installed|'));
}

// Git-Verzeichnis bestimmen (eine Ebene höher als "web")
$repoDir = dirname(__DIR__, 2);
Expand Down Expand Up @@ -189,6 +199,10 @@ function getSoftwareInfo()
'git_commit' => [
'value' => $commit,
'unit' => ''
],
'php_version' => [
'value' => $phpVersion,
'unit' => ''
]
];
}
Expand Down
Loading