From 4d259b30040eb3b92f60de72b76e61b6781b2a91 Mon Sep 17 00:00:00 2001 From: Athos Ribeiro Date: Fri, 8 May 2015 15:39:11 -0300 Subject: [PATCH] Noosfero: Apply new patch for backup task --- patches/noosfero/0001-Fix-backup-task.patch | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ specs/noosfero/noosfero.spec | 4 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 patches/noosfero/0001-Fix-backup-task.patch diff --git a/patches/noosfero/0001-Fix-backup-task.patch b/patches/noosfero/0001-Fix-backup-task.patch new file mode 100644 index 0000000..8da0085 --- /dev/null +++ b/patches/noosfero/0001-Fix-backup-task.patch @@ -0,0 +1,52 @@ +From 3b814b256441be6e0fc98cb1afa695c4f13d6849 Mon Sep 17 00:00:00 2001 +From: Athos Ribeiro +Date: Fri, 8 May 2015 15:13:40 -0300 +Subject: [PATCH] Fix backup task + +- Adds host option to the postgres commands where necessary. +- Passes -h option to tar when compressing in order to follow symlinks. + +Signed-off-by: Athos Ribeiro +Signed-off-by: Lucas Kanashiro +--- + lib/tasks/backup.rake | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/lib/tasks/backup.rake b/lib/tasks/backup.rake +index 7e64d17..14b2418 100644 +--- a/lib/tasks/backup.rake ++++ b/lib/tasks/backup.rake +@@ -25,9 +25,10 @@ task :backup => :check_backup_support do + dump = File.join('tmp/backup', backup_name) + '.sql' + + database = $config['production']['database'] +- sh "pg_dump #{database} > #{dump}" ++ host = $config['production']['host'] ++ sh "pg_dump -h #{host} #{database} > #{dump}" + +- sh 'tar', 'caf', backup_file, dump, *dirs ++ sh 'tar', 'chaf', backup_file, dump, *dirs + rm_f dump + + puts "****************************************************" +@@ -81,14 +82,15 @@ task :restore => :check_backup_support do + + database = $config['production']['database'] + username = $config['production']['username'] ++ host = $config['production']['host'] + + puts "WARNING: backups should be restored to an empty database, otherwise" + puts "data from the backup may not be loaded properly." + puts + puts 'You can remove the existing database and create a new one with:' + puts +- puts "$ sudo -u postgres dropdb #{database}" +- puts "$ sudo -u postgres createdb #{database} --owner #{username}" ++ puts "$ sudo -u postgres dropdb -h #{host} #{database}" ++ puts "$ sudo -u postgres createdb -h #{host} #{database} --owner #{username}" + puts + print "Are you sure you want to continue (y/N)? " + response = $stdin.gets.strip +-- +2.1.0 + diff --git a/specs/noosfero/noosfero.spec b/specs/noosfero/noosfero.spec index 043a15d..142cbb8 100644 --- a/specs/noosfero/noosfero.spec +++ b/specs/noosfero/noosfero.spec @@ -1,7 +1,7 @@ %define writable_dirs javascripts/cache stylesheets/cache articles image_uploads thumbnails Name: noosfero -Version: 1.1~rc2.4 +Version: 1.1~rc2.5 Release: 2%{?dist} Summary: Social Networking Platform Group: Applications/Publishing @@ -10,6 +10,7 @@ URL: http://noosfero.org Source0: %{name}-%{version}.tar.gz Patch0: 0001-Use-as-placeholder-for-current-user-in-URLs.patch Patch1: 0001-Enhance-existing-backup-task-and-add-a-restore-one.patch +Patch2: 0001-Fix-backup-task.patch BuildArch: noarch BuildRequires: noosfero-deps, gettext, po4a Requires: noosfero-deps, po4a, tango-icon-theme, memcached @@ -25,6 +26,7 @@ participate and contribute to this free software project! %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build -- libgit2 0.21.2