version 1.0.2 boot-tools #404 #420

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2256 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/master
Antonio Doblas Viso 2011-08-02 18:23:56 +00:00
parent 93cbb10393
commit 0714cda81f
6 changed files with 195 additions and 148 deletions

View File

@ -9,11 +9,9 @@
#*/ #*/
# btGetVariables: define las constantes a utilizar # btGetVariables: define las constantes a utilizar
# Autor: Antonio J. Doblas Viso. Universidad de Málaga. # Autor: Antonio J. Doblas Viso. Universidad de Málaga.
btogGetVar() function btogGetVar()
{ {
export BTSVNBOOTTOOLS=/tmp/opengnsys_installer/opengnsys/client/boot-tools export BTSVNBOOTTOOLS=/tmp/opengnsys_installer/opengnsys/client/boot-tools
export BTSVNSHARE=/tmp/opengnsys_installer/opengnsys/client/shared export BTSVNSHARE=/tmp/opengnsys_installer/opengnsys/client/shared
@ -75,7 +73,7 @@ function btogGetOsInfo ()
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
# error code return 2 # error code return 2
btogSetFsVirtual () function btogSetFsVirtual ()
{ {
local RERROR DISKLOOP PARTLOOP #return code error local RERROR DISKLOOP PARTLOOP #return code error
@ -157,7 +155,7 @@ fi
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
# error code return 3 # error code return 3
btogSetFsBase () function btogSetFsBase ()
{ {
# Dependencias # Dependencias
@ -197,7 +195,7 @@ fi
#@version 1.0 - Compatibilidad OpengGnsys X. #@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
btogSetFsAccess() function btogSetFsAccess()
{ {
echoAndLog "$FUNCNAME: Iniciando la configuración del schroot " echoAndLog "$FUNCNAME: Iniciando la configuración del schroot "
cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime` cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
@ -243,45 +241,46 @@ return 0
#@version 1.0 - Compatibilidad OpengGnsys X. #@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
btogFsInitrd () function btogFsInitrd ()
{ {
#DEPENDENCIAS #DEPENDENCIAS
ogClientVar [ -z "$BTROOTFSIMG" ] && btogGetVar
ogClientOsInfo [ -z "$OSCODENAME" ] && btogGetOsInfo
# $1
#TODO generara md5 del kernel y del initrd. #TODO generara md5 del kernel y del initrd.
cd / cd /
schroot -c IMGogclient -- /root/GenerateInitrd.generic.sh schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsInitrdGenerate.sh
echo "cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR" echo "cp /tmp/*-${OSRELEASE} ${BTTARGETDIR}"
cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR cp /tmp/*-${OSRELEASE} ${BTTARGETDIR}
cp /tmp/initrd.img-${OSRELEASE} ${OGCLIENTBASEDIR}/oginitrd.img cp /tmp/initrd.img-${OSRELEASE} ${BTTARGETDIR}/oginitrd.img
cp /tmp/vmlinuz-${OSRELEASE} ${OGCLIENTBASEDIR}/ogvmlinuz cp /tmp/vmlinuz-${OSRELEASE} ${BTTARGETDIR}/ogvmlinuz
cd - cd -
chmod -R 755 $OGCLIENTBASEDIR chmod -R 755 $OGCLIENTBASEDIR
} }
#btogFsToSqfs convierte el sistema root en sqfs #btogFsSqfs convierte el sistema root en sqfs
#@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys. #@version 0.9 - Prototipo de sistema operativo multiarranque de opengnsys.
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2010/05/24 #@date 2010/05/24
#@version 1.0 - Compatibilidad OpengGnsys X. #@version 1.0 - Compatibilidad OpengGnsys X.
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
btogFsSqfs () function btogFsSqfs ()
{ {
#Dependencias. #Dependencias.
ogClientVar ogClientVar
echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs " echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs "
# si ya existe un sqfs lo renombramos # si ya existe un sqfs lo renombramos
[ -f $OGCLIENTBASEDIR/ogclient.sqfs ] && mv $OGCLIENTBASEDIR/ogclient.sqfs $OGCLIENTBASEDIR/ogclient.sqfs.`date +%Y%m%d-%H%M%S` [ -f $BTTARGETDIR/ogclient.sqfs ] && mv $BTTARGETDIR/ogclient.sqfs $BTTARGETDIR/ogclient.sqfs.`date +%Y%m%d-%H%M%S`
mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256 mount | grep $BTROOTFSMNT || mount $BTROOTFSIMG $BTROOTFSMNT -o loop,offset=32256
mksquashfs $OGCLIENTMOUNT $OGCLIENTBASEDIR/ogclient.sqfs mksquashfs $BTROOTFSMNT $BTTARGETDIR/ogclient.sqfs
chmod 744 $OGCLIENTBASEDIR/ogclient.sqfs chmod 744 $BTTARGETDIR/ogclient.sqfs
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT mount | grep $BTROOTFSMNT && umount $BTROOTFSMNT
} }
@ -296,9 +295,6 @@ mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
#@author Antonio J. Doblas Viso. Universidad de Malaga. #@author Antonio J. Doblas Viso. Universidad de Malaga.
#@date 2011/08/03 #@date 2011/08/03
function btogIsoGenerator { function btogIsoGenerator {
apt-get install syslinux genisoimage
#TODO: deb http://free.nchc.org.tw/drbl-core drbl stable
#apt-get install gpxe
mkdir -p /tmp/iso/isolinux mkdir -p /tmp/iso/isolinux
#cd tmp/iso/ #cd tmp/iso/
cp -prv /usr/lib/syslinux/* /tmp/iso/isolinux/ cp -prv /usr/lib/syslinux/* /tmp/iso/isolinux/
@ -320,16 +316,6 @@ MENU LABEL gpxe
KERNEL /clonezilla/live/vmlinuz1 KERNEL /clonezilla/live/vmlinuz1
APPEND initrd=/clonezilla/live/initrd1.img boot=live union=aufs noswap vga=788 ip=frommedia APPEND initrd=/clonezilla/live/initrd1.img boot=live union=aufs noswap vga=788 ip=frommedia
#default 0
#prompt 1
#timeout 100
#display mensaje.txt
LABEL 0 LABEL 0
MENU LABEL ogClient vga irqpool acpi ogdebug ip:none MENU LABEL ogClient vga irqpool acpi ogdebug ip:none
KERNEL /ogclient/linuxISO KERNEL /ogclient/linuxISO
@ -350,33 +336,24 @@ MENU LABEL ogClient ip=dhcp
KERNEL /ogclient/linuxISO KERNEL /ogclient/linuxISO
APPEND initrd=/ogclient/oginitrd.img ro acpi=off boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=dhcp APPEND initrd=/ogclient/oginitrd.img ro acpi=off boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=dhcp
#LABEL ogclient
#KERNEL /ogclient/linuxISO
#APPEND initrd=/ogclient/initrdISO.img
#KERNEL linuxISO
#APPEND initrd=initrdISO.img
LABEL 4 LABEL 4
MENU LABEL local MENU LABEL local
localboot 0x80 localboot 0x80
append - append -
label 5 label 5
MENU LABEL Network boot via gPXE lkrn MENU LABEL Network boot via gPXE lkrn
KERNEL gpxe.lkrn KERNEL gpxe.lkrn
label 5 label 6
MENU LABEL Network boot via gPXE usb MENU LABEL Network boot via gPXE usb
KERNEL gpxe.usb KERNEL gpxe.usb
label 5 label 7
MENU LABEL Network boot via gPXE pxe MENU LABEL Network boot via gPXE pxe
KERNEL gpxe.pxe KERNEL gpxe.pxe
label 5 label 8
MENU LABEL Network boot via gPXE iso MENU LABEL Network boot via gPXE iso
KERNEL gpxe.iso KERNEL gpxe.iso
FIN FIN
@ -391,7 +368,6 @@ mkisofs -V ogClient -o ogClient.iso -b isolinux/isolinux.bin -c isolinux/boot.ca
#initrd /oginitrd.img #initrd /oginitrd.img
#} #}
} }

View File

@ -33,28 +33,15 @@ echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
########################################################################## ##########################################################################
## FASE 1 - Instalación de software adicional. ## FASE 1 - Instalación de software adicional.
DEPENDENCIES=( debootstrap subversion schroot squashfs-tools) cat /etc/apt/sources.list | grep "http://free.nchc.org.tw/drbl-core" || echo "deb http://free.nchc.org.tw/drbl-core drbl stable " >> /etc/apt/sources.list
apt-get update apt-get update
# Instalación de dependencias (paquetes de sistema operativo). apt-get -y --force-yes install debootstrap subversion schroot squashfs-tools syslinux genisoimage apt-get install gpxe
declare -a notinstalled
checkDependencies DEPENDENCIES notinstalled
if [ $? -ne 0 ]; then
installDependencies notinstalled
if [ $? -ne 0 ]; then
echoAndLog "Error while installing some dependeces, please verify your server installation before continue"
exit 1
fi
fi
########### FIN FASE 1
##### FASE 2 - Asignación de variables ##### FASE 2 - Asignación de variables
#obtenemos las variables necesarias. #obtenemos las variables necesarias y la información del host.
btogGetVar btogGetVar && btogGetOsInfo
#obtenemos la información del host.
btogGetOsInfo
##### FIN fase 2
############# FASE 3: Creación del Sistema Root (Segundo Sistema archivos (img)) ############# FASE 3: Creación del Sistema raiz RootFS (Segundo Sistema archivos (img))
##3.1 creación y formateo del disco virtual. generamos el dispositivo loop. ##3.1 creación y formateo del disco virtual. generamos el dispositivo loop.
file $BTROOTFSIMG | grep "partition 1: ID=0x83" file $BTROOTFSIMG | grep "partition 1: ID=0x83"
if [ $? == 1 ] if [ $? == 1 ]
@ -70,26 +57,17 @@ else
btogSetFsBase || exit 3 btogSetFsBase || exit 3
fi fi
# FASE 4: Configuración el acceso al Segundo Sistema de archivos (img), para schroot
############### FASE 4: Configuración el acceso al Segundo Sistema de archivos (img), para schroot
cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess cat /etc/schroot/schroot.conf | grep $BTROOTFSIMG || btogSetFsAccess
# FASE 5: Incorporando con ficheros OG el sistema raiz rootfs
cp -prv ${BTSVNBOOTTOOLS}/includes/usr/bin/* /tmp/
############### FASE 5: Configuración del Segundo Sistema de archivos (img) con la estructura especial de OpenGnsys
cp ${BTSVNBOOTTOOLS}/includes/root/* /tmp/
chmod 777 /tmp/*.sh chmod 777 /tmp/*.sh
schroot -p -c IMGogclient -- /tmp/importSVNboot-tools.sh schroot -p -c IMGogclient -- /tmp/boottoolsFsOpengnsys.sh
# FASE6: Instalacion de software
# 6.1 instalacion de software con apt-get
schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareInstall.sh
############# FASE6: Ejecutamos los scripts de personalización del 2º sistema de archivos (img) desde la jaula schroot
### 6.1 instalacion de software con apt-get
schroot -p -c IMGogclient -- /root/InstallSoftware.sh
echo "saltando" echo "saltando"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
errorAndLog "Instalando sofware adicional OG : ERROR" errorAndLog "Instalando sofware adicional OG : ERROR"
@ -97,60 +75,33 @@ echo "saltando"
else else
echoAndLog "Instalando sofware adicional OG: OK" echoAndLog "Instalando sofware adicional OG: OK"
fi fi
#### 6.2 compilación de software. # 6.2 compilación de software.
cd / cd /
schroot -p -c IMGogclient -- /root/CompileSoftware.sh schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSoftwareCompile.sh
cd - cd -
### 6.3 configuracion hostname passroot securety #Fase 7. Personalizando
cd / ### 7.1 incorporamos la clave publica del servidor
schroot -c IMGogclient -- /root/ConfFS.sh
cd -
#schroot -c IMGogclient -- echo -ne "og1\nog1\n" | passwd root
# schroot -c IMGogclient -- passwd root | echo "root"
### 6.4 incorporamos la clave publica del servidor
cd / cd /
ssh-keygen -q -f /root/.ssh/id_rsa -N "" ssh-keygen -q -f /root/.ssh/id_rsa -N ""
cp /root/.ssh/id_rsa.pub /tmp cp /root/.ssh/id_rsa.pub /tmp
schroot -p -c IMGogclient -- /root/importSshKeys.sh schroot -p -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshServer.sh
cd - cd -
############ y la del propio cliente. ### 7.2 y la del propio cliente.
schroot -c IMGogclient -- /root/generateSshKeysClient.sh schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsSshClient.sh
## configuramos los locales. ## 7.3 configuramos los locales.
schroot -c IMGogclient -- /root/ReconfigureLocales.sh schroot -c IMGogclient -- /usr/bin/boot-tools/boottoolsFsLocales.sh
exit 99 exit 99
################## FIN fase 6. Fin de comfiguración del segundo sistema de archivos (img)
#Fase 7. Generando la ISO.
#7.1 el initrd
################## FASE 7. Generamos el 1er sistema de archivos. INITRD
btogFsInitrd btogFsInitrd
#7.2 Convertivos el sistema raiz img en formato sqfs
btogFsSqfs
################## FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs) #7.3 Generamos la iso
# generamos el 2sistema de archivos en squashfs btogIsoGenerator
ogClient2ndSqfs
################## FIN FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
##################### FASE 9. algunos detallas del pxe
#dejamos ficheros de ejemplo para el pxe y el nfs
#ogClientConfpxe
##################### FIN FASE 9. algunos detallas del pxe
# Mostrar sumario de la instalación e instrucciones de post-instalación. # Mostrar sumario de la instalación e instrucciones de post-instalación.
installationSummary installationSummary

View File

@ -0,0 +1,142 @@
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console
pts/0
pts/1
pts/2
pts/3
# Standard serial ports
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
# USB dongles
ttyUSB0
ttyUSB1
ttyUSB2
# PowerMac
ttyPZ0
ttyPZ1
ttyPZ2
ttyPZ3
# Embedded MPC platforms
ttyPSC0
ttyPSC1
ttyPSC2
ttyPSC3
ttyPSC4
ttyPSC5
# PA-RISC mux ports
ttyB0
ttyB1
# Standard hypervisor virtual console
hvc0
# Oldstyle Xen console
xvc0
# Standard consoles
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty60
tty61
tty62
tty63
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
:0.0
:0.1
:1
:1.0
:1.1
:2
:2.0
:2.1
:3
:3.0
:3.1
# Embedded Freescale i.MX ports
ttymxc0
ttymxc1
ttymxc2
ttymxc3
ttymxc4
ttymxc5
# Embedded Renesas SuperH ports
ttySC0
ttySC1
ttySC2
ttySC3
ttySC4
ttySC5

View File

@ -45,7 +45,7 @@ fi
#fi #fi
#damos permiso al directorio de scripts #damos permiso al directorio de scripts
chmod 775 ${SVNCLIENTDIR}/clientstructure/root/* chmod -R 775 ${SVNCLIENTDIR}/includes/usr/bin/*
# los copiamos # los copiamos
cp -prv ${SVNCLIENTDIR}/includes/* / cp -prv ${SVNCLIENTDIR}/includes/* /

View File

@ -1,24 +1,2 @@
#!/bin/bash #!/bin/bash
dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl
#mv /etc/fstab /etc/fstab.original 2>/dev/null
#mv /etc/mtab /etc/mtab.original 2>/dev/null
#TODO: fichero etc/hosts
#TODO: fichero etc/resolv.conf
echo "ogClient" > /etc/hostname
#export PASSROOT=og
#dpkg-reconfigure passwd
#echo "root:$PASSROOT" | chpasswd
#for i in pts/0 pts/1 pts/2 pts/3 do
#
#
#done
#TODO: introducir mas consoluas para el acceso como root.
echo "pts/0" >> /etc/securetty
echo "pts/1" >> /etc/securetty
echo "pts/2" >> /etc/securetty
echo "pts/3" >> /etc/securetty

View File

@ -14,10 +14,10 @@ uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i38
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/" export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
dpkg-divert --local --rename --add /sbin/initctl dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl ln -s /bin/true /sbin/initctl
apt-get clean apt-get clean
apt-get -y update apt-get -y update