From ec923628a3a61cf22c4ba655730a0d0a867b644b Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 22 Feb 2018 13:08:39 +0000 Subject: #730: Integrar versiĆ³n OpenGnsys 1.1.0 en rama principal. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://opengnsys.es/svn/branches/version1.1@5606 a21b9725-9963-47de-94b9-378ad31fedc9 --- installer/vagrant/Vagrantfile-1.0.6b-vbox | 152 ++++++++++++++++++++++++++++++ installer/vagrant/Vagrantfile-trunk-vbox | 87 ++++++++++------- 2 files changed, 205 insertions(+), 34 deletions(-) create mode 100644 installer/vagrant/Vagrantfile-1.0.6b-vbox (limited to 'installer/vagrant') diff --git a/installer/vagrant/Vagrantfile-1.0.6b-vbox b/installer/vagrant/Vagrantfile-1.0.6b-vbox new file mode 100644 index 00000000..2db25e1c --- /dev/null +++ b/installer/vagrant/Vagrantfile-1.0.6b-vbox @@ -0,0 +1,152 @@ +# Vagrantfile to install old OpenGnSys 1.0.6b virtual environment using VirtualBox provider. + +VAGRANTFILE_API_VERSION = "2" +# VM provider: Oracle VM VirtualBox. +ENV['VAGRANT_DEFAULT_PROVIDER'] = "virtualbox" +# Language (accepted values: es_ES, ca_ES, en_GB). +LANGUAGE = "es_ES" +ENV['LC_ALL'] = LANGUAGE + ".UTF-8" +# Number of OpenGnsys clients (accepted values: from 2 to 9). +NCLIENTS = 4 +# Repository virtual disk: file and size (GB). +REPODISK = "ogRepo.vdi" +REPOSIZE = 50 +# Amount of memory for server and clients (MB) +SERVERMEM = 1024 # Minimum: 512 +CLIENTMEM = 512 # Minimum: 256 +# Clients MAC address prefix. +MACPREFIX = "08:00:27:0E:65" +NETPREFIX = "192.168.2" +# Local port to access OpenGnsys Server. +LOCALWEBPORT = 8443 + +# OpenGnsys Server provisioning script: prepare repo disk, install OpenGnsys, change default interface, configure DHCP server. +OGSERVERSCRIPT = </dev/null; then + apt-get update + apt-get install -y lvm2 + fi + pvcreate /dev/sdb + vgcreate og /dev/sdb + vgchange -ay + lvcreate -ay -n images -l 100%VG og + mkfs -t ext4 /dev/mapper/og-images + mkdir -p /opt/opengnsys/images + echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab + mount -a +fi +# Install OpenGnsys and change server address. +wget -q https://opengnsys.es/svn/tags/opengnsys-1.0.6b/installer/opengnsys_installer.sh -O - | bash || exit $? +mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log +echo y | /opt/opengnsys/bin/setserveraddr eth1 +# Insert DHCP data. +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf +done +service isc-dhcp-server restart +# Set language. +export LANG="#{LANGUAGE}.UTF-8" +echo "LANG=\"$LANG\"" > /etc/default/locale +echo "LANG=\"$LANG\"" >> /etc/environment +locale-gen --lang #{LANGUAGE} +sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard +dpkg-reconfigure -fnoninteractive console-setup +# Comment out next lines for automatic data insertion. +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#done +#mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" +#if ! grep -q "1\.0" /opt/opengnsys/doc/VERSION.txt; then AUX=1; fi +#/opt/opengnsys/bin/setclientmode ogAdmin pc11 $AUX +#for ((i=12; i<=#{NCLIENTS+10}; i++)); do +# /opt/opengnsys/bin/setclientmode ogClient pc$i $AUX +#done +echo "New OpenGnsys local URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +EOT + +# Client 1 OS provisioning script. +MODELSCRIPT = <> /etc/fstab + echo "/dev/mapper/og-images /opt/opengnsys/images ext4 defaults 0 0" >> /etc/fstab mount -a fi # Install OpenGnsys and change server address. -wget -q http://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O - | bash || exit $? +wget -q https://opengnsys.es/svn/trunk/installer/opengnsys_installer.sh -O - | bash || exit $? mv /opt/opengnsys/log/bash.log /opt/opengnsys/log/opengnsys_installer.log -echo y | sudo /opt/opengnsys/bin/setserveraddr eth1 +echo y | /opt/opengnsys/bin/setserveraddr enp0s8 # Insert DHCP data. -for ((i=#{NCLIENTS}; i>0; i--)); do - sed -i "/^}$/ i host ogClient0${i} { hardware ethernet #{MACPREFIX}0${i}; fixed-address #{NETPREFIX}1${i}; }" /etc/dhcp/dhcpd.conf +for ((i=#{NCLIENTS+10}; i>10; i--)); do + sed -i "/^}$/ i host pc${i} { hardware ethernet #{MACPREFIX}:${i}; fixed-address #{NETPREFIX}.${i}; }" /etc/dhcp/dhcpd.conf done service isc-dhcp-server restart # Set language. @@ -49,24 +54,38 @@ locale-gen --lang #{LANGUAGE} sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"${LANG%_*}\"/" /etc/default/keyboard dpkg-reconfigure -fnoninteractive console-setup # Comment out next lines for automatic data insertion. -#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}1', '255.255.255.0', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" -#for ((i=1; i<=#{NCLIENTS}; i++)); do -# SQL="$SQL ('ogClient0$i', '#{NETPREFIX}1$i', REPLACE('#{MACPREFIX}0$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," +#SQL="INSERT INTO aulas (nombreaula, idcentro, urlfoto, grupoid, ubicacion, puestos, modomul, ipmul, pormul, velmul, router, netmask, ntp, dns, proxy, modp2p, timep2p) VALUES ('Aula virtual', 1, 'aula.jpg', 0, 'Despliegue virtual con Vagrant.', 5, 2, '239.194.2.11', 9000, 70, '#{NETPREFIX}.1', '255.255.255.0', '', '', '', 'peer', 30); INSERT INTO ordenadores (nombreordenador, ip, mac, idaula, idrepositorio, idperfilhard, idmenu, idproautoexec, grupoid, router, mascara, arranque, netiface, netdriver, fotoord) VALUES" +#for ((i=11; i<=#{NCLIENTS+10}; i++)); do +# SQL="$SQL ('pc$i', '#{NETPREFIX}.$i', REPLACE('#{MACPREFIX}$i',':',''), 1, 1, 0, 0, 0, 0, '#{NETPREFIX}.1', '255.255.255.0', '00unknown', 'eth0', 'generic', 'fotoordenador.gif')," #done #mysql -u usuog -ppassusuog -D ogAdmBD -e "${SQL%,}" -#if ! grep -q "1\.0" /opt/opengnsys/doc/VERSION.txt; then AUX=1; fi -#/opt/opengnsys/bin/setclientmode ogAdmin ogClient01 $AUX -#for ((i=2; i<=#{NCLIENTS}; i++)); do -# /opt/opengnsys/bin/setclientmode ogClient ogClient0$i $AUX +#/opt/opengnsys/bin/setclientmode ogLiveAdmin pc11 PERM +#for ((i=12; i<=#{NCLIENTS+10}; i++)); do +# /opt/opengnsys/bin/setclientmode ogLive pc$i PERM #done -echo "New OpenGnsys local URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +echo "Notes:" +echo "- OpenGnsys Server URL: https://localhost:#{LOCALWEBPORT}/opengnsys/" +exit 0 EOT # Client 1 OS provisioning script. +OGAGENTPKG = "ogagent_1.1.0_all.deb" MODELSCRIPT = <