diff options
Diffstat (limited to '')
-rwxr-xr-x | utility/drop_and_recreate.sh | 12 | ||||
-rwxr-xr-x | utility/trunc_and_populate.sh | 8 |
2 files changed, 17 insertions, 3 deletions
diff --git a/utility/drop_and_recreate.sh b/utility/drop_and_recreate.sh index 89734f4..5adf06b 100755 --- a/utility/drop_and_recreate.sh +++ b/utility/drop_and_recreate.sh @@ -2,6 +2,14 @@ echo "Ensure this is run from project root." echo "Dropping database..." -sudo -u postgres psql -f utility/drop_and_recreate.sql -echo "Done." +if [[ "$OSTYPE" == "openbsd"* ]]; then + #doas -u _postgresql psql -f utility/drop_and_recreate.sql + psql -U postgres -f utility/drop_and_recreate.sql +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + sudo -u postgres psql -f utility/drop_and_recreate.sql +else + echo "Cannot detect operating system" +fi + +echo "Done." diff --git a/utility/trunc_and_populate.sh b/utility/trunc_and_populate.sh index 40c049b..dd89602 100755 --- a/utility/trunc_and_populate.sh +++ b/utility/trunc_and_populate.sh @@ -1,7 +1,13 @@ #!/usr/bin/env bash echo "Truncating the database." -sudo -u postgres psql -f utility/truncate_script.sql ctrack +if [[ "$OSTYPE" == "openbsd"* ]]; then + psql -U postgres -f utility/truncate_script.sql ctrack +elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + sudo -u postgres psql -f utility/truncate_script.sql ctrack +else + echo "Cannot detect operating system" +fi sleep 1 |