veizour 6 лет назад
Родитель
Сommit
3afb9e8699
1 измененных файлов с 65 добавлено и 67 удалено
  1. 65 67
      firstrun.sh

+ 65 - 67
firstrun.sh

@@ -21,71 +21,69 @@ else
 #  cron
 #  cron
 fi
 fi
 
 
-if [ -f /etc/apache2/sites-enabled/000-default.conf ]; then
-  rm /etc/apache2/sites-enabled/000-default.conf
-fi
-if [ -f var/www/html/ossn/configurations/ossn.config.site ]; then
-  rm var/www/html/ossn/configurations/ossn.config.site
-fi
-if [ -f /var/www/html/ossn/configurations/ossn.config.db ]; then
-  rm /var/www/html/ossn/configurations/ossn.config.db
-fi
-# Generate ossn conf files
-echo \
-     "<VirtualHost *:80>\n" \
-     "ServerAdmin "$adminlogin"\n" \
-     "DocumentRoot /var/www/html/\n" \
-     "ServerName "$servername"\n" \
-     "\n" \
-     "<Directory /var/www/html/>\n" \ 
-     "     Options FollowSymlinks\n" \
-     "     AllowOverride All\n" \
-     "     Require all granted\n" \
-     "</Directory>\n" \
-     "\n" \
-     "ErrorLog ${APACHE_LOG_DIR}/ossn_error.log\n" \
-     "CustomLog ${APACHE_LOG_DIR}/ossn_access.log combined\n" \
-     "\n" \
-     "</VirtualHost>" > /etc/apache2/sites-enabled/000-default.conf
-     
-echo \
-     "<?php\n" \
-     "/**\n" \
-     " * Open Source Social Network\n" \
-     " *\n" \
-     " * @package   (softlab24.com).ossn\n" \
-     " * @author    OSSN Core Team <info@softlab24.com>\n" \
-     " * @copyright (C) SOFTLAB24 LIMITED\n" \
-     " * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence\n" \
-     " * @link      https://www.opensource-socialnetwork.org/\n" \
-     " */\n" \
-     "\n" \
-     "$Ossn->url = '"$servername"';\n" \
-     "$Ossn->userdata = '"$DataDirectory"';\n" > /var/www/html/ossn/configurations/ossn.config.site
+if [ -f /var/www/html/ossn ]; then
+  echo "Using existing OSSN install"
+else
+  wget https://www.opensource-socialnetwork.org/download_ossn/latest/build.zip --directory-prefix=/tmp
+  unzip /tmp/build.zip -d /tmp
+  cp -R /tmp/ossn/. /var/www/html/ossn/.
+  unzip /tmp/build.zip -d /tmp
+  cp -R /tmp/ossn/. /var/www/html/ossn/.
 
 
-echo \
-     "<?php\n" \
-     "/**\n" \
-     " * Open Source Social Network\n" \
-     " *\n" \
-     " * @package   (softlab24.com).ossn\n" \
-     " * @author    OSSN Core Team <info@softlab24.com>\n" \
-     " * @copyright (C) SOFTLAB24 LIMITED\n" \
-     " * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence\n" \
-     " * @link      https://www.opensource-socialnetwork.org/\n" \
-     " */\n" \
-     "\n" \
-     "// replace <<host>> with your database host name;\n" \
-     "$Ossn->host = '"$DBHost"';\n" \
-     "\n" \
-     "// replace <<port>> with your database host name;\n" \
-     "$Ossn->port = '"$DBPort"';\n" \
-     "\n" \
-     "// replace <<user>> with your database username;\n" \
-     "$Ossn->user = '"$DBUser"';\n" \
-     "\n" \
-     "// replace <<password>> with your database password;\n" \
-     "$Ossn->password = '"$DBPassword"';\n" \
-     "\n" \
-     "// replace <<dbname>> with your database name;\n" \
-     "$Ossn->database = '"$DBName"';" > /var/www/html/ossn/configurations/ossn.config.db
+  # Generate ossn conf files
+  echo "<VirtualHost *:80>" > /etc/apache2/sites-enabled/000-default.conf
+  echo "ServerAdmin "$adminlogin  >> /etc/apache2/sites-enabled/000-default.conf
+  echo "DocumentRoot /var/www/html/"  >> /etc/apache2/sites-enabled/000-default.conf
+  echo "ServerName "$servername  >> /etc/apache2/sites-enabled/000-default.conf
+  echo "" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "<Directory /var/www/html/>"  >> /etc/apache2/sites-enabled/000-default.conf
+  echo "     Options FollowSymlinks" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "     AllowOverride All" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "     Require all granted" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "</Directory>" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "ErrorLog ${APACHE_LOG_DIR}/ossn_error.log" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "CustomLog ${APACHE_LOG_DIR}/ossn_access.log combined" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "" >> /etc/apache2/sites-enabled/000-default.conf
+  echo "</VirtualHost>" >> /etc/apache2/sites-enabled/000-default.conf
+
+  echo "<?php" > /var/www/html/ossn/configurations/ossn.config.site
+  echo "/**" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * Open Source Social Network" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " *" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * @package   (softlab24.com).ossn" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * @author    OSSN Core Team <info@softlab24.com>" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * @copyright (C) SOFTLAB24 LIMITED" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " * @link      https://www.opensource-socialnetwork.org/" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo " */" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo "$Ossn->url = '"$servername"';" >> /var/www/html/ossn/configurations/ossn.config.site
+  echo "$Ossn->userdata = '"$DataDirectory"';" >> /var/www/html/ossn/configurations/ossn.config.site
+
+  echo "<?php" > /var/www/html/ossn/configurations/ossn.config.db
+  echo "/**" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * Open Source Social Network" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " *" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * @package   (softlab24.com).ossn" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * @author    OSSN Core Team <info@softlab24.com>" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * @copyright (C) SOFTLAB24 LIMITED" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * @license   Open Source Social Network License (OSSN LICENSE)  http://www.opensource-socialnetwork.org/licence" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " * @link      https://www.opensource-socialnetwork.org/" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo " */" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "// replace <<host>> with your database host name;" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "$Ossn->host = '"$DBHost"';" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "// replace <<port>> with your database host name;" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "$Ossn->port = '"$DBPort"';" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "// replace <<user>> with your database username;" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "$Ossn->user = '"$DBUser"';" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "// replace <<password>> with your database password;" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "$Ossn->password = '"$DBPassword"';" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "// replace <<dbname>> with your database name;" >> /var/www/html/ossn/configurations/ossn.config.db
+  echo "$Ossn->database = '"$DBName"';" >> /var/www/html/ossn/configurations/ossn.config.db
+fi