]> git.proxmox.com Git - dab-pve-appliances.git/blame - archive/debian-6.0-wordpress/wordpress_setup
move older, now EOL releases, to archive folder
[dab-pve-appliances.git] / archive / debian-6.0-wordpress / wordpress_setup
CommitLineData
ab650faa
DM
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides: wordpress_siteconfig
4# Required-Start: $remote_fs mysql +mysql_randompw
5# Required-Stop:
6# X-Start-Before: apache2
7# Default-Start: 2
8# Default-Stop:
9# Short-Description: Generate Wordpress Siteconfig
10# Description: Generate Wordpress
11### END INIT INFO
12
13set -e
14
15DOMAIN=`grep '^search' /etc/resolv.conf|awk '{ print $2; }'`
16HNAME=`head -n 1 /etc/hostname|awk '{ print $1; }'`
17
18if [ "X${HNAME}" = "Xlocalhost" ] ; then
19 exit 0;
20fi
21
22echo "Generate Wordpress Siteconfig"
23
24# set HOME dir (for .my.cfg)
25export HOME=/root
26export USER=root
27
28PASSWD=`openssl rand -base64 9`
29
30mysql <<EOF
31# create the wordpress database user
32CREATE DATABASE wordpress;
33CREATE USER wordpress IDENTIFIED BY '${PASSWD}';
34GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY '${PASSWD}';
35FLUSH PRIVILEGES;
36QUIT
37EOF
38
39SKEY1=`openssl rand -base64 42`
40SKEY2=`openssl rand -base64 42`
41SKEY3=`openssl rand -base64 42`
42SKEY4=`openssl rand -base64 42`
43
44cat <<EOF > /var/www/wordpress/wp-config.php
45<?php
46// ** MySQL settings - You can get this info from your web host ** //
47/** The name of the database for WordPress */
48define('DB_NAME', 'wordpress');
49
50/** MySQL database username */
51define('DB_USER', 'wordpress');
52
53/** MySQL database password */
54define('DB_PASSWORD', '${PASSWD}');
55
56/** MySQL hostname */
57define('DB_HOST', 'localhost');
58
59/** Database Charset to use in creating database tables. */
60define('DB_CHARSET', 'utf8');
61
62/** The Database Collate type. Don't change this if in doubt. */
63define('DB_COLLATE', '');
64
65/**#@+
66 * Authentication Unique Keys.
67 *
68 * Change these to different unique phrases!
69 * You can generate these using the {@link http://api.wordpress.org/secret-key/1.1/ WordPress.org secret-key service}
70 *
71 * @since 2.6.0
72 */
73define('AUTH_KEY', '${SKEY1}');
74define('SECURE_AUTH_KEY', '${SKEY2}');
75define('LOGGED_IN_KEY', '${SKEY3}');
76define('NONCE_KEY', '${SKEY4}');
77/**#@-*/
78
79/**
80 * WordPress Database Table prefix.
81 *
82 * You can have multiple installations in one database if you give each a unique
83 * prefix. Only numbers, letters, and underscores please!
84 */
85\$table_prefix = 'wp_';
86
87/**
88 * WordPress Localized Language, defaults to English.
89 *
90 * Change this to localize WordPress. A corresponding MO file for the chosen
91 * language must be installed to wp-content/languages. For example, install
92 * de.mo to wp-content/languages and set WPLANG to 'de' to enable German
93 * language support.
94 */
95define ('WPLANG', '');
96
97/* That's all, stop editing! Happy blogging. */
98
99/** WordPress absolute path to the Wordpress directory. */
100if ( !defined('ABSPATH') )
101 define('ABSPATH', dirname(__FILE__) . '/');
102
103/** Sets up WordPress vars and included files. */
104require_once(ABSPATH . 'wp-settings.php');
105?>
106EOF
107
108insserv -r wordpress_setup
109rm -f /etc/init.d/wordpress_setup
110