]> git.proxmox.com Git - dab-pve-appliances.git/blob - 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
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
13 set -e
14
15 DOMAIN=`grep '^search' /etc/resolv.conf|awk '{ print $2; }'`
16 HNAME=`head -n 1 /etc/hostname|awk '{ print $1; }'`
17
18 if [ "X${HNAME}" = "Xlocalhost" ] ; then
19 exit 0;
20 fi
21
22 echo "Generate Wordpress Siteconfig"
23
24 # set HOME dir (for .my.cfg)
25 export HOME=/root
26 export USER=root
27
28 PASSWD=`openssl rand -base64 9`
29
30 mysql <<EOF
31 # create the wordpress database user
32 CREATE DATABASE wordpress;
33 CREATE USER wordpress IDENTIFIED BY '${PASSWD}';
34 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY '${PASSWD}';
35 FLUSH PRIVILEGES;
36 QUIT
37 EOF
38
39 SKEY1=`openssl rand -base64 42`
40 SKEY2=`openssl rand -base64 42`
41 SKEY3=`openssl rand -base64 42`
42 SKEY4=`openssl rand -base64 42`
43
44 cat <<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 */
48 define('DB_NAME', 'wordpress');
49
50 /** MySQL database username */
51 define('DB_USER', 'wordpress');
52
53 /** MySQL database password */
54 define('DB_PASSWORD', '${PASSWD}');
55
56 /** MySQL hostname */
57 define('DB_HOST', 'localhost');
58
59 /** Database Charset to use in creating database tables. */
60 define('DB_CHARSET', 'utf8');
61
62 /** The Database Collate type. Don't change this if in doubt. */
63 define('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 */
73 define('AUTH_KEY', '${SKEY1}');
74 define('SECURE_AUTH_KEY', '${SKEY2}');
75 define('LOGGED_IN_KEY', '${SKEY3}');
76 define('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 */
95 define ('WPLANG', '');
96
97 /* That's all, stop editing! Happy blogging. */
98
99 /** WordPress absolute path to the Wordpress directory. */
100 if ( !defined('ABSPATH') )
101 define('ABSPATH', dirname(__FILE__) . '/');
102
103 /** Sets up WordPress vars and included files. */
104 require_once(ABSPATH . 'wp-settings.php');
105 ?>
106 EOF
107
108 insserv -r wordpress_setup
109 rm -f /etc/init.d/wordpress_setup
110