Skip to content

Commit 4dc75dc

Browse files
committed
Fix shellcheck warnings from code review
- Fix NCUSER typo -> NCDBUSER in nextcloud_update.sh - Replace indirect exit code check with direct check in nextcloud_install_production.sh
1 parent 2df0399 commit 4dc75dc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

nextcloud_install_production.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,16 +365,15 @@ install_if_not postgresql
365365
# Create DB with proper permissions for Nextcloud 30+
366366
# PostgreSQL 15+ requires explicit schema permissions
367367
cd /tmp
368-
sudo -u postgres psql <<END
368+
if ! sudo -u postgres psql <<END
369369
CREATE USER $PGDB_USER WITH PASSWORD '$PGDB_PASS';
370370
CREATE DATABASE nextcloud_db WITH OWNER $PGDB_USER TEMPLATE template0 ENCODING 'UTF8';
371371
\c nextcloud_db
372372
GRANT CREATE ON SCHEMA public TO $PGDB_USER;
373373
GRANT ALL ON SCHEMA public TO $PGDB_USER;
374374
ALTER DATABASE nextcloud_db OWNER TO $PGDB_USER;
375375
END
376-
377-
if [ $? -ne 0 ]; then
376+
then
378377
print_text_in_color "$IRed" "Failed to create PostgreSQL database with proper permissions!"
379378
print_text_in_color "$ICyan" "Please report this to $ISSUES"
380379
exit 1

nextcloud_update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ then
9292
ncdb
9393

9494
# Check if we need to apply the fix (test if user can create tables)
95-
if sudo -u postgres psql -d "$NCDB" -c "SELECT has_schema_privilege('$NCUSER', 'public', 'CREATE');" 2>/dev/null | grep -q "f"
95+
if sudo -u postgres psql -d "$NCDB" -c "SELECT has_schema_privilege('$NCDBUSER', 'public', 'CREATE');" 2>/dev/null | grep -q "f"
9696
then
9797
print_text_in_color "$ICyan" "Applying PostgreSQL schema permission fix for Nextcloud 30+..."
9898

0 commit comments

Comments
 (0)