| 1 | DATE:=`date --iso-8601` |
| 2 | |
| 3 | # make sure perms are right, gets called at the end of many routines |
| 4 | chown-www: |
| 5 | chown -R www-data:www-data /var/www |
| 6 | |
| 7 | # recipes for installing this thing onto a "real" (non-chroot) system |
| 8 | setup-real-system: probe-files install-pkgs install-drupal do-mysql chown-www |
| 9 | |
| 10 | # test that we have /install-{drupal-toolchain,packages}.sh /pkgs /sqldefaults and /do-mysql-sh |
| 11 | # if we don't have all of these files, BAD THINGS may happen |
| 12 | probe-files: |
| 13 | [ -f /install-packages.sh ] |
| 14 | [ -f /pkgs ] |
| 15 | [ -f /install-drupal-toolchain.sh ] |
| 16 | [ -f /do-mysql.sh ] |
| 17 | [ -f /sqldefaults ] |
| 18 | |
| 19 | install-drupal: |
| 20 | chmod +x /install-drupal-toolchain.sh |
| 21 | /install-drupal-toolchain.sh |
| 22 | |
| 23 | install-pkgs: |
| 24 | chmod +x /install-packages.sh |
| 25 | /install-packages.sh |
| 26 | |
| 27 | do-mysql: |
| 28 | chmod +x /do-mysql.sh |
| 29 | /do-mysql.sh |
| 30 | # secure these two files because they contain passwords in plaintext |
| 31 | chmod og-rwx /do-mysql.sh |
| 32 | chmod 0600 /sqldefaults |
| 33 | |
| 34 | # recipes to restore the site from a backup |
| 35 | install-from-backups: probe-backup-files install-sqldump install-drupal-sites chown-www |
| 36 | |
| 37 | probe-backup-files: |
| 38 | [ -f /sqldump ] |
| 39 | [ -f /sites && -d /sites ] |
| 40 | # [ -f /boycottsony.org.conf ] |
| 41 | # [ -f /dayagainstdrm.org.conf ] |
| 42 | # [ -f /rotten-apple.org.conf ] |
| 43 | # [ -f /defectivebydesign.org.conf ] |
| 44 | |
| 45 | install-sqldump: |
| 46 | # source the dump twice - once to create the DB, once to populate it |
| 47 | mysql -u root -p -e 'source /sqldump; source /sqldump' |
| 48 | |
| 49 | install-drupal-sites: |
| 50 | cd /var/www/html |
| 51 | cp -r /sites sites |
| 52 | |
| 53 | #install-apache-sites-conf: |
| 54 | # cp /*.conf /etc/apache2/sites-available/ |
| 55 | # a2ensite boycottsony.org |
| 56 | # a2ensite dayagainstdrm.org |
| 57 | # a2ensite rotten-apple.org |
| 58 | # a2ensite www.defectivebydesign.org |
| 59 | # systemctl reload apache2 |
| 60 | |
| 61 | # recipes for building a chroot. notice that sql does not cooperate with chroots, due to some funky postinstall hooks and /proc namespaces conflicting |
| 62 | build-chroot: new-chroot install-pkgs-in-chroot install-drupal-toolchain |
| 63 | |
| 64 | new-chroot: |
| 65 | rm -rf tristrap |
| 66 | mkdir tristrap |
| 67 | debootstrap --merged-usr etiona ./tristrap/ http://mirror.fsf.org/trisquel/ |
| 68 | |
| 69 | install-pkgs-in-chroot: |
| 70 | cp files/pkgs tristrap |
| 71 | cp files/install-packages.sh tristrap |
| 72 | chmod +x tristrap/install-packages.sh |
| 73 | chroot tristrap /install-packages.sh |
| 74 | |
| 75 | install-drupal-toolchain: |
| 76 | cp files/install-drupal-toolchain.sh tristrap |
| 77 | chmod +x tristrap/install-drupal-toolchain.sh |
| 78 | chroot tristrap /install-drupal-toolchain.sh |