Skip to content

Instantly share code, notes, and snippets.

@kelchm
Created February 24, 2014 14:52
Show Gist options
  • Select an option

  • Save kelchm/9189738 to your computer and use it in GitHub Desktop.

Select an option

Save kelchm/9189738 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Hostname
echo "Hostname: "
read hostname
hostname $hostname
sed -ri "s#^HOSTNAME=.*#HOSTNAME=$hostname#" /etc/sysconfig/network
# IPs
echo "eth0 IP: "
read eth0ip
sed -ri "s#^IPADDR=.*#IPADDR=$eth0ip#" /etc/sysconfig/network-scripts/ifcfg-eth0
echo "eth1 IP: "
read eth1ip
sed -ri "s#^IPADDR=.*#IPADDR=$eth1ip#" /etc/sysconfig/network-scripts/ifcfg-eth1
# Makes the partition fill the whole disk
parted /dev/sdb --script -- mkpart primary 0 -1
mkfs.ext4 /dev/sdb1
#Solus Installer Streamlined
YUM_PATH=/usr/bin/yum
WGET_PATH=/usr/bin/wget
MKDIR_PATH=/bin/mkdir
CLEAR_PATH=/usr/bin/clear
ECHO_PATH=/bin/echo
PRINTF_PATH=/usr/bin/printf
TAR_PATH=/bin/tar
PHP_PATH=/usr/bin/php
$CLEAR_PATH
$MKDIR_PATH -p /usr/local/solusvm/tmp/
PRELOG=/tmp/preinstall.log
TMP1=/tmp/version.txt
TMP2=/tmp/type.txt
MIRROR=http://files.soluslabs.com
$ECHO_PATH "6" > /tmp/version.txt
#Solus Versions
$ECHO_PATH "1" > /tmp/svmversion.txt
SVM_VERSION=`cat /tmp/svmversion.txt`
#Set Mirror
MIRRORLIST="/tmp/mirrorlist.txt"
$ECHO_PATH "files.eu.fr.soluslabs.com" > $MIRRORLIST
$ECHO_PATH "files.eu.uk.soluslabs.com" >> $MIRRORLIST
$ECHO_PATH "files.us.tx.soluslabs.com" >> $MIRRORLIST
$ECHO_PATH "files.us.az.soluslabs.com" >> $MIRRORLIST
BESTMIRROR="/tmp/bestmirror.txt"
rm -f $BESTMIRROR
$ECHO_PATH ""
$PRINTF_PATH " Checking fastest mirror "
while read line
do
$PRINTF_PATH "."
if [ "${line}" == "" ]; then
sleep 1
else
M=$(ping $line -B -w 2 -n -c 2 2>/dev/null | grep rtt | awk -F '/' '{print $5}')
if [ "${M}" == "" ]; then
echo 999999 $line >> $BESTMIRROR
else
echo $M $line >> $BESTMIRROR
fi
fi
done <$MIRRORLIST
BEST=`cat $BESTMIRROR | sort -n | sed -e /^$/d | head -1 | awk '{print $2}'`
$ECHO_PATH "http://$BEST" > /tmp/filemirror.txt
$ECHO_PATH ""
$ECHO_PATH " Using $BEST"
MIRROR=`cat /tmp/filemirror.txt`
$ECHO_PATH ""
$ECHO_PATH "Please Wait, Installing Dependencies for RHEL 6...";
$YUM_PATH -y install glibc glibc-devel glibc-devel.i686 perl php php-cli php-common >> $PRELOG 2>&1
$WGET_PATH $MIRROR/solusvm/loaders/ioncube_loaders_lin_x86_64.tar.gz -O /usr/local/solusvm/tmp/ioncube_loaders.tar.gz >> $PRELOG 2>&1
$WGET_PATH $MIRROR/solusvm/loaders/php.ini.64.6 -O /etc/php.ini >> $PRELOG 2>&1
userdel solusvm >> $PRELOG 2>&1
adduser -d /usr/local/solusvm -s /sbin/nologin solusvm >> $PRELOG 2>&1
$WGET_PATH http://repo.soluslabs.com/centos/soluslabs.repo -O /etc/yum.repos.d/soluslabs.repo >> $PRELOG 2>&1
$YUM_PATH clean all >> $PRELOG 2>&1
$TAR_PATH vxzf /usr/local/solusvm/tmp/ioncube_loaders.tar.gz -C /etc/ >> $PRELOG 2>&1
$WGET_PATH $MIRROR/solusvm/installer/v3/installscripts.tar.gz -O /usr/local/solusvm/tmp/installscripts.tar.gz >> $PRELOG 2>&1
$MKDIR_PATH -p /usr/local/solusvm/tmp/.install/
$TAR_PATH vxzf /usr/local/solusvm/tmp/installscripts.tar.gz -C /usr/local/solusvm/tmp/.install/ >> $PRELOG 2>&1
chown root:root /usr/local/solusvm/tmp/.install/*
chmod +x /usr/local/solusvm/tmp/.install/*
$PHP_PATH /usr/local/solusvm/tmp/.install/slave --virt=openvz --templates=none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment