From 7bf5b31243b60190dd3f3e45e4a06cb60ae38c5c Mon Sep 17 00:00:00 2001 From: Alon Swartz Date: Sun, 15 Nov 2009 10:57:19 +0200 Subject: [PATCH] created example tklpatch for reference: drupal5 --- Makefile | 1 + examples/drupal5/conf | 54 +++++++++++++++++++ .../drupal5/overlay/etc/drupal/5/apache.conf | 22 ++++++++ .../live-installer.d/40regen-drupal5-secrets | 13 +++++ 4 files changed, 90 insertions(+) create mode 100755 examples/drupal5/conf create mode 100644 examples/drupal5/overlay/etc/drupal/5/apache.conf create mode 100755 examples/drupal5/overlay/usr/lib/live-installer.d/40regen-drupal5-secrets diff --git a/Makefile b/Makefile index 31f4d74..b40d025 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ install: mkdir -p $(INSTALL_PATH_SHARE) cp bin/* $(INSTALL_PATH_BIN) cp -a docs $(INSTALL_PATH_SHARE) + cp -a examples $(INSTALL_PATH_SHARE) uninstall: rm $(INSTALL_PATH_BIN)/$(progname)* diff --git a/examples/drupal5/conf b/examples/drupal5/conf new file mode 100755 index 0000000..ce3a1a8 --- /dev/null +++ b/examples/drupal5/conf @@ -0,0 +1,54 @@ +#!/bin/bash -ex + +HOSTNAME=drupal5 + +# set hostname +echo "$HOSTNAME" > /etc/hostname +sed -i "s|127.0.1.1 \(.*\)|127.0.1.1 $HOSTNAME|" /etc/hosts + +# start mysql daemon +/etc/init.d/mysql start + +# install drupal5 +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get -y \ + -o DPkg::Options::=--force-confdef \ + -o DPkg::Options::=--force-confold \ + install drupal5 + +# cleanup after drupal package and setup apache +rm -rf /etc/apache +rm -f /etc/apache2/conf.d/drupal.conf +touch /etc/apache2/conf.d/drupal.conf +ln -s /etc/drupal/5/apache.conf /etc/apache2/sites-available/drupal5 + +a2dissite default +a2ensite drupal5 +a2enmod rewrite + +# configure cron related +CRON_ORIG=/usr/share/drupal5/scripts/cron.sh +CRON_NEW=/etc/drupal/5/cron.sh +cp $CRON_ORIG $CRON_NEW +sed -i "s|http://localhost/drupal5|http://localhost|g" $CRON_NEW +sed -i "s|$CRON_ORIG|$CRON_NEW|g" /etc/cron.d/drupal5 + +# complete drupal installation +/etc/init.d/apache2 start +curl http://127.0.0.1/install.php?profile=default >/dev/null +curl http://127.0.0.1/cron.php >/dev/null +/etc/init.d/apache2 stop + +# set files to be writable by webserver (upload and css aggregation) +chown -R www-data: /var/lib/drupal5/files + +# configure drupal to use cleanurls by default +mysql -uroot --database=drupal5 --execute "insert into variable values('clean_url', 's:1:\"1\";'); delete from cache;" + +CONF=/etc/drupal/5/htaccess +sed -i "s|^ RewriteBase /drupal5$| #RewriteBase /drupal5|" $CONF +sed -i "s|^ #RewriteBase /$| RewriteBase /|" $CONF + +# stop mysql daemon +/etc/init.d/mysql stop + diff --git a/examples/drupal5/overlay/etc/drupal/5/apache.conf b/examples/drupal5/overlay/etc/drupal/5/apache.conf new file mode 100644 index 0000000..93ce651 --- /dev/null +++ b/examples/drupal5/overlay/etc/drupal/5/apache.conf @@ -0,0 +1,22 @@ +NameVirtualHost *:80 +NameVirtualHost *:443 + + + UseCanonicalName Off + ServerAdmin webmaster@localhost + DocumentRoot /usr/share/drupal5/ + + + + SSLEngine on + SSLCertificateFile /etc/ssl/certs/cert.pem + ServerAdmin webmaster@localhost + DocumentRoot /usr/share/drupal5/ + + + + Options +FollowSymLinks + AllowOverride All + order allow,deny + allow from all + diff --git a/examples/drupal5/overlay/usr/lib/live-installer.d/40regen-drupal5-secrets b/examples/drupal5/overlay/usr/lib/live-installer.d/40regen-drupal5-secrets new file mode 100755 index 0000000..76e9baf --- /dev/null +++ b/examples/drupal5/overlay/usr/lib/live-installer.d/40regen-drupal5-secrets @@ -0,0 +1,13 @@ +#!/bin/bash +# regenerate drupal5 mysql password + +PASSWORD=$(mcookie) + +CONF=/etc/drupal/5/sites/default/dbconfig.php +sed -i "s/\$dbpass=\(.*\)/\$dbpass=\'$PASSWORD\';/" $CONF + +CONF=/etc/dbconfig-common/drupal5.conf +sed -i "s/dbc_dbpass=\(.*\)/dbc_dbpass=\'$PASSWORD\'/" $CONF + +/usr/lib/di-live.d/??mysql-conf -u drupal5 -p $PASSWORD --chroot=/ +