|
@@ -1,4 +1,12 @@
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
|
+# Config
|
|
|
|
+ENVIROMENT="prod";
|
|
|
|
+TMP="/tmp/omni-setup";
|
|
|
|
+if [[ "$1" != "" ]];then
|
|
|
|
+ ENVIROMENT="$1";
|
|
|
|
+fi;
|
|
|
|
+REGISTER_URL="http://api.omnimaga.org/register/$ENVIROMENT";
|
|
|
|
+PHPMYADMIN_URL="http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.9/phpMyAdmin-4.2.9-english.tar.xz";
|
|
# Functions for logging
|
|
# Functions for logging
|
|
section(){
|
|
section(){
|
|
echo "=> Starting Section \"$@\"";
|
|
echo "=> Starting Section \"$@\"";
|
|
@@ -29,6 +37,20 @@ if [ "$(id -u)" != "0" ]; then
|
|
exit;
|
|
exit;
|
|
fi;
|
|
fi;
|
|
# Actually run the install
|
|
# Actually run the install
|
|
|
|
+
|
|
|
|
+section "Registering";
|
|
|
|
+log "Getting IDs";
|
|
|
|
+mkdir -p /tmp/omni-setup;
|
|
|
|
+sublog "Hostname";
|
|
|
|
+wget -q "$REGISTER_URL/hostname" -O $TMP/hostname;
|
|
|
|
+if [[ "$(cat $TMP/hostname)" == "" ]];then
|
|
|
|
+ hostname > $TMP/hostname;
|
|
|
|
+fi;
|
|
|
|
+hostname $(cat $TMP/hostname);
|
|
|
|
+cp $TMP/hostname /etc/hostname;
|
|
|
|
+sublog "MySQL ID";
|
|
|
|
+wget -q "$REGISTER_URL/mysql-id" -O $TMP/mysql-id;
|
|
|
|
+
|
|
section "Package Installation";
|
|
section "Package Installation";
|
|
log "LAMP Stack";
|
|
log "LAMP Stack";
|
|
install lamp-server^;
|
|
install lamp-server^;
|
|
@@ -51,10 +73,18 @@ echo "export PATH=$PATH:/opt/omnimaga/bin;" > /etc/profile.d/omnimaga-server-uti
|
|
. /etc/profile.d/omnimaga-server-utils.sh;
|
|
. /etc/profile.d/omnimaga-server-utils.sh;
|
|
sublog "getting files";
|
|
sublog "getting files";
|
|
rm -rf /opt/omnimaga/bin;
|
|
rm -rf /opt/omnimaga/bin;
|
|
-git clone https://github.com/Omnimaga/server-utils.git /opt/omnimaga/bin/;
|
|
|
|
|
|
+git clone -q https://github.com/Omnimaga/server-utils.git /opt/omnimaga/bin/;
|
|
chmod a+x /opt/omnimaga/bin/*;
|
|
chmod a+x /opt/omnimaga/bin/*;
|
|
subinfo "Add users to the group omnimaga-utils to allow access";
|
|
subinfo "Add users to the group omnimaga-utils to allow access";
|
|
-
|
|
|
|
|
|
+log "phpmyadmin";
|
|
|
|
+sublog "Downloading";
|
|
|
|
+wget -q $PHPMYADMIN_URL -O $TMP/pma.tar.xz;
|
|
|
|
+sublog "Extracting";
|
|
|
|
+tar -C $TMP/ -xf $TMP/pma.tar.xz;
|
|
|
|
+sublog "Copying";
|
|
|
|
+mkdir -p /var/www/phpmyadmin/;
|
|
|
|
+cp -R $TMP/phpMyAdmin-*/{*,.[a-zA-Z0-9]*} /var/www/phpmyadmin/;
|
|
|
|
+cp data/var/www/phpmyadmin/config.inc.php /var/www/phpmyadmin/;
|
|
|
|
|
|
section "Config";
|
|
section "Config";
|
|
log "Setting up sudoers";
|
|
log "Setting up sudoers";
|
|
@@ -65,4 +95,6 @@ groupadd -f web;
|
|
updatesudo sudoers.d/web;
|
|
updatesudo sudoers.d/web;
|
|
sublog "ircd";
|
|
sublog "ircd";
|
|
groupadd -f ircd;
|
|
groupadd -f ircd;
|
|
-updatesudo sudoers.d/ircd;
|
|
|
|
|
|
+updatesudo sudoers.d/ircd;
|
|
|
|
+sublog "mysqld";
|
|
|
|
+cp data/etc/mysql/conf.d/replication.cnf /etc/mysql/conf.d/replication.cnf;
|