Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error in 10-database.init prevents wwinit from running with postgresql as backend #215

Open
runapp opened this issue Jan 8, 2020 · 1 comment

Comments

@runapp
Copy link

runapp commented Jan 8, 2020

I think it's just a typo. Here is the patch

--- 10-database.init	2020-01-09 04:05:04.865557421 +0800
+++ /usr/lib/warewulf/wwinit/10-database.init	2020-01-09 04:03:34.952053469 +0800
@@ -228,19 +228,19 @@
     else
         wwprint "Database version: UNDEF (need to create database)\n"
         perl -e 'use Warewulf::DataStore::SQL::PostgreSQL;print Warewulf::DataStore::SQL::PostgreSQL->database_schema_string();' > "${SCRIPT_TMPDIR}/schema"
-        if [ $? -eq 0 -a -f "${SCRIPT_TMPDIR}/schema" -a $(wc -l "${SCRIPT_TMPDIR}/schema") ]; then
+        if [ $? -eq 0 -a -f "${SCRIPT_TMPDIR}/schema" ]; then
             wwprint "Creating database schema"
             if [ $PSQL_USE_SUDO -ne 0 ]; then
                 #
                 # The database server user will need access to the file:
                 #
-                chmod 755 "${SCHEMA_TMPDIR}"
-                chmod 644 "${SCHEMA_TMPDIR}/schema"
+                chmod 755 "${SCRIPT_TMPDIR}"
+                chmod 644 "${SCRIPT_TMPDIR}/schema"
             fi
-            OUTPUT="$(psql_do_cmd --dbname="$DBNAME" --file="${SCHEMA_TMPDIR}/schema" 2>&1)"
+            OUTPUT="$(psql_do_cmd --dbname="$DBNAME" --file="${SCRIPT_TMPDIR}/schema" 2>&1)"
             rc=$?
             if [ $PSQL_USE_SUDO -ne 0 ]; then
-                chmod 700 "${SCHEMA_TMPDIR}"
+                chmod 700 "${SCRIPT_TMPDIR}"
             fi
             if [ $rc -eq 0 ]; then
                 reply_success
@bensallen
Copy link
Member

Hi @runapp thanks for reporting this. Any chance you can help us out and push this change as pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants