Hello,
I am doing a fully automated install of the OS and then immediately run my ispCP "pre-installer". (it does everything up to "perl ./ispcp-setup") Now I would like to run perl ./ispcp-setup with no user interaction.
So far my script was sucessful in setting up everything for the installer and after running perl ./ispcp-setup manually everything worked.
I already know how to get all the answers required into "$VARIABLES". What i would like to know is if there is a way to pass answers to ./ispcp-setup, so the questions will no longer be posed.
My programming knowledge is very limited so I could not find out how to do what i want myself.
Could it be altered it in such a way that no more user interaction is necessary?
something like:
function_to_set_hostname_to(fqhn)
here fqhn is a placeholder that will be replaced with the real FullyQualifiedHostname, by my script before ispcp-setup is run.
The same shall be done to all other questions.
i aim to do something similar to all the questions
The purpose of this is to be able to set up servers with ispCP with NO user interaction during setup.
I apologize if this has already been covered elsewhere, if so I could not find it.
Any and all help will be greatly appreciated.
greetings
/moddie
P.S.
script so far:
-any files DLed with wget come from a machine on my local net
-any file ending in slx contains the debconf selections for programs that would otherwise ask questions at install time
-mysql_mod_install is a "castrated" version of mysql_secure_install, it basically does what is described in the install manual "http://isp-control.net/documentation/de/start/installation/debian"
Code:
#!/bin/bash
#./ispcpomega-install.sh
#ISPcpOmega auto-install by MoD
function randpw () {
echo $(( ($RANDOM + $RANDOM) * $RANDOM )) | md5sum | cut -c1-8
}
function replace {
file=$1
search=$2
replace=$3
cp $file $file.old
sed "s/$search/$replace/g" $file.old > $file
rm $file.old
}
#Usage example for replace
#replace /etc/exim4/conf.d/main/10_froxlor-config_options mysqlpassword $smpw
# generate Passwords
MPW=$(randpw) # mysql-password root
PMPW=$(randpw) # mysql-password phpmyadmin
SMPW=$(randpw) # mysql-password setup/admin
APW=$(randpw) # Iface-Admin-pw
FQDN=`hostname --fqdn`
HOST=`hostname`
DOMTLD=`hostname --fqdn | sed "s/$HOST.//g"`
echo $FQDN
echo $HOST
echo $DOMTLD
mkdir -p /usr/local/src/ispcp
cd /usr/local/src/ispcp
wget http://10.99.99.1/ISPcpOmega-install/ispcp-omega-1.0.7.tar.gz
tar -xzf ispcp-omega-1.0.7.tar.gz
wget http://10.99.99.1/ISPcpOmega-install/mysql_mod_installation
cghmod +x mysql_mod_installation
wget http://10.99.99.1/ISPcpOmega-install/sqlslx
replace sqlslx msqlrpw $MPW
replace mysql_mod_installation msqlrpw $MPW
debconf-set-selections sqlslx
wget http://10.99.99.1/ISPcpOmega-install/pfxslx
replace pfxslx domain.tld $DOMTLD
replace pfxslx fqdn $FQDN
debconf-set-selections pfxslx
wget http://10.99.99.1/ISPcpOmega-install/curslx
debconf-set-selections curslx
wget http://10.99.99.1/ISPcpOmega-install/ftpslx
debconf-set-selections ftpslx
cd ispcp-omega-1.0.7
apt-get -y install aptitude
aptitude -y install $(cat ./docs/Debian/debian-packages-`lsb_release -cs`)
make install
cp -Rv /tmp/ispcp/* /
read -p "mysql_mod_installation"
source ../mysql_mod_installation
#not finished yet, more to come ;)