add recipes for restoring from backup files
authoreostre <eostre.danne@protonmail.com>
Thu, 30 Jul 2020 19:29:02 +0000 (15:29 -0400)
committereostre <eostre.danne@protonmail.com>
Thu, 30 Jul 2020 19:29:02 +0000 (15:29 -0400)
Makefile

index 758c977fcf447dd82b56393f05ed5ad923c46417..a71f48657e801ca1a91eb3119f95542863d408d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
 DATE:=`date --iso-8601`
 
+# make sure perms are right, gets called at the end of many routines
+chown-www:
+       chown -R www-data:www-data /var/www
+
 # recipes for installing this thing onto a "real" (non-chroot) system
-setup-real-system: probe-files install-pkgs install-drupal do-mysql
+setup-real-system: probe-files install-pkgs install-drupal do-mysql chown-www
 
 # test that we have /install-{drupal-toolchain,packages}.sh /pkgs /sqldefaults and /do-mysql-sh
 # if we don't have all of these files, BAD THINGS may happen
@@ -27,6 +31,21 @@ do-mysql:
        chmod og-rwx /do-mysql.sh
        chmod 0600 /sqldefaults
 
+# recipes to restore the site from a backup
+install-from-backups: probe-backup-files install-sqldump install-drupal-sites chown-www
+
+probe-backup-files:
+       [ -f /sqldump ]
+       [ -f /sites && -d /sites ]
+
+install-sqldump:
+       # source the dump twice - once to create the DB, once to populate it
+       mysql -u root -p -e 'source /sqldump; source /sqldump'
+
+install-drupal-sites:
+       cd /var/www/html
+       cp -r /sites sites
+
 # recipes for building a chroot. notice that sql does not cooperate with chroots, due to some funky postinstall hooks and /proc namespaces conflicting
 build-chroot: new-chroot install-pkgs-in-chroot install-drupal-toolchain