X-Git-Url: https://git.p6c8.net/nextcloud-backup-restore.git/blobdiff_plain/c0c07664edd370d5385dc1eb44174bed1e5ecbbe..343e0030aec4e9213a9d432580197510d1f008be:/NextcloudRestore.sh?ds=inline diff --git a/NextcloudRestore.sh b/NextcloudRestore.sh index 3b60676..90ec545 100644 --- a/NextcloudRestore.sh +++ b/NextcloudRestore.sh @@ -111,7 +111,7 @@ if [ "${databaseSystem,,}" = "mysql" ] || [ "${databaseSystem,,}" = "mariadb" ]; errorecho "Cancel restore" exit 1 fi -elif [ "${databaseSystem,,}" = "postgresql" ]; then +elif [ "${databaseSystem,,}" = "postgresql" ] || [ "${databaseSystem,,}" = "pgsql" ]; then if ! [ -x "$(command -v psql)" ]; then errorecho "ERROR: PostgreSQL not installed (command psql not found)." errorecho "ERROR: No restore of database possible!" @@ -206,7 +206,7 @@ if [ "${databaseSystem,,}" = "mysql" ] || [ "${databaseSystem,,}" = "mariadb" ]; mysql -h localhost -u "${dbUser}" -p"${dbPassword}" -e "CREATE DATABASE ${nextcloudDatabase} CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" # TODO: Use this if the database from the backup DOES NOT use UTF8 with multibyte support (e.g. for emoijs in filenames): #mysql -h localhost -u "${dbUser}" -p"${dbPassword}" -e "CREATE DATABASE ${nextcloudDatabase}" -elif [ "${databaseSystem,,}" = "postgresql" ]; then +elif [ "${databaseSystem,,}" = "postgresql" ] || [ "${databaseSystem,,}" = "pgsql" ]; then sudo -u postgres psql -c "CREATE DATABASE ${nextcloudDatabase} WITH OWNER ${dbUser} TEMPLATE template0 ENCODING \"UTF8\";" fi @@ -217,7 +217,7 @@ echo "Restoring backup DB..." if [ "${databaseSystem,,}" = "mysql" ] || [ "${databaseSystem,,}" = "mariadb" ]; then mysql -h localhost -u "${dbUser}" -p"${dbPassword}" "${nextcloudDatabase}" < "${currentRestoreDir}/${fileNameBackupDb}" -elif [ "${databaseSystem,,}" = "postgresql" ]; then +elif [ "${databaseSystem,,}" = "postgresql" ] || [ "${databaseSystem,,}" = "pgsql" ]; then sudo -u postgres psql "${nextcloudDatabase}" < "${currentRestoreDir}/${fileNameBackupDb}" fi