From dc5c1d3ef06a0739bff2cb0706585f1a927abed5 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:47:38 +0100 Subject: [PATCH] Improve locale setup and database user privileges Add command to grant superuser, createrole, and createdb privileges to the postgres user during Databasus installation. Enhance LXC container customization by installing locales for Devuan templates and only configuring locale if locale.gen exists, improving compatibility with minimal templates. --- install/databasus-install.sh | 1 + misc/build.func | 30 ++++++++++++++---------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/install/databasus-install.sh b/install/databasus-install.sh index 4ecf2d9fa..0b068d865 100644 --- a/install/databasus-install.sh +++ b/install/databasus-install.sh @@ -113,6 +113,7 @@ if ! grep -q "databasus" "$PG_HBA"; then systemctl reload postgresql fi $STD sudo -u postgres psql -c "CREATE DATABASE databasus;" 2>/dev/null || true +$STD sudo -u postgres psql -c "ALTER USER postgres WITH SUPERUSER CREATEROLE CREATEDB;" 2>/dev/null || true msg_ok "Created Database" msg_info "Creating Databasus Service" diff --git a/misc/build.func b/misc/build.func index 7e5e0a794..20a20e985 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3870,18 +3870,7 @@ EOF sleep 3 fi - # Continue with standard container setup msg_info "Customizing LXC Container" - - # # Install GPU userland if configured - # if [[ "${ENABLE_VAAPI:-0}" == "1" ]]; then - # install_gpu_userland "VAAPI" - # fi - - # if [[ "${ENABLE_NVIDIA:-0}" == "1" ]]; then - # install_gpu_userland "NVIDIA" - # fi - # Continue with standard container setup if [ "$var_os" == "alpine" ]; then sleep 3 @@ -3893,11 +3882,20 @@ EOF' else sleep 3 LANG=${LANG:-en_US.UTF-8} - pct exec "$CTID" -- bash -c "sed -i \"/$LANG/ s/^# //\" /etc/locale.gen" - pct exec "$CTID" -- bash -c "locale_line=\$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print \$1}' | head -n 1) && \ - echo LANG=\$locale_line >/etc/default/locale && \ - locale-gen >/dev/null && \ - export LANG=\$locale_line" + + # Devuan templates don't include locales package by default - install it first + if [ "$var_os" == "devuan" ]; then + pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y locales >/dev/null" || true + fi + + # Only configure locale if locale.gen exists (some minimal templates don't have it) + if pct exec "$CTID" -- test -f /etc/locale.gen 2>/dev/null; then + pct exec "$CTID" -- bash -c "sed -i \"/$LANG/ s/^# //\" /etc/locale.gen" + pct exec "$CTID" -- bash -c "locale_line=\$(grep -v '^#' /etc/locale.gen | grep -E '^[a-zA-Z]' | awk '{print \$1}' | head -n 1) && \ + echo LANG=\$locale_line >/etc/default/locale && \ + locale-gen >/dev/null && \ + export LANG=\$locale_line" + fi if [[ -z "${tz:-}" ]]; then tz=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "UTC")