Version 1.1
Author: Federico Pereira info@opentecnologic.com
Copyright 2009 Federico Pereira (LordBaseX)
This script is licensed under GNU GPL version 2.0
En este articulo voy a documentar como crear un ISO desatendido (Unattended) a partir de una imágen de Debian Lenny 5.X. La idea es que todos los colaboradores se documenten antes de aportar código.
El método que vamos a usar para crear el ISO se llama debian-installer. Con esto vamos a lograr Automatizar la instalación de Debian para luego ejecutar nuestro script de instalación de Asterisk y otros paquetes.
Para lograr esto se necesita descargar la imágen de Debian Lenny 5.x (La última) montar la imágen y hacer una copia en nuestro HD agregar unos archivos, entre ellos el archivo de pre-instalación donde elegimos especificamos que hacer a la hora de ser instalado.
El archivo de pre-instalación consta de las siguientes etapas:
De esta manera sabiendo la teoría vamos a la practica.
Nota: Es necesario tener una máquina con Debian Lenny 5.X para replicar la misma guía. Si no sos usuario de Debian, GNU/Linux es recomendable instalar una máquina virtual para crear el iso.
La ideas principal es que sea totalmente desatendido sin uso de internet, sin necesidad de una persona tomando decisiones de que tiene que instalar.
Para lograr eso se tuvo que resolver varios problemas.
Primero bajamos el ISO de Debian Lenny 5.X usamos el manejador de descarga que mas te guste. Yo lo voy a bajar con wget porque me parece más cómodo y si se me corta la conexión lo puedo continuar con wget -c :)
wget http://cdimage.debian.org/debian-cd/5.0.3/i386/iso-cd/debian-503-i386-CD-1.iso -O /mnt/
Una ves que tengamos descargado el ISO lo movemos al directorio /mnt para poder organizar nuestro trabajo. Creamos dos directorios que se va a llamar debpbx y cd.
En el directorio /mnt/debpbx montamos el ISO de Debian y después sincronizamos el directorio debpbx a cd para tener una copia 100% igual directorio.
Instalamos unos paquetes que vamos a necesitar que son: rsync subversion mkisofs
aptitude install rsync subversion mkisofs mkdir /mnt/cd mkdir /mnt/debpbx mount -o loop /mnt/debian-503-i386-CD-1.iso /mnt/debpbx/ rsync -a -H --exclude=TRANS.TBL /mnt/debpbx/ /mnt/cd umount /mnt/debpbx
gpg --gen-key
Esto lo hacemos una sola ves. Y después como vamos a estar trabajando constantemente en los ISO que creemos, prueba y error vamos a usar un script básico para crear el iso y no estar cada rato haciendo la misma tarea. Creanme que es tedioso hacerlo cada rato.. por eso el script, se puede hacer a mano (NO LO RECOMIENDO).
Anteriormente hablamos sobre crear un archivo de pre-instalación, este archivo se llama http://www.debpbx.org/pub/debpbx/preseed.cfg el cual lo vamos a agregar en el archivo initrd.gz el cual esta comprimido. Hay que crear un directorio y descomprimir initrd.gz agregar el archivo preseed.cfg volver a comprimir el archivo. Luego tendremos que actualizar el md5sum.txt que esta dentro de /mnt/cd
Vamos a crear un script para usar cada ves que queramos armar un nuevo ISO podamos ejecutar un comando y nos ahorre tiempo. El comando se va a llamar dpcreatoriso <DebPBX creator ISO> lo vamos a guardar en el path donde se guardan los comandos, para que en cualquier directorio podamos escribir el comando y realice su propósito.
nano /usr/local/sbin/dpcreateiso
Y pegamos el contenido siguiente dentro de dpcreateiso
#!/bin/bash
# Backup Repositorio DebPBX - 20/11/09
#
# DebPBX-1.2.10
# Author: Federico Pereira <info@opentecnologic.com>
# Copyright 2008 Federico Pereira (LordBaseX)
# This script is licensed under GNU GPL version 2.0
#
#
VER_VERSION="1.2.10";
VER_ASTERISK="1.4.27";
VER_ADDONS="1.4.9";
VER_DAHDI_LINUX="2.2.0.2";
VER_DAHDI_TOOLS="2.2.0";
VER_LIBPRI="1.4.10.2";
VER_FREEPBX="2.6.0RC2";
VER_A2BILLING="1.4.1";
VER_VTIGERCRM="5.1.0";
VER_AVANTFAX="3.1.6";
#CORE_SOUNDS_VERSION=$(cat /tmp/asterisk-${VER_ASTERISK}/sounds/Makefile | grep -i "CORE_SOUNDS_VERSION:=" | cut -f2 -d '=')
#EXTRA_SOUNDS_VERSION=$(cat /tmp/asterisk-${VER_ASTERISK}/sounds/Makefile | grep -i "EXTRA_SOUNDS_VERSION:=" | cut -f2 -d '=')
CORE_SOUNDS_VERSION="1.4.16";
EXTRA_SOUNDS_VERSION="1.4.9";
KERNEL_VERSION=`uname -r`
KERNEL_VERSION=`echo ${KERNEL_VERSION} | sed -e "s/\-\(.*\)//"`
KERNEL_UP_VERSION=`echo ${KERNEL_VERSION} | sed -e "s/\(2\.[4,6]\)\(.*\)/\1/"`
if [ -x /mnt/cd/debpbx ]
then
echo "Ya fue descargado los paquetes y dependencias."
else
echo "+----------------------------------------------------------------+"
echo "| Preparando descarga de paquetes deb |"
echo "+----------------------------------------------------------------+"
rm /etc/apt/sources.list
touch /etc/apt/sources.list
echo "
deb http://ftp.us.debian.org/debian/ lenny main non-free contrib
deb-src http://ftp.us.debian.org/debian/ lenny main non-free contrib
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
deb http://oktan.ls.fi.upm.es/debian-multimedia/ stable main
deb-src http://oktan.ls.fi.upm.es/debian-multimedia/ stable main
" >> /etc/apt/sources.list
wget http://oktan.ls.fi.upm.es/debian-multimedia/pool/main/d/debian-multimedia-keyring/debian-multimedia-keyring_2008.10.16_all.deb -O /var/cache/apt/archives/debian-multimedia-keyring_2008.10.16_all.deb
dpkg -i /var/cache/apt/archives/debian-multimedia-keyring_2008.10.16_all.deb
aptitude update
aptitude -y safe-upgrade
aptitude -y -d install dpkg-dev grub2 startupmanager grub2-splashimages desktop-base
aptitude -y -d install linux-source-$KERNEL_VERSION kernel-package g++ libncurses5-dev linux-libc-dev sqlite libnewt-dev libusb-dev zlib1g-dev libmysqlclient15-dev libsqlite0-dev loco mc unzip zip iptraf nmap vrms screen subversion libqt4-core libqt4-gui ntpdate tcpdump libiksemel-dev libtiff4-dev cmake libxml2-dev bison libaudiofile-dev
aptitude -y -d install linux-headers-`uname -r` build-essential hylafax-server iaxmodem bind9 postfix ghostscript netpbm libungif4-dev sudo cups expect libmagic-dev
aptitude -y -d install apache2 php5 php5-common php5-cli mysql-server-5.0 php-pear php5-mysql php-db libapache2-mod-php5 php5-gd php5-curl libapache2-mod-perl2 php5-dev php5-ldap php5-mhash php5-odbc php5-mcrypt curl libwww-perl php5-imap python-setuptools python-mysqldb python-sqlalchemy python-psycopg2 imagemagick phpmyadmin
aptitude -y -d install apache2-mpm-prefork apache2-utils apache2.2-common libapr1 libaprutil1 libsqlite3-0 libnetpbm10-dev libungif-bin php-mail php-mail-mime php-file psutils rsync
aptitude -y -d install munin munin-node mpg123 sox lame libmad0 libmad0-dev
echo "+----------------------------------------------------------------+"
echo "| Creando repositorio local con firma |"
echo "+----------------------------------------------------------------+"
mkdir -p /usr/local/debpbx/dists/sarge/main/binary-i386
ln -s /usr/local/debpbx/dists/sarge /usr/local/debpbx/dists/testing
cd /usr/local/debpbx
gpg -a --export > /usr/local/debpbx/debpbx_key_pub.gpg
mv /var/cache/apt/archives/*.deb dists/sarge/main/binary-i386
echo
"
Archive: DebPBX
Version: ${VER_VERSION}
Component: main
Origin: DebPBX
Label: DebPBX
Architecture: i386
Description: DebPBX local repository
" >> /usr/local/debpbx/dists/sarge/main/binary-i386/Release
apt-ftparchive packages dists/sarge/main/binary-i386 /dev/null > dists/sarge/main/binary-i386/Packages
gzip -9c dists/sarge/main/binary-i386/Packages > dists/sarge/main/binary-i386/Packages.gz
echo "
APT::FTPArchive::Release::Origin "Federico Pereira";
APT::FTPArchive::Release::Label "Descriptive label";
APT::FTPArchive::Release::Suite "DebPBX";
APT::FTPArchive::Release::Codename "sarge";
APT::FTPArchive::Release::Architectures "i386";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Description "More detailed description";
" >> /usr/local/debpbx/apt-sarge-release.conf
apt-ftparchive -c apt-sarge-release.conf release dists/sarge/ > dists/sarge/Release
clear
echo "+----------------------------------------------------------------+"
echo "| Firmardo repositorio local |"
echo "+----------------------------------------------------------------+"
echo ""
echo "Se requiere la asistenacia humana."
echo "Coloque la clave que genero anteriormente con el comando gpg --gen-key"
echo "Se le solicitara dos veses la clave para firmar el repositorio."
cd /usr/local/debpbx/dists/sarge
gpg -bao Release.gpg Release
cd /usr/local/debpbx/dists/sarge/main/binary-i386
gpg -bao Release.gpg Release
fi
echo "+----------------------------------------------------------------+"
echo "| varios |"
echo "+----------------------------------------------------------------+"
CON_URL="0";
OP=" -O ";
declare -a DOWNLOADS
declare -a PATH_FILE
declare -a SIZE
if [ -x /mnt/cd/debpbx ]
then
echo "El archivo existe"
else
mkdir -p /mnt/cd/debpbx/pub/telephony/asterisk
mkdir -p /mnt/cd/debpbx/pub/telephony/dahdi-linux
mkdir -p /mnt/cd/debpbx/pub/telephony/dahdi-tools
mkdir -p /mnt/cd/debpbx/pub/telephony/libpri
mkdir -p /mnt/cd/debpbx/pub/telephony/firmware/releases
mkdir -p /mnt/cd/debpbx/pub/telephony/sounds/releases
mkdir -p /mnt/cd/debpbx/pub/tools
mkdir -p /mnt/cd/debpbx/pub/pear/
mkdir -p /mnt/cd/install.386/auto/
mkdir -p /mnt/cd/install.386/advance/
mkdir -p /mnt/cd/install.386/normal/
mkdir -p /mnt/cd/install.386/test/
rm -fr /mnt/cd/install.386/gtk/
#Repositorio
tar -cpf /mnt/cd/debpbx/pub/tools/repositorio.tar.gz /usr/local/debpbx/
fi
DOWNLOADS=(
http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-${VER_ASTERISK}.tar.gz
http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-addons-${VER_ADDONS}.tar.gz
http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-${VER_DAHDI_LINUX}.tar.gz
http://downloads.asterisk.org/pub/telephony/dahdi-tools/releases/dahdi-tools-${VER_DAHDI_TOOLS}.tar.gz
http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-${VER_LIBPRI}.tar.gz
http://mirror.freepbx.org/freepbx-${VER_FREEPBX}.tar.gz
http://www.asterisk2billing.org/downloads/A2Billing_${VER_A2BILLING}.tar.gz
http://sourceforge.net/projects/vtigercrm/files/vtiger%20CRM%205.1.0/vtigercrm-${VER_VTIGERCRM}.tar.gz
http://switch.dl.sourceforge.net/sourceforge/avantfax/avantfax-${VER_AVANTFAX}.tgz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-064-1.05.01.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-oct6114-128-1.05.01.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-tc400m-MR6.12.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fw-vpmadt032-1.07.tar.gz
http://downloads.digium.com/pub/telephony/firmware/releases/dahdi-fwload-vpmadt032-1.17.0.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-${CORE_SOUNDS_VERSION}.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-${CORE_SOUNDS_VERSION}.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-${CORE_SOUNDS_VERSION}.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-ulaw-1.4.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-alaw-1.4.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-core-sounds-es-g729-1.4.tar.gz
http://asterio.com.ar/resources/downloads/ThaisaC-core-sounds-g729-1.4.12.1.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-${EXTRA_SOUNDS_VERSION}.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-${EXTRA_SOUNDS_VERSION}.tar.gz
http://downloads.digium.com/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-${EXTRA_SOUNDS_VERSION}.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-ulaw-1.4.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-alaw-1.4.tar.gz
http://www.voipnovatos.es/voces/voipnovatos-extra-sounds-es-g729-1.4.tar.gz
http://asterio.com.ar/resources/downloads/ThaisaC-extra-sounds-g729-1.4.12.tar.gz
http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-ulaw.tar.gz
http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-alaw.tar.gz
http://downloads.asterisk.org/pub/telephony/sounds/releases/asterisk-moh-opsound-g729.tar.gz
http://download.pear.php.net/package/Structures_Graph-1.0.3.tgz
http://download.pear.php.net/package/Mail_mimeDecode-1.5.1.tgz
http://download.pear.php.net/package/Archive_Tar-1.3.3.tgz
http://download.pear.php.net/package/Net_Socket-1.0.9.tgz
http://download.pear.php.net/package/XML_Util-1.2.1.tgz
http://download.pear.php.net/package/PEAR-1.9.0.tgz
http://download.pear.php.net/package/Net_SMTP-1.3.4.tgz
http://download.pear.php.net/package/Mail_Mime-1.5.2.tgz
http://download.pear.php.net/package/Mail-1.1.14.tgz
http://download.pear.php.net/package/MDB2_Driver_mysql-1.4.1.tgz
http://download.pear.php.net/package/Fileinfo-1.0.4.tgz
)
PATH_FILE=(
/mnt/cd/debpbx/pub/telephony/asterisk/asterisk-${VER_ASTERISK}.tar.gz
/mnt/cd/debpbx/pub/telephony/asterisk/asterisk-addons-${VER_ADDONS}.tar.gz
/mnt/cd/debpbx/pub/telephony/dahdi-linux/dahdi-linux-${VER_DAHDI_LINUX}.tar.gz
/mnt/cd/debpbx/pub/telephony/dahdi-tools/dahdi-tools-${VER_DAHDI_TOOLS}.tar.gz
/mnt/cd/debpbx/pub/telephony/libpri/libpri-${VER_LIBPRI}.tar.gz
/mnt/cd/debpbx/pub/tools/freepbx-${VER_FREEPBX}.tar.gz
/mnt/cd/debpbx/pub/tools/A2Billing_${VER_A2BILLING}.tar.gz
/mnt/cd/debpbx/pub/tools/vtigercrm-${VER_VTIGERCRM}.tar.gz
/mnt/cd/debpbx/pub/tools/avantfax-${VER_AVANTFAX}.tgz
/mnt/cd/debpbx/pub/telephony/firmware/releases/dahdi-fw-oct6114-064-1.05.01.tar.gz
/mnt/cd/debpbx/pub/telephony/firmware/releases/dahdi-fw-oct6114-128-1.05.01.tar.gz
/mnt/cd/debpbx/pub/telephony/firmware/releases/dahdi-fw-tc400m-MR6.12.tar.gz
/mnt/cd/debpbx/pub/telephony/firmware/releases/dahdi-fw-vpmadt032-1.07.tar.gz
/mnt/cd/debpbx/pub/telephony/firmware/releases/dahdi-fwload-vpmadt032-1.17.0.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-core-sounds-en-ulaw-${CORE_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-core-sounds-en-alaw-${CORE_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-core-sounds-en-g729-${CORE_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-core-sounds-es-ulaw-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-core-sounds-es-alaw-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-core-sounds-es-g729-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/ThaisaC-core-sounds-g729-1.4.12.1.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-extra-sounds-en-ulaw-${EXTRA_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-extra-sounds-en-alaw-${EXTRA_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-extra-sounds-en-g729-${EXTRA_SOUNDS_VERSION}.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-extra-sounds-es-ulaw-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-extra-sounds-es-alaw-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/voipnovatos-extra-sounds-es-g729-1.4.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/ThaisaC-extra-sounds-g729-1.4.12.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-moh-opsound-ulaw.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-moh-opsound-alaw.tar.gz
/mnt/cd/debpbx/pub/telephony/sounds/releases/asterisk-moh-opsound-g729.tar.gz
/mnt/cd/debpbx/pub/pear/Structures_Graph-1.0.3.tgz
/mnt/cd/debpbx/pub/pear/Mail_mimeDecode-1.5.1.tgz
/mnt/cd/debpbx/pub/pear/Archive_Tar-1.3.3.tgz
/mnt/cd/debpbx/pub/pear/Net_Socket-1.0.9.tgz
/mnt/cd/debpbx/pub/pear/XML_Util-1.2.1.tgz
/mnt/cd/debpbx/pub/pear/PEAR-1.9.0.tgz
/mnt/cd/debpbx/pub/pear/Net_SMTP-1.3.4.tgz
/mnt/cd/debpbx/pub/pear/Mail_Mime-1.5.2.tgz
/mnt/cd/debpbx/pub/pear/Mail-1.1.14.tgz
/mnt/cd/debpbx/pub/pear/MDB2_Driver_mysql-1.4.1.tgz
/mnt/cd/debpbx/pub/pear/Fileinfo-1.0.4.tgz
)
DOWNLOAD_ERROR=()
clear
for URL in ${DOWNLOADS[@]}
do
CON_PRO=$(($CON_PRO+1))
wget -q --spider $URL
if [ $? -eq 0 ]; then
wget -o log --spider $URL
CHECK=$(cat log | grep Longitud | cut -f2 -d ' ')
echo -e '\E[37;44m'"\033[1m$CON_PRO Check to file $URL - SIZE: $CHECK - OK\033[0m"
SIZE[$CON_PRO]=$CHECK
else
echo -e '\E[37;41m'"\033[1m$CON_PRO Check to file $URL - ERROR\033[0m"
echo ""
echo "+-------------------------------------------------------------------+"
echo "| ERROR DE COMPROBACIÓN LINKS |"
echo "| Edite el link roto para solucionar el problema. |"
echo "+-------------------------------------------------------------------+"
echo ""
exit 1
fi
done
for DURL in ${PATH_FILE[@]}
do
if [ -f $DURL ]
then
echo "$DURL - El archivo existe $CHECK_SIDE"
else
echo -e '\E[37;41m'"\033[1m$DURL - NO EXISTE. SE PROCEDERA A DESCARGARLO\033[0m"
wget ${DOWNLOADS[$CON_URL]} $OP $DURL
fi
CON_URL=$(($CON_URL+1))
done
if [ -x /mnt/cd/debpbx/pub/debpbx ]
then
rm -rf /mnt/cd/debpbx/pub/debpbx
fi
svn checkout http://debpbx.googlecode.com/svn/trunk/ /mnt/cd/debpbx/pub/debpbx
sed -i "s/99991/\"$VER_VERSION\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99992/\"$VER_ASTERISK\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99993/\"$VER_ADDONS\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99994/\"$VER_DAHDI_LINUX\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99995/\"$VER_DAHDI_TOOLS\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99996/\"$VER_LIBPRI\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99997/\"$VER_FREEPBX\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99998/\"$VER_A2BILLING\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/99999/\"$VER_VTIGERCRM\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
sed -i "s/11111/\"$VER_AVANTFAX\";/g" "/mnt/cd/debpbx/pub/debpbx/autoinstall"
rm -fr /mnt/cd/isolinux/
cp -R /mnt/cd/debpbx/pub/debpbx/isolinux/ /mnt/cd/
#preseed auto
mkdir /mnt/irmod1
cd /mnt/irmod1
gzip -d < ../cd/install.386/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
cp /mnt/cd/debpbx/pub/debpbx/preseed.cfg /mnt/irmod1/preseed.cfg
find . | cpio -H newc --create --verbose | gzip -9 > ../cd/install.386/auto/initrd.gz
cd ../
rm -fr irmod1/
#preseed advance
mkdir /mnt/irmod2
cd /mnt/irmod2
gzip -d < ../cd/install.386/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
cp /mnt/cd/debpbx/pub/debpbx/preseed-adv.cfg /mnt/irmod2/preseed.cfg
find . | cpio -H newc --create --verbose | gzip -9 > ../cd/install.386/advance/initrd.gz
cd ../
rm -fr irmod2/
#preseed nornal
mkdir /mnt/irmod3
cd /mnt/irmod3
gzip -d < ../cd/install.386/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
cp /mnt/cd/debpbx/pub/debpbx/preseed-normal.cfg /mnt/irmod3/preseed.cfg
find . | cpio -H newc --create --verbose | gzip -9 > ../cd/install.386/normal/initrd.gz
cd ../
rm -fr irmod3/
#preseed test
mkdir /mnt/irmod4
cd /mnt/irmod4
gzip -d < ../cd/install.386/initrd.gz | cpio --extract --verbose --make-directories --no-absolute-filenames
cp /mnt/cd/debpbx/pub/debpbx/preseed-test.cfg /mnt/irmod4/preseed.cfg
find . | cpio -H newc --create --verbose | gzip -9 > ../cd/install.386/test/initrd.gz
cd ../
rm -fr irmod4/
cd /mnt/cd
md5sum `find -follow -type f` > md5sum.txt
cd /mnt
mkisofs -o debpbx-${VER_VERSION}.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ./cd
echo ""
echo "Felicitaciones el ISO se a creado con éxito"
echo "/mnt/debpbx-${VER_VERSION}.iso"
echo ""
echo "+----------------------------------------------------------------+"
echo "| Done, enjoy |"
echo "+----------------------------------------------------------------+"
exit 0
chmod +x /usr/local/sbin/dpcreateiso
dpcreateiso