agave the dbd autobuild project its own directory
[eostre.git] / dbd-autobuild / Makefile
diff --git a/dbd-autobuild/Makefile b/dbd-autobuild/Makefile
new file mode 100644 (file)
index 0000000..d31b2d2
--- /dev/null
@@ -0,0 +1,78 @@
+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 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
+probe-files:
+       [ -f /install-packages.sh ]
+       [ -f /pkgs ]
+       [ -f /install-drupal-toolchain.sh ]
+       [ -f /do-mysql.sh ]
+       [ -f /sqldefaults ]
+
+install-drupal:
+       chmod +x /install-drupal-toolchain.sh
+       /install-drupal-toolchain.sh
+
+install-pkgs:
+       chmod +x /install-packages.sh
+       /install-packages.sh
+
+do-mysql:
+       chmod +x /do-mysql.sh
+       /do-mysql.sh
+       # secure these two files because they contain passwords in plaintext
+       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 ]
+#      [ -f /boycottsony.org.conf ]
+#      [ -f /dayagainstdrm.org.conf ]
+#      [ -f /rotten-apple.org.conf ]
+#      [ -f /defectivebydesign.org.conf ]
+
+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
+
+#install-apache-sites-conf:
+#      cp /*.conf /etc/apache2/sites-available/
+#      a2ensite boycottsony.org
+#      a2ensite dayagainstdrm.org
+#      a2ensite rotten-apple.org
+#      a2ensite www.defectivebydesign.org
+#      systemctl reload apache2
+
+# 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
+
+new-chroot:
+       rm -rf tristrap
+       mkdir tristrap
+       debootstrap --merged-usr etiona ./tristrap/ http://mirror.fsf.org/trisquel/
+
+install-pkgs-in-chroot:
+       cp files/pkgs tristrap
+       cp files/install-packages.sh tristrap
+       chmod +x tristrap/install-packages.sh
+       chroot tristrap /install-packages.sh
+
+install-drupal-toolchain:
+       cp files/install-drupal-toolchain.sh tristrap
+       chmod +x tristrap/install-drupal-toolchain.sh
+       chroot tristrap /install-drupal-toolchain.sh