feat: add db users

This commit is contained in:
2026-02-22 16:24:16 +01:00
parent 94e6f55e4d
commit a3b1f3ba20
2 changed files with 3 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ jobs:
env:
GIT_REFERENCE: ${{ github.ref }}
- name: Build rpm package
run: rpmbuild -ba "%(make name).spec"
run: rpmbuild -ba "$(make name).spec"
- name: Upload rpm package
run: make upload
env:

View File

@@ -23,13 +23,13 @@ Install the database management system called postgresql with a predefined confi
%post
# Create databases and users from DB_USERS variable (separator is ",") if not existing
echo "$DB_USERS" | IFS="," read -ra users
IFS="," read -ra users <<<"$DB_USERS";
for user in "${users[@]}"; do
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --invert-match postgres | grep --quiet "$user"; then
runuser --user=postgres -- createuser "$user"
runuser --user=postgres -- createdb --owner="$user" "$user"
fi
done
done
# Restart services
systemctl daemon-reload