summaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorBjörn Geiger2011-06-25 17:00:18 +0200
committerBjörn Geiger2011-06-25 17:00:18 +0200
commit41552d6ca2662fdcf8dafcf60543fb1d4d9a02be (patch)
treeeef8ce9de0a3dfa95c88b8f05dbd5d06e9750764 /install.sh
parentLayout hinzugefügt (diff)
downloadpoolctrl-41552d6ca2662fdcf8dafcf60543fb1d4d9a02be.tar.gz
poolctrl-41552d6ca2662fdcf8dafcf60543fb1d4d9a02be.tar.xz
poolctrl-41552d6ca2662fdcf8dafcf60543fb1d4d9a02be.zip
Setup hinzugefügt
Diffstat (limited to 'install.sh')
-rwxr-xr-xinstall.sh87
1 files changed, 87 insertions, 0 deletions
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..07ad438
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+#
+# Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
+# This program is free software distributed under the GPL version 2.
+# See http://gpl.openslx.org/
+#
+# If you have any feedback please consult http://feedback.openslx.org/ and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+
+# Absolute path to this script. /home/user/bin/foo.sh
+echo "Copying to /var/www/"
+
+sourceDir=$(readlink -f $(dirname $(readlink -f $0)))
+echo -n "enter vhost name: "
+read vhost_name
+targetDir="/var/www/$vhost_name"
+mkdir -p $targetDir
+cp -R $sourceDir/* $targetDir
+
+echo "Creating poolctrl host..."#
+mkdir -p $targetDir/library
+ln -sf /usr/share/php/libzend-framework-php/Zend $targetDir/library/
+cat > /etc/apache2/sites-available/$vhost_name << EOF
+<VirtualHost *:80>
+ ServerName $vhost_name
+ ServerAdmin admin@$vhost_name
+ DocumentRoot $targetDir/public
+ <Directory $targetDir/public >
+ Options FollowSymLinks
+ AllowOverride All
+ </Directory>
+</VirtualHost>
+EOF
+
+echo "Enabling poolctrl host..."
+a2ensite $vhost_name
+echo "Restarting apache..."
+apachectl restart
+
+echo "Creating config of poolctrl..."
+cp $targetDir/application/configs/application.ini.dist $targetDir/application/configs/application.ini
+
+echo -n "Please enter db admin user [root]: "
+read db_admin
+[ "x" = "x$db_admin" ] && db_admin="root"
+
+echo -n "Please enter the password for db admin user $db_admin: "
+stty -echo
+read db_adminpass
+stty echo
+
+echo -n "Please enter username for poolctrl db: "
+read db_user
+sed -e "13s/\$/$db_user/" -i $targetDir/application/configs/application.ini
+
+#echo -n "Please enter password for poolctrl db user $databaseuser: "
+#read databasepassword
+db_pass=$(md5sum /var/log/syslog| awk '{print $1}')
+sed -e "14s/\$/$db_pass/" -i $targetDir/application/configs/application.ini
+
+echo -n "Enter database name: "
+read db_name
+sed -e "15s/\$/$db_name/" -i $targetDir/application/configs/application.ini
+
+echo "Create database and tables"
+cat $targetDir/setup/poolctrl.sql | sed -e "s,##poolctrl##,$db_name," > /tmp/poolctrl.sql
+mysql -u $db_admin -p$db_adminpass < /tmp/poolctrl.sql
+rm /tmp/poolctrl.sql
+
+echo "Create db user"
+echo "GRANT ALL PRIVILEGES ON ${db_name}.* TO '${db_user}'@'localhost'" > /tmp/poolctrl-admin.sql
+echo " IDENTIFIED BY '${db_pass}' WITH GRANT OPTION;" >> /tmp/poolctrl-admin.sql
+echo "FLUSH PRIVILEGES;" >> /tmp/poolctrl-admin.sql
+mysql -u $db_admin -p$db_adminpass mysql < /tmp/poolctrl-admin.sql
+rm /tmp/poolctrl-admin.sql
+
+echo "Import demo data"
+cat $targetDir/setup/poolctrl_data.sql | sed -e "s,##poolctrl##,$db_name," > /tmp/poolctrl-data.sql
+mysql -u $db_user -p$db_pass < /tmp/poolctrl-data.sql
+rm /tmp/poolctrl-data.sql
+#mysql -u $databaseuser -p$databasepassword < $targetDir/setup/poolctrl.sql
+#mysql -u $databaseuser -p$databasepassword < $targetDir/setup/poolctrl_data.sql
+
+echo "woho - poolctrl is ready to use"
+echo "You can reach your installed poolctrl server under http://$vhost_name/"