usage() {
cat <<EOF
-usage: drin $(basename $0 .sh) [-h|--help] <destdir>
+usage: drin $(basename "$0" .sh) [-h|--help] <destdir>
Create a new Drupal project in the 'destdir' directory.
git remote rename origin upstream
git checkout -b master
-echo >> .gitignore
-echo "# Ignore the configuration for the bootstrap script" >> .gitignore
-echo "bootstrap.conf" >> .gitignore
-# Add some patches, use sed until composer can do that from the command line
-# (e.g. composer config ...)
-sed -i -e 's@"extra": {@"extra": {\
- "patches-file": "composer.patches.json",@' composer.json
+# Add some patches
+composer config extra.patches-file "composer.patches.json"
cat > composer.patches.json <<EOF
{
# "ip6-localhost"
# )
-#MYSQL_ROOT_PASSWORD="password"
+# See the 'drin' man page for details about database access.
+
+# Set MYSQL_PASSWORDLESS_ACCESS to 'true' if the database is configured to
+# allow administrative password-less access to the user who will execute the
+# 'drin boostrap' command.
+#MYSQL_PASSWORDLESS_ACCESS=true
+
+# If, instead, administrative access requires a password, uncomment and
+# change the values of the following variables.
+#MYSQL_SU_USER='root'
+#MYSQL_SU_PASSWORD='password'
+EOF
+
+cat >> .gitignore <<EOF
+
+# Ignore the configuration for the bootstrap script
+bootstrap.conf
EOF
echo
echo "Uncomment and customize the values in the bootstrap.conf file."
-echo "Make sure that access to '$PWD' is restricted by the web server."
+
+# Add some basic access control to protect sensitive files like bootstrap.conf
+cat > .htaccess <<EOF
+Options -Indexes
+SetEnvIf Request_URI "/web(/.*)?$" access_granted
+Order allow,deny
+Allow from env=access_granted
+EOF
+
+echo
+echo "Double check the provided .htaccess file to make sure that access to"
+echo "'$PWD' is restricted by the web server."
popd