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.
This commit is contained in:
parent
036c17647e
commit
dc5c1d3ef0
@ -113,6 +113,7 @@ if ! grep -q "databasus" "$PG_HBA"; then
|
|||||||
systemctl reload postgresql
|
systemctl reload postgresql
|
||||||
fi
|
fi
|
||||||
$STD sudo -u postgres psql -c "CREATE DATABASE databasus;" 2>/dev/null || true
|
$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_ok "Created Database"
|
||||||
|
|
||||||
msg_info "Creating Databasus Service"
|
msg_info "Creating Databasus Service"
|
||||||
|
|||||||
@ -3870,18 +3870,7 @@ EOF
|
|||||||
sleep 3
|
sleep 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Continue with standard container setup
|
|
||||||
msg_info "Customizing LXC Container"
|
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
|
# Continue with standard container setup
|
||||||
if [ "$var_os" == "alpine" ]; then
|
if [ "$var_os" == "alpine" ]; then
|
||||||
sleep 3
|
sleep 3
|
||||||
@ -3893,11 +3882,20 @@ EOF'
|
|||||||
else
|
else
|
||||||
sleep 3
|
sleep 3
|
||||||
LANG=${LANG:-en_US.UTF-8}
|
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) && \
|
# Devuan templates don't include locales package by default - install it first
|
||||||
echo LANG=\$locale_line >/etc/default/locale && \
|
if [ "$var_os" == "devuan" ]; then
|
||||||
locale-gen >/dev/null && \
|
pct exec "$CTID" -- bash -c "apt-get update >/dev/null && apt-get install -y locales >/dev/null" || true
|
||||||
export LANG=\$locale_line"
|
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
|
if [[ -z "${tz:-}" ]]; then
|
||||||
tz=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "UTC")
|
tz=$(timedatectl show --property=Timezone --value 2>/dev/null || echo "UTC")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user