#616: Borrar código antiguo para generar el cliente ogLive.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4258 a21b9725-9963-47de-94b9-378ad31fedc9remotes/github/master
|
@ -1,4 +0,0 @@
|
|||
deb http://ftp.us.debian.org/debian lenny main contrib non-free
|
||||
|
||||
deb http://security.debian.org/ lenny/updates main contrib non-free
|
||||
deb-src http://security.debian.org/ lenny/updates main contrib non-free
|
|
@ -1,56 +0,0 @@
|
|||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME main restricted
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME main restricted
|
||||
## Major bug fix updates produced after the final release of the
|
||||
## distribution.
|
||||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates main restricted
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates main restricted
|
||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||
## team. Also, please note that software in universe WILL NOT receive any
|
||||
## review or updates from the Ubuntu security team.
|
||||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME universe
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME universe
|
||||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates universe
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates universe
|
||||
|
||||
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
|
||||
## team, and may not be under a free licence. Please satisfy yourself as to
|
||||
## your rights to use the software. Also, please note that software in
|
||||
## multiverse WILL NOT receive any review or updates from the Ubuntu
|
||||
## security team.
|
||||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME multiverse
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME multiverse
|
||||
deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates multiverse
|
||||
deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-updates multiverse
|
||||
|
||||
## Uncomment the following two lines to add software from the 'backports'
|
||||
## repository.
|
||||
## N.B. software from this repository may not have been tested as
|
||||
## extensively as that contained in the main release, although it includes
|
||||
## newer versions of some applications which may provide useful features.
|
||||
## Also, please note that software in backports WILL NOT receive any review
|
||||
## or updates from the Ubuntu security team.
|
||||
# deb http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-backports main restricted universe multiverse
|
||||
# deb-src http://es.archive.ubuntu.com/ubuntu/ OSCODENAME-backports main restricted universe multiverse
|
||||
|
||||
## Uncomment the following two lines to add software from Canonical's
|
||||
## 'partner' repository.
|
||||
## This software is not part of Ubuntu, but is offered by Canonical and the
|
||||
## respective vendors as a service to Ubuntu users.
|
||||
# deb http://archive.canonical.com/ubuntu OSCODENAME partner
|
||||
# deb-src http://archive.canonical.com/ubuntu OSCODENAME partner
|
||||
|
||||
|
||||
deb http://security.ubuntu.com/ubuntu OSCODENAME-security main restricted
|
||||
deb-src http://security.ubuntu.com/ubuntu OSCODENAME-security main restricted
|
||||
deb http://security.ubuntu.com/ubuntu OSCODENAME-security universe
|
||||
deb-src http://security.ubuntu.com/ubuntu OSCODENAME-security universe
|
||||
deb http://security.ubuntu.com/ubuntu OSCODENAME-security multiverse
|
||||
deb-src http://security.ubuntu.com/ubuntu OSCODENAME-security multiverse
|
||||
|
||||
|
||||
deb http://archive.ubuntu.com/ubuntu OSCODENAME main
|
||||
deb http://free.nchc.org.tw/drbl-core drbl stable
|
||||
deb http://free.nchc.org.tw/ubuntu OSCODENAME-security main restricted universe multiverse
|
||||
deb http://ppa.launchpad.net/freenx-team/ubuntu/ OSCODENAME main
|
||||
deb http://ppa.launchpad.net/randomaction/ppa/ubuntu OSCODENAME main
|
||||
deb-src http://ppa.launchpad.net/randomaction/ppa/ubuntu OSCODENAME main
|
|
@ -1,4 +0,0 @@
|
|||
LC_TYPE=es_ES@euro
|
||||
LC_ALL=es_ES@euro
|
||||
LANG=es_ES@euro
|
||||
LANGUAGE=es_ES@euro
|
|
@ -1,13 +0,0 @@
|
|||
# /etc/fstab: static file system information.
|
||||
#
|
||||
# Use 'blkid -o value -s UUID' to print the universally unique identifier
|
||||
# for a device; this may be used with UUID= as a more robust way to name
|
||||
# devices that works even if disks are added and removed. See fstab(5).
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc 0 0
|
||||
/dev/sda1 ext3 errors=remount-ro 0 1
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
#!/bin/sh -e
|
||||
# initramfs hook for OpenGnsys
|
||||
|
||||
#@file oghooks
|
||||
#@brief configuración initrd para OpenGnSys
|
||||
#@warning
|
||||
#@version 0.9 - estrucura opengnsys, bash-static, unionfs, atheros
|
||||
#@author Antonio J. Doblas Viso.
|
||||
#@date 2010/05/24
|
||||
#*/
|
||||
|
||||
PREREQ="og"
|
||||
|
||||
# Output pre-requisites
|
||||
prereqs()
|
||||
{
|
||||
echo "$PREREQ"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
prereqs)
|
||||
prereqs
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
. /usr/share/initramfs-tools/hook-functions
|
||||
|
||||
mkdir -p ${DESTDIR}/scripts/og-top
|
||||
mkdir -p ${DESTDIR}/scripts/og-premount
|
||||
mkdir -p ${DESTDIR}/scripts/og-bottom
|
||||
mkdir -p ${DESTDIR}/mnt/
|
||||
mkdir -p ${DESTDIR}/net/
|
||||
mkdir -p ${DESTDIR}/usr
|
||||
mkdir -p ${DESTDIR}/var/lock
|
||||
mkdir -p ${DESTDIR}/var/log
|
||||
mkdir -p ${DESTDIR}/opt/opengnsys;
|
||||
mkdir -p ${DESTDIR}/ogboot;
|
||||
mkdir -p ${DESTDIR}/boot;
|
||||
|
||||
# Insert basic binaries
|
||||
copy_exec /bin/bash-static /bin/bash
|
||||
copy_exec /usr/bin/unionfs-fuse
|
||||
copy_exec /sbin/mount.cifs
|
||||
copy_exec /sbin/mount.smbfs
|
||||
copy_exec /bin/lsmod
|
||||
|
||||
|
||||
# Insert OpenGnsys Engine
|
||||
#mkdir -p ${DESTDIR}/opt/opengnsys/lib/engine
|
||||
#cp -prv /opt/opengnsys/client/lib/engine ${DESTDIR}/opt/opengnsys/lib/engine
|
||||
|
||||
#rm -fr ${DESTDIR}/lib/modules/2.6.32-21-generic-pae/kernel/drivers/net/atl*
|
||||
manual_add_modules cifs
|
||||
manual_add_modules smbfs
|
||||
manual_add_modules atl1e
|
||||
manual_add_modules squashfs
|
||||
manual_add_modules md4
|
||||
|
||||
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
# List of modules that you want to include in your initramfs.
|
||||
#
|
||||
# Syntax: module_name [args ...]
|
||||
#
|
||||
# You must run update-initramfs(8) to effect this change.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# raid1
|
||||
# sd_mod
|
||||
vga16b
|
||||
vesafb
|
||||
fbcon
|
||||
|
|
@ -1,631 +0,0 @@
|
|||
#@file ogfunctions.lib
|
||||
#@brief Librería o clase para la generación del 1erFS
|
||||
#@class client
|
||||
#@brief Funciones para la generación del primers sistema (initrd)
|
||||
#@version 0.91
|
||||
#@warning License: GNU GPLv3+
|
||||
|
||||
|
||||
ogExportKernelParameters ()
|
||||
{
|
||||
GLOBAL="cat /proc/cmdline"
|
||||
for i in `${GLOBAL}`
|
||||
do
|
||||
echo $i | grep "=" > /dev/null && export $i
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
ogExportVarEnvironment ()
|
||||
{
|
||||
export CFGINITRD="/tmp/initrd.cfg"
|
||||
OGPROTOCOL="${ogprotocol:-smb}"
|
||||
case "$OGPROTOCOL" in
|
||||
nfs|NFS)
|
||||
#export NFSROOTBOOT="/var/lib/tftpboot"
|
||||
export SRCOGLIVE="/var/lib/tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD
|
||||
#export NFSCLIENTDIR="/opt/opengnsys/client"
|
||||
export SRCOGSHARE="/opt/opengnsys/client" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD
|
||||
#export NFSLOGDIR="/opt/opengnsys/log/clients"
|
||||
export SRCOGLOG="/opt/opengnsys/log/clients" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
|
||||
#export NFSIMGDIR="/opt/opengnsys/images"
|
||||
export SRCOGIMAGES="/opt/opengnsys/images" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD
|
||||
;;
|
||||
smb|SMB|cifs|CIFS|samba|SAMBA)
|
||||
export OPTIONS=" -o user=opengnsys,pass=og"
|
||||
#export SMBROOTBOOT="tftpboot" && echo "SMBROOTBOOT=$SMBROOTBOOT" >> $CFGINITRD
|
||||
export SRCOGLIVE="tftpboot" && echo "SRCOGLIVE=$SRCOGLIVE" >> $CFGINITRD
|
||||
#export SMBCLIENTDIR="ogclient" && echo "SMBCLIENTDIR=$SMBCLIENTDIR" >> $CFGINITRD
|
||||
export SRCOGSHARE="ogclient" && echo "SRCOGSHARE=$SRCOGSHARE" >> $CFGINITRD
|
||||
#export SMBLOGDIR="oglog" && echo "SMBLOGDIR=$SMBLOGDIR" >> $CFGINITRD
|
||||
export SRCOGLOG="oglog" && echo "SRCOGLOG=$SRCOGLOG" >> $CFGINITRD
|
||||
#export SMBIMGDIR="ogimages" && echo "SMBIMGDIR=$SMBIMGDIR" >> $CFGINITRD
|
||||
export SRCOGIMAGES="ogimages" && echo "SRCOGIMAGES=$SRCOGIMAGES" >> $CFGINITRD
|
||||
;;
|
||||
local|LOCAL)
|
||||
export SRCOGLIVE="local"
|
||||
;;
|
||||
esac
|
||||
#punto de acceso al boot-tools live
|
||||
#export LOCALROOTBOOT="/opt/og2fs/tftpboot" && echo "LOCALROOTBOOT=$LOCALROOTBOOT" >> $CFGINITRD
|
||||
export DSTOGLIVE="/opt/oglive/tftpboot"
|
||||
#punto de montaje para unionfs
|
||||
#export LOCALROOTRAM="/opt/og2fs/1stfs" && echo "LOCALROOTRAM=$LOCALROOTRAM" >> $CFGINITRD
|
||||
export OGLIVERAMFS="/opt/oglive/ramfs" && echo "OGLIVERAMFS=$OGLIVERAMFS" >> $CFGINITRD
|
||||
#punto de montaje donde se accede al 2nd FS mediante loop
|
||||
#export LOCALROOTIMG="/opt/og2fs/2ndfs" && echo "LOCALROOTIMG=$LOCALROOTIMG" >> $CFGINITRD
|
||||
export OGLIVEROOTFS="/opt/oglive/rootfs" && echo "OGLIVEROOTFS=$OGLIVEROOTFS" >> $CFGINITRD
|
||||
#punto de union entre LOCALROOTIMG y LOCALROOTRAM
|
||||
#export LOCALROOTUNION="/opt/og2fs/unionfs" && echo "LOCALROOTUNION=$LOCALROOTUNION" >> $CFGINITRD
|
||||
export OGLIVEUNIONFS="/opt/oglive/unionfs" && echo "OGLIVEUNIONFS=$OGLIVEUNIONFS" >> $CFGINITRD
|
||||
#etiquta para los dispositivos offline
|
||||
export OGLIVELABEL="ogClient"
|
||||
|
||||
#echo "puntos de montajes para los demas accesos"
|
||||
#echo "acceso al client, engine, scritps, interfaz"
|
||||
#export LOCALCLIENTDIR="/opt/opengnsys" && echo "LOCALCLIENTDIR=$LOCALCLIENTDIR" >> $CFGINITRD
|
||||
export DSTOGSHARE="/opt/opengnsys" && echo "DSTOGSHARE=$DSTOGSHARE" >> $CFGINITRD
|
||||
#export LOCALLOGDIR="/opt/opengnsys/log" && echo "LOCALLOGDIR=$LOCALLOGDIR" >> $CFGINITRD
|
||||
export DSTOGLOG="/opt/opengnsys/log" && echo "DSTOGLOG=$DSTOGLOG" >> $CFGINITRD
|
||||
#export LOCALIMGDIR="/opt/opengnsys/images" && echo "LOCALIMGDIR=$LOCALIMGDIR" >> $CFGINITRD
|
||||
export DSTOGIMAGES="/opt/opengnsys/images" && echo "DSTOGIMAGES=$DSTOGIMAGES" >> $CFGINITRD
|
||||
|
||||
##INFORMACION DE OTRAS VARIABLES OBTENDIAS EN OTRAS FUNCIONES ogConfigureNetwork.
|
||||
#DEVICE
|
||||
#IPV4DDR
|
||||
#IPV4BROADCAST
|
||||
#IPV4NETMASK
|
||||
#IPV4GATEWAY
|
||||
#HOSTNAME
|
||||
#INFORMACION de otras variasbles obteneidas desde ogGetROOTSERVER
|
||||
#ROOTSERVER si ip=dhcp -> ROOTSERVER=NEXT-SERVER; si ip=host:rootserver:gw:mask:hostname:interfaz -> ROOTSERVER=rootserver
|
||||
#BOOTIF -> si el gestor remoto es pxelinux.0 y se añade una linea más tipo "IPAPPEND 2" esta variable tendrá la mac de la interfaz.
|
||||
#$OGSERVERLIVE
|
||||
#$OGSERVERSHARE
|
||||
#$OGSERVERLOG
|
||||
#$OGSERVERIMAGES
|
||||
return 0
|
||||
}
|
||||
|
||||
ogConfigureRamfs ()
|
||||
{
|
||||
#mkdir -p $LOCALROOTBOOT
|
||||
mkdir -p $DSTOGLIVE
|
||||
#mkdir -p $LOCALROOTRAM
|
||||
mkdir -p $OGLIVERAMFS
|
||||
#mkdir -p $LOCALROOTIMG
|
||||
mkdir -p $OGLIVEROOTFS
|
||||
#mkdir -p $LOCALROOTUNION
|
||||
mkdir -p $OGLIVEUNIONFS
|
||||
}
|
||||
|
||||
ogLoadNetModule ()
|
||||
{
|
||||
if [ -n "$ognetmodule" ]
|
||||
then
|
||||
echo "Cargando modulo de red $netmodule"
|
||||
insmod `find /lib/modules/ -name ${netmodule}*`
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ogPostConfigureFS()
|
||||
{
|
||||
# configuramos el /etc/hostname.
|
||||
echo $HOSTNAME > /etc/hostname
|
||||
|
||||
#configuramos el /etc/hosts
|
||||
echo "127.0.0.1 localhost" > /etc/hosts
|
||||
echo "$IPV4ADDR $HOSTNAME" >> /etc/hosts
|
||||
|
||||
#configuramos el host.conf
|
||||
echo "order hosts,bind" > /etc/host.conf
|
||||
echo "multi on" >> /etc/host.conf
|
||||
|
||||
#configuramos el dns
|
||||
echo "nameserver $ogdns" > /etc/resolv.conf
|
||||
|
||||
|
||||
# configuramos el /etc/networks
|
||||
#read -e NETIP NETDEFAULT <<<$(route -n | grep eth0 | awk -F" " '{print $1}')
|
||||
NETIP=$(route -n | grep eth0 | awk -F" " '{print $1}') && NETIP=$(echo $NETIP | cut -f1 -d" ")
|
||||
echo "default 0.0.0.0" > /etc/networks
|
||||
echo "loopback 127.0.0.0" >> /etc/networks
|
||||
echo "link-local 169.254.0.0" >> /etc/networks
|
||||
echo "localnet $NETIP" >> /etc/networks
|
||||
#route
|
||||
|
||||
echo "ogLive1.0.2" > /etc/debian_chroot
|
||||
|
||||
#enlace si iniciamos desde ogprotocolo=local { cdrom, usb, cache } .
|
||||
# monta el raiz del dispositivo local en /opt/og2fs/tftpboot - acceso al fichero .sqfs
|
||||
# y monta el sistema root sqfs en /opt/og2fs/2ndfs
|
||||
#[ "$LOCALMEDIA" == "CACHE" ] && ln -s /opt/oglive/tftpboot /opt/opengnsys/cache
|
||||
#[ "$ogprotocol" == "local" ] && ln -s /opt/oglive/2ndfs/opt/opengnsys/* /opt/opengnsys/
|
||||
[ "$LOCALMEDIA" == "CACHE" ] && ln -s $DSTOGLIVE /opt/opengnsys/cache
|
||||
[ "$ogprotocol" == "local" ] && ln -s ${OGLIVEROOTFS}/opt/opengnsys/* /opt/opengnsys/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#Requiere ogConfigureNetworking.
|
||||
#Exporta ROOTSERVER
|
||||
# si la red ha sido configurada con dhcp el valor de ROOTSERVER será el valor de next-server del dhcp
|
||||
# si la red ha sido configurada con el parametro de kernel ip, será el segundo valor.
|
||||
## ip=iphost:ipnext-server:ipgateway:netmask:hostname:iface:none
|
||||
## ip=172.17.36.21:62.36.225.150:172.17.36.254:255.255.255.0:prueba1:eth0:none
|
||||
ogGetROOTSERVER ()
|
||||
{
|
||||
# get nfs root from dhcp
|
||||
if [ "x${NFSROOT}" = "xauto" ]; then
|
||||
# check if server ip is part of dhcp root-path
|
||||
if [ "${ROOTPATH#*:}" = "${ROOTPATH}" ]; then
|
||||
NFSROOT=${ROOTSERVER}:${ROOTPATH}
|
||||
else
|
||||
NFSROOT=${ROOTPATH}
|
||||
fi
|
||||
|
||||
# nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
|
||||
elif [ -n "${NFSROOT}" ]; then
|
||||
# nfs options are an optional arg
|
||||
if [ "${NFSROOT#*,}" != "${NFSROOT}" ]; then
|
||||
NFSOPTS="-o ${NFSROOT#*,}"
|
||||
fi
|
||||
NFSROOT=${NFSROOT%%,*}
|
||||
if [ "${NFSROOT#*:}" = "$NFSROOT" ]; then
|
||||
NFSROOT=${ROOTSERVER}:${NFSROOT}
|
||||
fi
|
||||
fi
|
||||
export ROOTSERVER
|
||||
echo "ROOTSERVER=$ROOTSERVER" >> $CFGINITRD
|
||||
|
||||
#si oglive no oglive=R
|
||||
export OGSERVERIMAGES="${ogrepo:-$ROOTSERVER}"
|
||||
export OGSERVERSHARE="${ogshare:-$ROOTSERVER}"
|
||||
export OGSERVERLOG="${oglog:-$ROOTSERVER}"
|
||||
export OGSERVERLIVE="${oglive:-$OGSERVERIMAGES}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
#ogConnect
|
||||
# parm 1 ip servidor TODO:dns
|
||||
# parm 2 protocolo
|
||||
# parm 3 punto de acceso remoto
|
||||
# parm 4 punto de montaje local
|
||||
# parm 5 acceso de lectura tipo ",ro"
|
||||
ogConnect ()
|
||||
{
|
||||
SERVER=$1
|
||||
PROTOCOL=$2
|
||||
SRC=$3
|
||||
DST=$4
|
||||
READONLY=$5
|
||||
|
||||
case "$PROTOCOL" in
|
||||
nfs)
|
||||
nfsmount -o nolock${READONLY} ${SERVER}:${SRC} ${DST}
|
||||
;;
|
||||
smb)
|
||||
mount.cifs //${SERVER}/${SRC} ${DST} ${OPTIONS}${READONLY}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ogConnectOgLive ()
|
||||
{
|
||||
# Si ogprotocol=local, la funcion ogExportVar => SRCOGLIVE=local
|
||||
if [ "$SRCOGLIVE" == "local" ]
|
||||
then
|
||||
echo "Montar imagen del sistema root desde dispositivo local"
|
||||
for i in $(blkid /dev/s* | grep $OGLIVELABEL | awk -F: '{print $2}' | tr -d \"); do export $i; done
|
||||
mount -t $TYPE LABEL=$LABEL $DSTOGLIVE
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
mount -t reiserfs LABEL=CACHE $DSTOGLIVE
|
||||
export LOCALMEDIA=CACHE
|
||||
fi
|
||||
else
|
||||
# Si ogprotocol es remoto. TODO en smb rw y en nfs ro??
|
||||
ogConnect $OGSERVERLIVE $OGPROTOCOL $SRCOGLIVE $DSTOGLIVE
|
||||
fi
|
||||
# Si el montaje ha sido correcto, tanto en local como en remoto. Procedemos con la union
|
||||
ogMergeLive
|
||||
}
|
||||
|
||||
|
||||
|
||||
ogMergeLive()
|
||||
{
|
||||
#Si existe en el punto de acceso del del oglive el fichero ogclient.sqfs
|
||||
if [ -f $DSTOGLIVE/ogclient/ogclient.sqfs ]
|
||||
then
|
||||
cat /proc/mounts > /tmp/mtab.preunion
|
||||
if [ "$og2nd" == "img" ]
|
||||
then
|
||||
#Montamos el ROOTFS tipo img, para desarrolladores
|
||||
losetup /dev/loop0 $DSTOGLIVE/ogclient/ogclient.img -o 32256
|
||||
mount /dev/loop0 $OGLIVEROOTFS
|
||||
else
|
||||
## Montamos el ROOTFS tipo squashfs
|
||||
mount $DSTOGLIVE/ogclient/ogclient.sqfs $OGLIVEROOTFS -t squashfs -o loop
|
||||
fi
|
||||
# Realizamos la union entre el ogliveram(initrd) y el ogliverootfs(ogclient.sqfs)
|
||||
for i in etc var lib bin sbin usr root boot; do
|
||||
ogUnionLiveDir $i
|
||||
done
|
||||
cat /tmp/mtab.preunion > /etc/mtab
|
||||
else
|
||||
echo "Fichero imagen del cliente no encontrado"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ogUnionLiveDir
|
||||
#par 1 el directorio a unir.
|
||||
# para el parmetro 1 (directorio),
|
||||
ogUnionLiveDir()
|
||||
{
|
||||
TMPDIR=/$1 #dir
|
||||
FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid"
|
||||
UNION_OPT="-o cow -o noinitgroups"
|
||||
UBIN="unionfs-fuse"
|
||||
|
||||
mkdir -p $OGLIVERAMFS$TMPDIR
|
||||
U1STDIR="${OGLIVERAMFS}${TMPDIR}=RW"
|
||||
U2NDDIR="${OGLIVEROOTFS}${TMPDIR}=RO"
|
||||
UNIONDIR=${OGLIVEUNIONFS}${TMPDIR}
|
||||
mkdir -p $UNIONDIR
|
||||
$UBIN $FUSE_OPT $UNION_OPT ${U1STDIR}:${U2NDDIR} $UNIONDIR
|
||||
mount --bind $UNIONDIR $TMPDIR
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ogConfigureLoopback()
|
||||
{
|
||||
# for the portmapper we need localhost
|
||||
ifconfig lo 127.0.0.1
|
||||
#/etc/init.d/portmap start
|
||||
}
|
||||
|
||||
ogConfigureNetworking()
|
||||
{
|
||||
#echo "ogConfigureNetworking: Buscando interfaz a configurar DEVICE"
|
||||
if [ -n "${BOOTIF}" ]
|
||||
then
|
||||
#echo " variable BOOTIF exportada con pxelinux.0 con valor $BOOTIF"
|
||||
IP=$IPOPTS
|
||||
temp_mac=${BOOTIF#*-}
|
||||
# convert to typical mac address format by replacing "-" with ":"
|
||||
bootif_mac=""
|
||||
IFS='-'
|
||||
for x in $temp_mac ; do
|
||||
if [ -z "$bootif_mac" ]; then
|
||||
bootif_mac="$x"
|
||||
else
|
||||
bootif_mac="$x:$bootif_mac"
|
||||
fi
|
||||
done
|
||||
unset IFS
|
||||
# look for devices with matching mac address, and set DEVICE to
|
||||
# appropriate value if match is found.
|
||||
for device in /sys/class/net/* ; do
|
||||
if [ -f "$device/address" ]; then
|
||||
current_mac=$(cat "$device/address")
|
||||
if [ "$bootif_mac" = "$current_mac" ]; then
|
||||
DEVICE=${device##*/}
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
else
|
||||
#echo "variable BOOTIF no exportada, intentamos detectar que interfaz se ha iniciado"
|
||||
IP=$ip
|
||||
#TODO Detectar que interfaz se ha iniciado
|
||||
case ${IP} in
|
||||
none|off)
|
||||
return 0
|
||||
;;
|
||||
""|on|any)
|
||||
# Bring up device
|
||||
DEVICE=eth0
|
||||
;;
|
||||
dhcp|bootp|rarp|both)
|
||||
DEVICE=eth0
|
||||
;;
|
||||
*)
|
||||
DEVICE=`echo $IP | cut -f6 -d:`
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -z "${DEVICE}" ]; then
|
||||
echo "variable DEVICE con valor $DEVICE no encontrada, llamamos de nuevo a ogconfigure_networking"
|
||||
ogConfigureNetworking
|
||||
fi
|
||||
|
||||
[ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ] && return 0
|
||||
#if [ -n "${DEVICE}" ] && [ -e /tmp/net-"${DEVICE}".conf ]; then
|
||||
# echo "variable DEVICE con valor $DEVICE y fichero /tmp/net-$DEVICE encontrados"
|
||||
# return 0
|
||||
#else
|
||||
# echo "variable DEVICE con valor $DEVICE encontrada, procedemos a configurala y a crear el fichero /tmp/net-$DEVICE"
|
||||
#fi
|
||||
|
||||
# Activamos la interfaz antes de configurar.
|
||||
ip address flush $DEVICE
|
||||
ip link set dev $DEVICE up
|
||||
# Si no se detecta señal portadora volver a configurar.
|
||||
sleep 1
|
||||
CARRIER=$(cat /sys/class/net/${DEVICE}/carrier)
|
||||
if [ "$CARRIER" != "1" ]
|
||||
then
|
||||
ogConfigureNetworking
|
||||
fi
|
||||
|
||||
# support ip options see linux sources
|
||||
# Documentation/filesystems/nfsroot.txt
|
||||
# Documentation/frv/booting.txt
|
||||
for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
|
||||
# The NIC is to be configured if this file does not exist.
|
||||
# Ip-Config tries to create this file and when it succeds
|
||||
# creating the file, ipconfig is not run again.
|
||||
if [ -e /tmp/net-"${DEVICE}".conf ]; then
|
||||
break;
|
||||
fi
|
||||
case ${IP} in
|
||||
none|off)
|
||||
return 0
|
||||
;;
|
||||
""|on|any)
|
||||
# Bring up device
|
||||
echo "Setting $DEVICE with option:on|any and Variable IP= $IP: ipconfig -t ${ROUNDTTT} ${DEVICE} "
|
||||
ipconfig -t ${ROUNDTTT} ${DEVICE}
|
||||
;;
|
||||
dhcp|bootp|rarp|both)
|
||||
echo "Setting $DEVICE with option:dhcp|bootp|rarp|both and Variable IP= $IP: ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE} "
|
||||
ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE}
|
||||
;;
|
||||
*)
|
||||
echo "Setting $DEVICE with option * and Variable IP= $IP: ipconfig -t ${ROUNDTTT} -d $IP "
|
||||
ipconfig -t ${ROUNDTTT} -d $IP
|
||||
# grab device entry from ip option
|
||||
NEW_DEVICE=${IP#*:*:*:*:*:*}
|
||||
if [ "${NEW_DEVICE}" != "${IP}" ]; then
|
||||
NEW_DEVICE=${NEW_DEVICE%:*}
|
||||
else
|
||||
# wrong parse, possibly only a partial string
|
||||
NEW_DEVICE=
|
||||
fi
|
||||
if [ -n "${NEW_DEVICE}" ]; then
|
||||
DEVICE="${NEW_DEVICE}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# source ipconfig output
|
||||
if [ -n "${DEVICE}" ]; then
|
||||
. /tmp/net-${DEVICE}.conf
|
||||
DEVICECFG="/tmp/net-${DEVICE}.conf"
|
||||
export DEVICECFG
|
||||
export DEVICE
|
||||
echo "DEVICE=$DEVICE" >> $CFGINITRD
|
||||
echo "DEVICECFG=$DEVICECFG" >> $CFGINITRD
|
||||
echo "exportando variable DEVICE con valor = $DEVICE y el DEVICECFG con valor $DEVICECFG"
|
||||
else
|
||||
# source any interface as not exaclty specified
|
||||
. /tmp/net-*.conf
|
||||
fi
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# Ask yesno question.
|
||||
#
|
||||
# Usage: yesno OPTIONS QUESTION
|
||||
#
|
||||
# Options:
|
||||
# --timeout N Timeout if no input seen in N seconds.
|
||||
# --default ANS Use ANS as the default answer on timeout or
|
||||
# if an empty answer is provided.
|
||||
#
|
||||
# Exit status is the answer. 0=yes 1=no
|
||||
|
||||
ogYesNo()
|
||||
{
|
||||
local ans
|
||||
local ok=0
|
||||
local timeout=0
|
||||
local default
|
||||
local t
|
||||
|
||||
while [[ "$1" ]]
|
||||
do
|
||||
case "$1" in
|
||||
--default)
|
||||
shift
|
||||
default=$1
|
||||
if [[ ! "$default" ]]; then error "Missing default value"; fi
|
||||
t=$(echo $default | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [[ "$t" != 'y' && "$t" != 'yes' && "$t" != 'n' && "$t" != 'no' ]]; then
|
||||
error "Illegal default answer: $default"
|
||||
fi
|
||||
default=$t
|
||||
shift
|
||||
;;
|
||||
|
||||
--timeout)
|
||||
shift
|
||||
timeout=$1
|
||||
if [[ ! "$timeout" ]]; then error "Missing timeout value"; fi
|
||||
#if [[ ! "$timeout" =~ ^[0-9][0-9]*$ ]]; then error "Illegal timeout value: $timeout"; fi
|
||||
shift
|
||||
;;
|
||||
|
||||
-*)
|
||||
error "Unrecognized option: $1"
|
||||
;;
|
||||
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $timeout -ne 0 && ! "$default" ]]; then
|
||||
error "Non-zero timeout requires a default answer"
|
||||
fi
|
||||
|
||||
if [[ ! "$*" ]]; then error "Missing question"; fi
|
||||
|
||||
while [[ $ok -eq 0 ]]
|
||||
do
|
||||
if [[ $timeout -ne 0 ]]; then
|
||||
if ! read -t $timeout -p "$*" ans; then
|
||||
ans=$default
|
||||
else
|
||||
# Turn off timeout if answer entered.
|
||||
timeout=0
|
||||
if [[ ! "$ans" ]]; then ans=$default; fi
|
||||
fi
|
||||
else
|
||||
read -p "$*" ans
|
||||
if [[ ! "$ans" ]]; then
|
||||
ans=$default
|
||||
else
|
||||
ans=$(echo $ans | tr '[:upper:]' '[:lower:]')
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$ans" == 'y' || "$ans" == 'yes' || "$ans" == 'n' || "$ans" == 'no' ]]; then
|
||||
ok=1
|
||||
fi
|
||||
|
||||
if [[ $ok -eq 0 ]]; then warning "Valid answers are: yes y no n"; fi
|
||||
done
|
||||
[[ "$ans" = "y" || "$ans" == "yes" ]]
|
||||
}
|
||||
|
||||
|
||||
### # borrar
|
||||
|
||||
ogConectROOTSERVER ()
|
||||
{
|
||||
local OPTIONS
|
||||
#params a detectar
|
||||
if [ $ogrepo ]
|
||||
then
|
||||
# Validar si la ip es correcta
|
||||
ROOTREPO=$ogrepo
|
||||
else
|
||||
ROOTREPO=$ROOTSERVER
|
||||
fi
|
||||
|
||||
case "$ogprotocol" in
|
||||
local)
|
||||
echo "Montar imagen del sistema root desde dispositivo local"
|
||||
for i in $(blkid /dev/s* | grep ogClient | awk -F: '{print $2}' | tr -d \"); do export $i; done
|
||||
mount -t $TYPE LABEL=$LABEL $LOCALROOTBOOT
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
mount -t reiserfs LABEL=CACHE $LOCALROOTBOOT
|
||||
export LOCALMEDIA=CACHE
|
||||
fi
|
||||
;;
|
||||
httfs)
|
||||
echo "protocolo httfs aun no soportado"
|
||||
;;
|
||||
sshfs)
|
||||
echo "protocolo sshfs aun no soportado"
|
||||
;;
|
||||
smb)
|
||||
echo "Preparando conexión con el Repositorio $ROOTSERVER por $ogprotocol"
|
||||
OPTIONS=" -o user=opengnsys,pass=og"
|
||||
mount.cifs //${ROOTSERVER}/${SMBROOTBOOT} $LOCALROOTBOOT $OPTIONS
|
||||
mount.cifs //${ROOTSERVER}/${SMBCLIENTDIR} $LOCALCLIENTDIR $OPTIONS
|
||||
mount.cifs //${ROOTSERVER}/${SMBLOGDIR} $LOCALLOGDIR $OPTIONS
|
||||
|
||||
mount.cifs //${ROOTREPO}/${SMBIMGDIR} $LOCALIMGDIR ${OPTIONS},ro
|
||||
;;
|
||||
nfs)
|
||||
echo "Preparando conexión con el Repositorio $ROOTSERVER por $ogprotocol"
|
||||
nfsmount -o nolock $ROOTSERVER:$NFSROOTBOOT $LOCALROOTBOOT
|
||||
nfsmount -o nolock,ro $ROOTSERVER:$NFSCLIENTDIR $LOCALCLIENTDIR
|
||||
nfsmount -o nolock $ROOTSERVER:$NFSLOGDIR $LOCALLOGDIR
|
||||
|
||||
nfsmount -o nolock,ro $ROOTREPO:$NFSIMGDIR $LOCALIMGDIR
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
ogMerge2ndFile()
|
||||
{
|
||||
if [ -f $LOCALROOTBOOT/ogclient/ogclient.sqfs ]
|
||||
then
|
||||
cat /proc/mounts > /tmp/mtab.preunion
|
||||
if [ "$og2nd" == "img" ]
|
||||
then
|
||||
#para acceder al img
|
||||
losetup /dev/loop0 $LOCALROOTBOOT/ogclient/ogclient.img -o 32256
|
||||
mount /dev/loop0 $LOCALROOTIMG
|
||||
else
|
||||
## para acceder al squashfs
|
||||
mount $LOCALROOTBOOT/ogclient/ogclient.sqfs $LOCALROOTIMG -t squashfs -o loop
|
||||
fi
|
||||
for i in etc var lib bin sbin usr root boot; do
|
||||
unionmount $i
|
||||
done
|
||||
cat /tmp/mtab.preunion > /etc/mtab
|
||||
else
|
||||
echo "Fichero imagen del cliente no encontrado"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
unionmount()
|
||||
{
|
||||
tmpdir=/$1 #dir
|
||||
FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid"
|
||||
UNION_OPT="-o cow -o noinitgroups"
|
||||
UBIN="unionfs-fuse"
|
||||
#UPATH="/unionfs"
|
||||
#LOCALROOTIMG="/opt/og2fs/2ndfs"
|
||||
#LOCALROOTRAM="/opt/og2fs/1stfs" #/unionfs/host #punto de montaje para unionfs
|
||||
#LOCALROOTUNION=/opt/og2fs/unionfs/" #/unionfs/union #punto de union entreo LOCALROOTIMG y LOCALROOTRAM
|
||||
#mkdir -p $LOCALROOTRAM #/unionfs/host
|
||||
#mkdir -p $LOCALROOTUNION #/unionfs/union
|
||||
mkdir -p $LOCALROOTRAM$tmpdir
|
||||
#mount --bind /$tmpdir $LOCALROOTRAM$tmpdir
|
||||
U1STDIR="${LOCALROOTRAM}${tmpdir}=RW"
|
||||
U2NDDIR="${LOCALROOTIMG}${tmpdir}=RO"
|
||||
UNIONDIR=$LOCALROOTUNION$tmpdir
|
||||
mkdir -p $UNIONDIR
|
||||
$UBIN $FUSE_OPT $UNION_OPT ${U1STDIR}:${U2NDDIR} $UNIONDIR
|
||||
mount --bind $UNIONDIR $tmpdir
|
||||
}
|
||||
|
||||
|
||||
unionmountOLD()
|
||||
{
|
||||
FUSE_OPT="-o default_permissions -o allow_other -o use_ino -o nonempty -o suid"
|
||||
UNION_OPT="-o cow -o noinitgroups"
|
||||
UPATH="/unionfs"
|
||||
UBIN="unionfs-fuse"
|
||||
mkdir -p /unionfs/host
|
||||
mkdir -p /unionfs/union
|
||||
dir=$1
|
||||
mkdir -p /unionfs/host/$dir
|
||||
#mount --bind /$dir /unionfs/host/$dir
|
||||
mkdir -p /unionfs/union/$dir
|
||||
host="/unionfs/host/${dir}=RW"
|
||||
common="/opt/og2fs/${dir}=RO"
|
||||
$UBIN $FUSE_OPT $UNION_OPT ${host}:${common} /unionfs/union/$dir
|
||||
mount --bind /unionfs/union/$dir /$dir
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
# OpenGnsys oginit -*- shell-script -*-
|
||||
|
||||
#@file oginit
|
||||
#@brief Guion modificador inicio initrd para OpenGnSys
|
||||
#@warning
|
||||
#@version 0.1 - basado en ROOTfs
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga
|
||||
#@date 2009/00/00
|
||||
#@version 0.2 - basado en el instalador de ubunto
|
||||
#@author Alejandro Castillo
|
||||
#@author Ramón Gómez
|
||||
#@author Irina
|
||||
#@author Antonio Doblas
|
||||
#@date 2010/00/00
|
||||
#@version 0.7 - Generación limpia con mkinitrd, busybox
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT.
|
||||
#@date 2010/05/24
|
||||
#@version 0.8 - Integración con FileSystem externo
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT.
|
||||
#@date 2010/06/24
|
||||
#@version 0.8.1 - UnionFS + squasfs
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT.
|
||||
#@date 2010/06/29
|
||||
#@version 1.0. - Adaptacion variables. Corrección enlace red
|
||||
#@author Antonio J. Doblas Viso. Universidad de Málaga. EVLT.
|
||||
#@date 2011/06/16
|
||||
#*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Parameter: Where to mount the filesystem
|
||||
mountroot ()
|
||||
{
|
||||
[ "$quiet" != "y" ] && log_begin_msg "Running OpenGnsys /scripts/og-top"
|
||||
run_scripts /scripts/og-top
|
||||
[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
# If the root device hasn't shown up yet, give it a little while
|
||||
# to deal with removable devices
|
||||
|
||||
. /scripts/functions
|
||||
. /scripts/ogfunctions
|
||||
|
||||
sleep 2
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before get OG variables: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
set -a
|
||||
log_success_msg "Checking kernel parameters"
|
||||
ogExportKernelParameters
|
||||
log_success_msg "Checking Opengnys Environmnet"
|
||||
ogExportVarEnvironment
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before configure ramfs structure for OG: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConfigureRamfs
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before configure netmoule specified in kernel parameters: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogLoadNetModule
|
||||
|
||||
#[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/og-premount"
|
||||
#run_scripts /scripts/og-premount
|
||||
#[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before configure networking: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConfigureNetworking
|
||||
log_success_msg "config networking"
|
||||
ogConfigureLoopback
|
||||
log_success_msg "config loopback"
|
||||
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before detect rootserver: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogGetROOTSERVER && log_success_msg "Get Info from pxe server and ckeck distribuited OG services "
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before connect and merging the rootfs -ogLive- : y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConnectOgLive && log_success_msg "Merge the initrd with the remote rootfs -ogLive-" || sh
|
||||
# si es necesario realiza ogConnect $OGSERVERLIVE $OGPROTOCOL $SRCOGLIVE $DSTOGLIVE
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before connect with client dir SHARE -engine,scripts,interface, -share- : y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConnect $OGSERVERSHARE $OGPROTOCOL $SRCOGSHARE $DSTOGSHARE
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before connect with client dir LOG STORAGE : y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConnect $OGSERVERLOG $OGPROTOCOL $SRCOGLOG $DSTOGLOG
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before connect with REPOSITORY STORAGE : y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogConnect $OGSERVERIMAGES $OGPROTOCOL $SRCOGIMAGES $DSTOGIMAGES
|
||||
|
||||
|
||||
|
||||
#[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before conect with og Services : y/N "
|
||||
#[ $? == 0 ] && sh || echo " "
|
||||
#ogConectROOTSERVER && log_success_msg "Conecting with og services" || sh
|
||||
|
||||
|
||||
#[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before merge the Second File System with initrd (First File System) : y/N "
|
||||
#[ $? == 0 ] && sh || echo " "
|
||||
#ogMerge2ndFile && log_success_msg "Merge onto Second File System"
|
||||
|
||||
|
||||
####[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/og-bottom"
|
||||
####run_scripts /scripts/og-bottom
|
||||
####[ "$quiet" != "y" ] && log_end_msg
|
||||
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before doing the postconfiguration: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
ogPostConfigureFS
|
||||
setupcon -k
|
||||
|
||||
[ "$ogdebug" == "true" ] && ogYesNo --timeout 5 --default no "Stop before calling oginit with /etc/inittab: y/N "
|
||||
[ $? == 0 ] && sh || echo " "
|
||||
|
||||
if [ "$oginit" ]
|
||||
then
|
||||
exec $oginit
|
||||
else
|
||||
exec init
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
# This is run first except when booting in single-user mode
|
||||
#
|
||||
#::sysinit:/opt/opengnsys/etc/preinit/defaultTESTING.sh
|
||||
# /bin/sh invocations on selected ttys
|
||||
#
|
||||
# Start an "askfirst" shell on the console (whatever that may be)
|
||||
#::askfirst:/bin/sh
|
||||
# Start an "askfirst" shell on /dev/tty2-4
|
||||
#tty1::respawn:/sbin/getty 38400 tty1
|
||||
tty1::respawn:/opt/opengnsys/etc/preinit/default.sh
|
||||
tty2::respawn:/sbin/getty 38400 tty2
|
||||
tty3::respawn:/sbin/getty 38400 tty3
|
||||
tty4::respawn:/sbin/getty 38400 tty4
|
||||
tty5::respawn:/sbin/getty 38400 tty5
|
|
@ -1,30 +0,0 @@
|
|||
# Framebuffer drivers are generally buggy and poorly-supported, and cause
|
||||
# suspend failures, kernel panics and general mayhem. For this reason we
|
||||
# never load them automatically.
|
||||
blacklist aty128fb
|
||||
blacklist atyfb
|
||||
#blacklist radeonfb
|
||||
blacklist cirrusfb
|
||||
blacklist cyber2000fb
|
||||
blacklist cyblafb
|
||||
blacklist gx1fb
|
||||
blacklist hgafb
|
||||
blacklist i810fb
|
||||
blacklist intelfb
|
||||
blacklist kyrofb
|
||||
blacklist lxfb
|
||||
blacklist matroxfb_base
|
||||
blacklist neofb
|
||||
blacklist nvidiafb
|
||||
blacklist pm2fb
|
||||
blacklist rivafb
|
||||
blacklist s1d13xxxfb
|
||||
blacklist savagefb
|
||||
blacklist sisfb
|
||||
blacklist sstfb
|
||||
blacklist tdfxfb
|
||||
blacklist tridentfb
|
||||
#blacklist vesafb
|
||||
blacklist vfb
|
||||
blacklist viafb
|
||||
blacklist vt8623fb
|
|
@ -1,4 +0,0 @@
|
|||
auto lo
|
||||
iface lo inet loopback
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
|
@ -1,93 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
### NOTA este archivo se sobreescribe al conectarse con el ogSHARE
|
||||
|
||||
|
||||
|
||||
|
||||
#/**
|
||||
#@file loadenviron.sh
|
||||
#@brief Script de carga de la API de funciones de OpenGNSys.
|
||||
#@warning License: GNU GPLv3+
|
||||
#@version 0.9
|
||||
#@author Ramon Gomez, ETSII Universidad de Sevilla
|
||||
#@date 2009-10-10
|
||||
#*/
|
||||
|
||||
GLOBAL="cat /proc/cmdline"
|
||||
for i in `${GLOBAL}`
|
||||
do
|
||||
echo $i | grep "=" > /dev/null && export $i
|
||||
done
|
||||
|
||||
|
||||
# FIXME Temporal
|
||||
export LANG="${LANG:-es_ES}"
|
||||
|
||||
#/// Directorios del projecto OpenGNSys.
|
||||
export OPENGNSYS="${OPENGNSYS:-/opt/opengnsys}"
|
||||
if [ -d $OPENGNSYS ]; then
|
||||
export OGBIN=$OPENGNSYS/bin
|
||||
export OGETC=$OPENGNSYS/etc
|
||||
export OGLIB=$OPENGNSYS/lib
|
||||
export OGAPI=$OGLIB/engine/bin
|
||||
export OGSCRIPTS=$OPENGNSYS/scripts
|
||||
export OGIMG=$OPENGNSYS/images
|
||||
export OGCAC=$OPENGNSYS/cache
|
||||
export OGLOG=$OPENGNSYS/log
|
||||
|
||||
# export PATH=$OGBIN:$OGAPI:$OGSCRIPTS:$PATH
|
||||
# export LD_LIBRARY_PATH=$OGLIB:$LD_LIBRARY_PATH
|
||||
|
||||
#/// Cargar fichero de idioma.
|
||||
LANGFILE=$OGETC/lang.$LANG.conf
|
||||
if [ -f $LANGFILE ]; then
|
||||
source $LANGFILE
|
||||
#for i in $(grep "^[a-zA-Z].*=" $LANGFILE | cut -f1 -d=); do
|
||||
for i in $(awk -F= '{if (NF==2) print $1}' $LANGFILE); do
|
||||
export $i
|
||||
done
|
||||
fi
|
||||
#/// Cargar API de funciones.
|
||||
echo "$MSG_LOADAPI"
|
||||
for i in $OGAPI/*.lib; do
|
||||
source $i
|
||||
done
|
||||
for i in $(typeset -F | cut -f3 -d" "); do
|
||||
export -f $i
|
||||
done
|
||||
# Carga de las API testing
|
||||
if [ "$engine" = "testing" ]
|
||||
then
|
||||
for i in $OGAPI/*.testing; do
|
||||
source $i
|
||||
done
|
||||
fi
|
||||
|
||||
source /tmp/net-eth* 2>/dev/null
|
||||
|
||||
# Añadir dependencia de arquitectura
|
||||
ARCH=$(ogGetArch)
|
||||
if [ -n "$ARCH" ]; then
|
||||
# export PATH=$OGBIN/$ARCH:$PATH
|
||||
# export LD_LIBRARY_PATH=$OGLIB/$ARCH:$LD_LIBRARY_PATH
|
||||
export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/opt/oglive/rootfs/opt/drbl/sbin
|
||||
export PATH=$OGSCRIPTS:$PATH:$OGAPI:$OGBIN:$OGBIN/$ARCH
|
||||
fi
|
||||
# Fichero de registros.
|
||||
export OGLOGFILE="$OGLOG/$(ogGetIpAddress).log"
|
||||
# FIXME Pruebas para grupos de ordenadores
|
||||
#export OGGROUP=$(ogGetGroup)
|
||||
export OGGROUP=aula3
|
||||
fi
|
||||
|
||||
#/// Declaración de códigos de error.
|
||||
export OG_ERR_FORMAT=1 # Formato de ejecución incorrecto.
|
||||
export OG_ERR_NOTFOUND=2 # Fichero o dispositivo no encontrado.
|
||||
export OG_ERR_PARTITION=3 # Error en partición de disco.
|
||||
export OG_ERR_LOCKED=4 # Partición o fichero bloqueado.
|
||||
export OG_ERR_IMAGE=5 # Error al crear o restaurar una imagen.
|
||||
export OG_ERR_NOTOS=6 # Sin sistema operativo.
|
||||
export OG_ERR_NOTEXEC=7 # Programa o función no ejecutable.
|
||||
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
|
||||
# This is the ssh client system-wide configuration file. See
|
||||
# ssh_config(5) for more information. This file provides defaults for
|
||||
# users, and the values can be changed in per-user configuration files
|
||||
# or on the command line.
|
||||
|
||||
# Configuration data is parsed as follows:
|
||||
# 1. command line options
|
||||
# 2. user-specific file
|
||||
# 3. system-wide file
|
||||
# Any configuration value is only changed the first time it is set.
|
||||
# Thus, host-specific definitions should be at the beginning of the
|
||||
# configuration file, and defaults at the end.
|
||||
|
||||
# Site-wide defaults for some commonly used options. For a comprehensive
|
||||
# list of available options, their meanings and defaults, please see the
|
||||
# ssh_config(5) man page.
|
||||
|
||||
Host *
|
||||
# ForwardAgent no
|
||||
# ForwardX11 no
|
||||
# ForwardX11Trusted yes
|
||||
# RhostsRSAAuthentication no
|
||||
# RSAAuthentication yes
|
||||
# PasswordAuthentication yes
|
||||
HostbasedAuthentication no
|
||||
# GSSAPIAuthentication no
|
||||
# GSSAPIDelegateCredentials no
|
||||
# GSSAPIKeyExchange no
|
||||
# GSSAPITrustDNS no
|
||||
# BatchMode no
|
||||
# CheckHostIP yes
|
||||
# AddressFamily any
|
||||
# ConnectTimeout 0
|
||||
# StrictHostKeyChecking ask
|
||||
# IdentityFile ~/.ssh/identity
|
||||
# IdentityFile ~/.ssh/id_rsa
|
||||
# IdentityFile ~/.ssh/id_dsa
|
||||
# Port 22
|
||||
# Protocol 2,1
|
||||
# Cipher 3des
|
||||
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
|
||||
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
|
||||
# EscapeChar ~
|
||||
# Tunnel no
|
||||
# TunnelDevice any:any
|
||||
# PermitLocalCommand no
|
||||
# VisualHostKey no
|
||||
SendEnv LANG LC_*
|
||||
# HashKnownHosts yes
|
||||
GSSAPIAuthentication yes
|
||||
GSSAPIDelegateCredentials no
|
||||
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
# Package generated configuration file
|
||||
# See the sshd_config(5) manpage for details
|
||||
|
||||
# What ports, IPs and protocols we listen for
|
||||
Port 22
|
||||
# Use these options to restrict which interfaces/protocols sshd will bind to
|
||||
#ListenAddress ::
|
||||
#ListenAddress 0.0.0.0
|
||||
Protocol 2
|
||||
# HostKeys for protocol version 2
|
||||
HostKey /etc/ssh/ssh_host_rsa_key
|
||||
HostKey /etc/ssh/ssh_host_dsa_key
|
||||
#Privilege Separation is turned on for security
|
||||
UsePrivilegeSeparation no
|
||||
|
||||
# Lifetime and size of ephemeral version 1 server key
|
||||
KeyRegenerationInterval 3600
|
||||
ServerKeyBits 768
|
||||
|
||||
# Logging
|
||||
SyslogFacility AUTH
|
||||
LogLevel INFO
|
||||
|
||||
# Authentication:
|
||||
LoginGraceTime 120
|
||||
PermitRootLogin yes
|
||||
StrictModes yes
|
||||
|
||||
RSAAuthentication yes
|
||||
PubkeyAuthentication yes
|
||||
#AuthorizedKeysFile %h/.ssh/authorized_keys
|
||||
|
||||
# Don't read the user's ~/.rhosts and ~/.shosts files
|
||||
IgnoreRhosts yes
|
||||
# For this to work you will also need host keys in /etc/ssh_known_hosts
|
||||
RhostsRSAAuthentication no
|
||||
# similar for protocol version 2
|
||||
HostbasedAuthentication no
|
||||
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
|
||||
#IgnoreUserKnownHosts yes
|
||||
|
||||
# To enable empty passwords, change to yes (NOT RECOMMENDED)
|
||||
PermitEmptyPasswords no
|
||||
|
||||
# Change to yes to enable challenge-response passwords (beware issues with
|
||||
# some PAM modules and threads)
|
||||
ChallengeResponseAuthentication no
|
||||
|
||||
# Change to no to disable tunnelled clear text passwords
|
||||
#PasswordAuthentication yes
|
||||
|
||||
# Kerberos options
|
||||
#KerberosAuthentication no
|
||||
#KerberosGetAFSToken no
|
||||
#KerberosOrLocalPasswd yes
|
||||
#KerberosTicketCleanup yes
|
||||
|
||||
# GSSAPI options
|
||||
#GSSAPIAuthentication no
|
||||
#GSSAPICleanupCredentials yes
|
||||
|
||||
X11Forwarding yes
|
||||
X11DisplayOffset 10
|
||||
PrintMotd no
|
||||
PrintLastLog yes
|
||||
TCPKeepAlive yes
|
||||
#UseLogin no
|
||||
|
||||
#MaxStartups 10:30:60
|
||||
#Banner /etc/issue.net
|
||||
|
||||
# Allow client to pass locale environment variables
|
||||
AcceptEnv LANG LC_*
|
||||
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
|
||||
# Set this to 'yes' to enable PAM authentication, account processing,
|
||||
# and session processing. If this is enabled, PAM authentication will
|
||||
# be allowed through the ChallengeResponseAuthentication and
|
||||
# PasswordAuthentication. Depending on your PAM configuration,
|
||||
# PAM authentication via ChallengeResponseAuthentication may bypass
|
||||
# the setting of "PermitRootLogin without-password".
|
||||
# If you just want the PAM account and session checks to run without
|
||||
# PAM authentication, then enable this but set PasswordAuthentication
|
||||
# and ChallengeResponseAuthentication to 'no'.
|
||||
UsePAM yes
|
Before Width: | Height: | Size: 870 B |
Before Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 13 KiB |
|
@ -1,11 +0,0 @@
|
|||
[Plymouth Theme]
|
||||
Name=Script
|
||||
Description=Script example plugin.
|
||||
ModuleName=script
|
||||
|
||||
[script]
|
||||
ImageDir=/lib/plymouth/themes/opengnsys
|
||||
ScriptFile=/lib/plymouth/themes/opengnsys/opengnsys.script
|
||||
|
||||
[script-env-vars]
|
||||
example_env_var=example env var value
|
Before Width: | Height: | Size: 13 KiB |
|
@ -1,203 +0,0 @@
|
|||
# This is an example plymouth plugin script
|
||||
|
||||
Window.SetBackgroundTopColor(0, 0, 0);
|
||||
Window.SetBackgroundBottomColor(0, 0, 0);
|
||||
|
||||
#logo.image = Image("special://logo");
|
||||
logo.image = Image ("opengnsys.png");
|
||||
logo.sprite = Sprite(logo.image);
|
||||
logo.opacity_angle = 0;
|
||||
|
||||
fun refresh_callback ()
|
||||
{
|
||||
if (status == "normal")
|
||||
{
|
||||
logo.opacity_angle += ((2 * 3.14) / 50) * 0.5; # 0.5 HZ
|
||||
min_opacity = 0.3;
|
||||
opacity = (Math.Cos(logo.opacity_angle) + 1) / 2;
|
||||
opacity *= 1 - min_opacity;
|
||||
opacity += min_opacity;
|
||||
logo.sprite.SetX (Window.GetX() + Window.GetWidth() / 2 - logo.image.GetWidth() / 2);
|
||||
logo.sprite.SetY (Window.GetY() + Window.GetHeight() / 2 - logo.image.GetHeight() / 2);
|
||||
logo.sprite.SetOpacity (opacity);
|
||||
}
|
||||
else
|
||||
{
|
||||
logo.sprite.SetX (0);
|
||||
logo.sprite.SetY (0);
|
||||
logo.sprite.SetOpacity (1);
|
||||
}
|
||||
}
|
||||
|
||||
Plymouth.SetRefreshFunction (refresh_callback);
|
||||
|
||||
#----------------------------------------- Dialogue --------------------------------
|
||||
|
||||
status = "normal";
|
||||
|
||||
fun dialog_setup()
|
||||
{
|
||||
local.box;
|
||||
local.lock;
|
||||
local.entry;
|
||||
|
||||
box.image = Image("box.png");
|
||||
lock.image = Image("lock.png");
|
||||
entry.image = Image("entry.png");
|
||||
|
||||
box.sprite = Sprite(box.image);
|
||||
box.x = Window.GetX() + Window.GetWidth() / 2 - box.image.GetWidth ()/2;
|
||||
box.y = Window.GetY() + Window.GetHeight() / 2 - box.image.GetHeight()/2;
|
||||
box.z = 10000;
|
||||
box.sprite.SetPosition(box.x, box.y, box.z);
|
||||
|
||||
lock.sprite = Sprite(lock.image);
|
||||
lock.x = box.x + box.image.GetWidth()/2 - (lock.image.GetWidth() + entry.image.GetWidth()) / 2;
|
||||
lock.y = box.y + box.image.GetHeight()/2 - lock.image.GetHeight()/2;
|
||||
lock.z = box.z + 1;
|
||||
lock.sprite.SetPosition(lock.x, lock.y, lock.z);
|
||||
|
||||
entry.sprite = Sprite(entry.image);
|
||||
entry.x = lock.x + lock.image.GetWidth();
|
||||
entry.y = box.y + box.image.GetHeight()/2 - entry.image.GetHeight()/2;
|
||||
entry.z = box.z + 1;
|
||||
entry.sprite.SetPosition(entry.x, entry.y, entry.z);
|
||||
|
||||
global.dialog.box = box;
|
||||
global.dialog.lock = lock;
|
||||
global.dialog.entry = entry;
|
||||
global.dialog.bullet_image = Image("bullet.png");
|
||||
dialog_opacity (1);
|
||||
}
|
||||
|
||||
fun dialog_opacity(opacity)
|
||||
{
|
||||
dialog.box.sprite.SetOpacity (opacity);
|
||||
dialog.lock.sprite.SetOpacity (opacity);
|
||||
dialog.entry.sprite.SetOpacity (opacity);
|
||||
for (index = 0; dialog.bullet[index]; index++)
|
||||
{
|
||||
dialog.bullet[index].sprite.SetOpacity(opacity);
|
||||
}
|
||||
}
|
||||
|
||||
fun display_normal_callback ()
|
||||
{
|
||||
global.status = "normal";
|
||||
if (global.dialog)
|
||||
dialog_opacity (0);
|
||||
}
|
||||
|
||||
fun display_password_callback (prompt, bullets)
|
||||
{
|
||||
global.status = "password";
|
||||
if (!global.dialog)
|
||||
dialog_setup();
|
||||
else
|
||||
dialog_opacity(1);
|
||||
for (index = 0; dialog.bullet[index] || index < bullets; index++)
|
||||
{
|
||||
if (!dialog.bullet[index])
|
||||
{
|
||||
dialog.bullet[index].sprite = Sprite(dialog.bullet_image);
|
||||
dialog.bullet[index].x = dialog.entry.x + index * dialog.bullet_image.GetWidth();
|
||||
dialog.bullet[index].y = dialog.entry.y + dialog.entry.image.GetHeight() / 2 - dialog.bullet_image.GetHeight() / 2;
|
||||
dialog.bullet[index].z = dialog.entry.z + 1;
|
||||
dialog.bullet[index].sprite.SetPosition(dialog.bullet[index].x, dialog.bullet[index].y, dialog.bullet[index].z);
|
||||
}
|
||||
if (index < bullets)
|
||||
dialog.bullet[index].sprite.SetOpacity(1);
|
||||
else
|
||||
dialog.bullet[index].sprite.SetOpacity(0);
|
||||
}
|
||||
}
|
||||
|
||||
Plymouth.SetDisplayNormalFunction(display_normal_callback);
|
||||
Plymouth.SetDisplayPasswordFunction(display_password_callback);
|
||||
|
||||
#----------------------------------------- Progress Bar --------------------------------
|
||||
|
||||
progress_box.original_image = Image("progress_box.png");
|
||||
progress_box.image = progress_box.original_image.Scale(Window.GetWidth (), progress_box.original_image.GetHeight());
|
||||
progress_box.sprite = Sprite(progress_box.image);
|
||||
|
||||
progress_box.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2;
|
||||
progress_box.y = Window.GetY() + Window.GetHeight() - progress_box.image.GetHeight();
|
||||
progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
|
||||
|
||||
progress_bar.original_image = Image("progress_bar.png");
|
||||
progress_bar.image = progress_bar.original_image.Scale(0, progress_box.image.GetHeight());
|
||||
progress_bar.sprite = Sprite();
|
||||
|
||||
progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_box.image.GetWidth() / 2;
|
||||
progress_bar.y = Window.GetY() + Window.GetHeight() - progress_box.image.GetHeight();
|
||||
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
|
||||
|
||||
fun progress_callback (duration, progress)
|
||||
{
|
||||
if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
|
||||
{
|
||||
progress_bar.image = progress_bar.original_image.Scale(progress_box.image.GetWidth(progress_box.image) * progress, progress_box.image.GetHeight());
|
||||
progress_bar.sprite.SetImage (progress_bar.image);
|
||||
}
|
||||
}
|
||||
|
||||
Plymouth.SetBootProgressFunction(progress_callback);
|
||||
|
||||
#----------------------------------------- Quit --------------------------------
|
||||
|
||||
fun quit_callback ()
|
||||
{
|
||||
logo.sprite.SetOpacity (1);
|
||||
}
|
||||
|
||||
Plymouth.SetQuitFunction(quit_callback);
|
||||
|
||||
#----------------------------------------- Message --------------------------------
|
||||
|
||||
message_sprite = Sprite();
|
||||
message_sprite.SetPosition(10, 10, 10000);
|
||||
|
||||
fun message_callback (text)
|
||||
{
|
||||
my_image = Image.Text(text, 0.6, 0.6, 0.6);
|
||||
message_sprite.SetImage(my_image);
|
||||
message_sprite.SetX(Window.GetWidth () / 2 - my_image.GetWidth() / 2);
|
||||
message_sprite.SetY((Window.GetHeight () * 0.7) - (2 * my_image.GetHeight()));
|
||||
message.sprite.SetZ(11);
|
||||
}
|
||||
|
||||
Plymouth.SetMessageFunction(message_callback);
|
||||
|
||||
|
||||
#----------------------------------------- Status Update --------------------------------
|
||||
|
||||
statusupdate_sprite = Sprite();
|
||||
|
||||
fun StringLength(string) {
|
||||
|
||||
index = 0;
|
||||
str = String(string);
|
||||
while(str.CharAt(index)) index++;
|
||||
return index;
|
||||
}
|
||||
|
||||
fun status_callback (text)
|
||||
{
|
||||
// Truncate the message if too long
|
||||
if (StringLength(text) > (Window.GetHeight () / 4 )) {
|
||||
text = text.SubString(0, (Window.GetHeight () / 4 ) - 3);
|
||||
text += "...";
|
||||
}
|
||||
|
||||
my_image = Image.Text(text, 0.4, 0.4, 0.4);
|
||||
statusupdate_sprite.SetPosition(10, 10 + (i * 20), 10000);
|
||||
statusupdate_sprite.SetImage(my_image);
|
||||
statusupdate_sprite.SetX(Window.GetWidth () / 2 - my_image.GetWidth() / 2);
|
||||
statusupdate_sprite.SetY((Window.GetHeight () * 0.7) - my_image.GetHeight());
|
||||
statusupdate.sprite.SetZ(11);
|
||||
}
|
||||
|
||||
Plymouth.SetUpdateStatusFunction(status_callback);
|
||||
|
||||
|
Before Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 285 B |
|
@ -1,38 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################
|
||||
##################### SOFTWARE #####################
|
||||
################################################################
|
||||
export LANGUAGE=C
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
|
||||
#dpkg-divert --local --rename --add /sbin/initctl
|
||||
#ln -s /bin/true /sbin/initctl
|
||||
|
||||
apt-get -y update
|
||||
# software to compile code
|
||||
apt-get -y --force-yes install build-essential libattr* attr make m4 gettext libmhash-dev gdebi-core gawk
|
||||
|
||||
source /opt/opengnsys/lib/engine/bin/ToolsGNU.c
|
||||
|
||||
#TODO: comprobar si esta instalado.
|
||||
ctorrent install
|
||||
|
||||
#TODO: comprobar si esta instalado.
|
||||
udpcast install
|
||||
|
||||
#ntfs-3g install
|
||||
|
||||
#TODO: comprobar si esta instalado.
|
||||
ms-sys install
|
||||
|
||||
#TODO: comprobar si esta instalado.
|
||||
wget -O partclone_0.2.16_i386.deb http://downloads.sourceforge.net/project/partclone/stable/0.2.16/partclone_0.2.16_i386.deb?use_mirror=ovh
|
||||
gdebi -n partclone_0.2.16_i386.deb
|
||||
|
||||
#TODO: comprobar si esta instalado.
|
||||
cd /tmp
|
||||
wget http://damien.guibouret.free.fr/savepart.zip
|
||||
unzip savepart.zip -d /sbin/
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#!/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
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
#TODO Comprobar si esta los source.
|
||||
|
||||
#svn checkout http://www.opengnsys.es/svn/branches/version1.0/client /tmp/opengnsys_installer/opengnsys/client/;
|
||||
#svn checkout http://www.opengnsys.es/svn/branches/version2/ /tmp/opengnsys_installer/opengnsys2
|
||||
find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
|
||||
|
||||
#plymouth
|
||||
apt-get install plymouth plymouth-theme-script
|
||||
|
||||
|
||||
#plymoutyh
|
||||
update-alternatives --install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/opengnsys/opengnsys.plymouth 100
|
||||
update-alternatives --set default.plymouth /lib/plymouth/themes/opengnsys/opengnsys.plymouth
|
||||
|
||||
mkdir -p /etc/initramfs-tools/conf.d
|
||||
echo "FRAMEBUFFER=y" > /etc/initramfs-tools/conf.d/splash
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
export OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
#OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
export OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}')
|
||||
export OSRELEASE=$(uname -a | awk '{print $3}')
|
||||
uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
|
||||
|
||||
|
||||
|
||||
cd /usr/lib/initramfs-tools/bin/
|
||||
rm *
|
||||
cp /bin/busybox ./
|
||||
cd /tmp/
|
||||
mkinitramfs -o /tmp/initrd.img-$OSRELEASE -v $OSRELEASE
|
||||
cp /boot/vmlinuz-$OSRELEASE /tmp
|
|
@ -1,79 +0,0 @@
|
|||
#!/bin/bash
|
||||
################################################################
|
||||
##################### SOFTWARE #####################
|
||||
################################################################
|
||||
export LANGUAGE=C
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
|
||||
export OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
#OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
export OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}')
|
||||
export OSRELEASE=$(uname -a | awk '{print $3}')
|
||||
uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
|
||||
|
||||
|
||||
|
||||
dpkg-divert --local --rename --add /sbin/initctl
|
||||
ln -s /bin/true /sbin/initctl
|
||||
|
||||
apt-get clean
|
||||
apt-get -y update
|
||||
|
||||
|
||||
# software system
|
||||
apt-get -y --force-yes install linux-image-${OSRELEASE} linux-headers-${OSRELEASE} linux-image-$RELEASE wget dialog man-db htop fbset gdebi-core busybox-static
|
||||
|
||||
apt-get -y --force-yes install console-data locales
|
||||
|
||||
# sofware networking
|
||||
apt-get -y --force-yes install netpipes nfs-common sshfs smbfs smbclient davfs2 unionfs-fuse open-iscsi nmap tcpdump arping dnsutils
|
||||
|
||||
apt-get clean
|
||||
# software services
|
||||
apt-get -y --force-yes install openssh-server bittornado trickle iptraf screen schroot grub lighttpd
|
||||
|
||||
# software disk and filesystem
|
||||
apt-get -y --force-yes install drbl-ntfsprogs ntfsprogs parted ntfs-3g dosfstools
|
||||
apt-get -y --force-yes install dmraid dmsetup lvm2 e2fsprogs jfsutils reiserfsprogs xfsprogs unionfs-fuse mhddfs squashfs-tools
|
||||
apt-get -y --force-yes install hfsplus hfsprogs hfsutils nilfs-tools reiser4progs ufsutils
|
||||
|
||||
#btrfs-tools
|
||||
|
||||
# software cloning
|
||||
apt-get -y --force-yes install drbl-partimage fsarchiver pv kexec-tools
|
||||
apt-get -y --force-yes install mbuffer
|
||||
|
||||
#monitor
|
||||
apt-get install bwbar bmon iftop ifstat dstat hdparm sdparm blktool testdisk ssmping mii-diag
|
||||
|
||||
## software postconf
|
||||
apt-get -y --force-yes install drbl-chntpw chntpw ethtool lshw gawk subversion
|
||||
|
||||
# software compressor
|
||||
apt-get -y --force-yes install lzma zip unzip gzip lzop drbl-lzop pigz pbzip2 lbzip2 rzip p7zip-full unzip
|
||||
|
||||
|
||||
#compatibilidad og2
|
||||
apt-get install python-openssl python
|
||||
|
||||
|
||||
|
||||
apt-get -y --force-yes remove busybox
|
||||
apt-get -y --force-yes install busybox-static bash-static
|
||||
apt-get clean
|
||||
#apt-get -y --force-yes xorg-dev xorg lxde roxterm
|
||||
#
|
||||
####################################################################
|
||||
###################### Reconfigurando paquetes ######################
|
||||
###################################################################
|
||||
|
||||
|
||||
#dpkg-reconfigure console-data
|
||||
#dpkg-reconfigure console-setup
|
||||
#dpkg-reconfigure locales
|
||||
apt-get clean
|
||||
##TODO################# Borrar algunos binarios del mkinitramfs
|
||||
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
dpkg-reconfigure console-data
|
||||
dpkg-reconfigure console-setup
|
||||
dpkg-reconfigure locales
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo "comprobando directorio .ssh del root"
|
||||
if [ ! -d /root/.ssh ]
|
||||
then
|
||||
echo "creando directorio .ssh 600"
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 /root/.ssh
|
||||
fi
|
||||
|
||||
|
||||
echo "comprobando el fichero authorized_keys .ssh del root"
|
||||
if [ ! -f /root/.ssh/authorized_keys ]
|
||||
then
|
||||
echo "creando el fichero authorized_keys"
|
||||
touch /root/.ssh/authorized_keys
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
fi
|
||||
|
||||
ssh-keygen -q -f /root/.ssh/id_rsa -N ""
|
||||
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
|
||||
|
||||
## TODO: exportamos la publica a los repos
|
||||
cp /root/.ssh/id_rsa.pub /tmp/rsa.ogclient.pub
|
|
@ -1,126 +0,0 @@
|
|||
#!/bin/bash
|
||||
#TODO Comprobar si esta los source.
|
||||
|
||||
#svn checkout http://www.opengnsys.es/svn/branches/version1.0/client /tmp/opengnsys_installer/opengnsys/client/;
|
||||
#svn checkout http://www.opengnsys.es/svn/branches/version2/ /tmp/opengnsys_installer/opengnsys2
|
||||
find /tmp/opengnsys_installer/ -name .svn -type d -exec rm -fr {} \; 2>/dev/null;
|
||||
|
||||
|
||||
SVNCLIENTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools
|
||||
SVNCLIENTSTRUCTURE=/tmp/opengnsys_installer/opengnsys/client/shared
|
||||
SVNCLIENTENGINE=/tmp/opengnsys_installer/opengnsys/client/engine
|
||||
SVNOG2=/tmp/opengnsys_installer/opengnsys2
|
||||
|
||||
OGCLIENTMOUNT=""
|
||||
|
||||
#ogClientOsInfo host
|
||||
#ogClientOsInfo $1
|
||||
#1 la salida de ogClientOsInfo
|
||||
OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
#OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}')
|
||||
OSRELEASE=$(uname -a | awk '{print $3}')
|
||||
uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386
|
||||
OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
|
||||
echo $OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP
|
||||
|
||||
LERROR=TRUE
|
||||
|
||||
echo "$FUNCNAME: Iniciando la personalización con datos del SVN "
|
||||
# comprobar que está montado $OGCLIENTMOUNT
|
||||
#mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
|
||||
# parseamos del apt.source
|
||||
sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list.ubuntu > ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Parsing apt.sources : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#parseamos el script de generación del initrd.
|
||||
sed -e "s/OSRELEASE/$OSRELEASE/g" ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.generic.sh > ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.sh
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Parsing GenerateInitrd.sh : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#damos permiso al directorio de scripts
|
||||
chmod 775 ${SVNCLIENTDIR}/clientstructure/root/*
|
||||
|
||||
# los copiamos
|
||||
cp -prv ${SVNCLIENTDIR}/clientstructure/* /
|
||||
mkdir -p ${OGCLIENTMOUNT}/opt/opengnsys/
|
||||
cp -prv ${SVNCLIENTSTRUCTURE}/* ${OGCLIENTMOUNT}/opt/opengnsys/
|
||||
cp -prv ${SVNCLIENTENGINE}/* ${OGCLIENTMOUNT}/opt/opengnsys/lib/engine/bin/
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Copying client data : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# copiamos algunas cosas del nfsexport
|
||||
|
||||
#### Tipos de letra para el Browser.
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/lib/fonts
|
||||
#### Crear enlaces para compatibilidad con las distintas versiones del Browser.
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.2/lib/fonts
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.3/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/fonts
|
||||
|
||||
|
||||
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Linking Browser fonts : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# B ########################################################
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/pci.ids $OGCLIENTMOUNT/etc
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Copying pci.ids : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp ${SVNCLIENTSTRUCTURE}/bin/browser $OGCLIENTMOUNT/bin
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Copying Browser : ERROR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#Compatiblidad con og2
|
||||
echo "mkdir -p /opt/opengnsys/lib/engine/2.0/"
|
||||
mkdir -p /opt/opengnsys/lib/engine/2.0/
|
||||
echo "cp -prv ${SVNOG2}/engine/2.0 $OGCLIENTMOUNT/opt/opengnsys/lib/engine/2.0"
|
||||
cp -prv ${SVNOG2}/engine/2.0/ $OGCLIENTMOUNT/opt/opengnsys/lib/engine/
|
||||
cp -prv ${SVNOG2}/ogr/ogr $OGCLIENTMOUNT/opt/opengnsys/bin/
|
||||
cp -prv ${SVNOG2}/job_executer $OGCLIENTMOUNT/opt/opengnsys/bin/
|
||||
cp -prv ${SVNOG2}/ogr/libogr.py $OGCLIENTMOUNT/usr/lib/python2.7/
|
||||
|
||||
cp ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $OGCLIENTMOUNT/bin
|
||||
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "$FUNCNAME(): Copying ogAdmClient : ERROR"
|
||||
exit 1
|
||||
else
|
||||
echo "$FUNCNAME: Finalizado: OK "
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
echo "comprobando directorio .ssh del root"
|
||||
if [ ! -d /root/.ssh ]
|
||||
then
|
||||
echo "creando directorio .ssh 600"
|
||||
mkdir -p /root/.ssh
|
||||
chmod 700 /root/.ssh
|
||||
fi
|
||||
echo "creando el fichero authorized_keys"
|
||||
touch /root/.ssh/authorized_keys
|
||||
chmod 600 /root/.ssh/authorized_keys
|
||||
|
||||
echo "importando la clave publica del servidor OG"
|
||||
cat /tmp/id_rsa.pub
|
||||
|
||||
[ -f /tmp/id_rsa.pub ] && cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys || echo "no key publica og"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#/bin/bash
|
||||
|
||||
mount -o rw,remount /
|
||||
mount proc /proc -t proc
|
||||
export PATH=$PATH dpkg -i *.deb
|
||||
modprobe 8139too
|
||||
modprobe 8139cp
|
||||
dhclient
|
||||
/etc/init.d/ssh restart
|
|
@ -1,5 +0,0 @@
|
|||
es_ES ISO-8859-1
|
||||
es_ES@euro ISO-8859-15
|
||||
es_ES.UTF-8 UTF-8
|
||||
es_ES.UTF-8@euro UTF-8
|
||||
en_US.UTF-8 UTF-8
|
|
@ -1,164 +0,0 @@
|
|||
#!/bin/bash
|
||||
#@file ogClientGenerator.sh
|
||||
#@brief Script generación del cliente OpenGnSys
|
||||
#@warning
|
||||
#@version 0.9 -
|
||||
#@author Antonio J. Doblas Viso.
|
||||
#@date 2010/05/24
|
||||
#*/
|
||||
|
||||
|
||||
#$1 OSCONENAME lucid karmic
|
||||
#if [ $# -ne 1 ]; then
|
||||
# echo ": invalid number of parameters"
|
||||
# echo " host | lucid | karmic | jaunty | lenny | squeeze "
|
||||
# exit 1
|
||||
#fi
|
||||
TYPECLIENT=host
|
||||
|
||||
# Solo ejecutable por usuario root
|
||||
if [ "$(whoami)" != 'root' ]
|
||||
then
|
||||
echo "ERROR: this program must run under root privileges!!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
#FIXME: variables del instalador oficial.
|
||||
WORKDIR=/tmp/opengnsys_installer
|
||||
INSTALL_TARGET=/opt/opengnsys
|
||||
LOG_FILE=/tmp/opengnsys_installation.log
|
||||
PROGRAMDIR=$(readlink -e $(dirname "$0"))
|
||||
|
||||
|
||||
#funciones especificas del cliente.
|
||||
source $PROGRAMDIR/ogClientManager.lib
|
||||
#funciones incluidas dentro del scritps general de instalacion.
|
||||
source $PROGRAMDIR/ogInstaller.lib
|
||||
|
||||
echoAndLog "OpenGnSys CLIENT installation begins at $(date)"
|
||||
|
||||
##########################################################################
|
||||
## FASE 1 - Instalación de software adicional.
|
||||
##TO DO Integrar en el instaldor. Actualizar repositorios
|
||||
# Datos para la generación del cliente.
|
||||
DEPENDENCIES=( debootstrap subversion schroot squashfs-tools)
|
||||
apt-get update
|
||||
# Instalación de dependencias (paquetes de sistema operativo).
|
||||
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 DEL TO DO
|
||||
############################################## FIN FASE 1
|
||||
|
||||
|
||||
|
||||
############## FASE 2 - Asignación de variables
|
||||
#obtenemos las variables necesarias.
|
||||
ogClientVar
|
||||
#obtenemos la información del host.
|
||||
ogClientOsInfo
|
||||
######################## FIN fase 2
|
||||
|
||||
############# FASE 3: Segundo Sistema archivos (img) Creación.
|
||||
#TODO comprobacion de que el fichero esta creado.
|
||||
file $OGCLIENTFILE | grep "partition 1: ID=0x83"
|
||||
if [ $? == 1 ]
|
||||
then
|
||||
##3.1 creación y formateo del disco virtual. generamos el dispositivo loop.
|
||||
ogClient2ndFile || exit 1
|
||||
fi
|
||||
|
||||
|
||||
#3.2 generamos el Sistema de archivos con debootstrap
|
||||
# Comprobamos que ya tenemos alguno.
|
||||
schroot -p -c IMGogclient -- touch /tmp/ogclientOK
|
||||
if [ -f /tmp/ogclientOK ]
|
||||
then
|
||||
rm /tmp/ogclientOK
|
||||
else
|
||||
ogClient2ndFs $TYPECLIENT || exit
|
||||
fi
|
||||
|
||||
|
||||
############### FASE 4: Configuración el acceso al Segundo Sistema de archivos (img), para schroot
|
||||
cat /etc/schroot/schroot.conf | grep ogclient || ogClientSchrootConf
|
||||
|
||||
|
||||
############### FASE 5: Configuración del Segundo Sistema de archivos (img) con la estructura especial de OpenGnsys
|
||||
#ogClient2ndSVN $TYPECLIENT || exit
|
||||
cp ${SVNCLIENTDIR}/clientstructure/root/* /tmp/
|
||||
chmod 777 /tmp/*.sh
|
||||
schroot -p -c IMGogclient -- /tmp/importSVNboot-tools.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"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "Instalando sofware adicional OG : ERROR"
|
||||
exit
|
||||
else
|
||||
echoAndLog "Instalando sofware adicional OG: OK"
|
||||
fi
|
||||
#### 6.2 compilación de software.
|
||||
cd /
|
||||
schroot -p -c IMGogclient -- /root/CompileSoftware.sh
|
||||
cd -
|
||||
|
||||
### 6.3 configuracion hostname passroot securety
|
||||
cd /
|
||||
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 /
|
||||
ssh-keygen -q -f /root/.ssh/id_rsa -N ""
|
||||
cp /root/.ssh/id_rsa.pub /tmp
|
||||
schroot -p -c IMGogclient -- /root/importSshKeys.sh
|
||||
cd -
|
||||
############ y la del propio cliente.
|
||||
schroot -c IMGogclient -- /root/generateSshKeysClient.sh
|
||||
|
||||
## configuramos los locales.
|
||||
schroot -c IMGogclient -- /root/ReconfigureLocales.sh
|
||||
|
||||
|
||||
################## FIN fase 6. Fin de comfiguración del segundo sistema de archivos (img)
|
||||
|
||||
################## FASE 7. Generamos el 1er sistema de archivos. INITRD
|
||||
#nota el parametro es el "tipo" de linux generado en debootstrap. usar solo "host", es decir version,kernel ... del propio host
|
||||
#nota: hace un schroot, al 2fs (img), ejecuta el fichero generateinitrd.
|
||||
#nota: deja en el directorio tmp del host el nuevo initrd, y lo copia al tftpboot
|
||||
ogClientInitrd $TYPECLIENT
|
||||
|
||||
|
||||
################## FASE 8. convertimos el 2ºFS(img) en 2ºFS(sqfs)
|
||||
# generamos el 2sistema de archivos en squashfs
|
||||
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.
|
||||
installationSummary
|
||||
|
||||
echoAndLog "OpenGnSys installation finished at $(date)"
|
|
@ -1,740 +0,0 @@
|
|||
|
||||
ogClientVar()
|
||||
{
|
||||
export SVNCLIENTDIR=/tmp/opengnsys_installer/opengnsys/client/boot-tools
|
||||
export SVNCLIENTSTRUCTURE=/tmp/opengnsys_installer/opengnsys/client/shared
|
||||
export SVNCLIENTENGINE=/tmp/opengnsys_installer/opengnsys/client/engine
|
||||
|
||||
export SVNOG2=/tmp/opengnsys_installer/opengnsys2
|
||||
|
||||
export OGCLIENTBASEDIR=/var/lib/tftpboot/ogclient/
|
||||
export OGCLIENTFILE=${OGCLIENTBASEDIR}ogclient.img
|
||||
export OGCLIENTMOUNT=${OGCLIENTBASEDIR}ogclientmount
|
||||
# tamaño maximo limitado por schroot 2GB
|
||||
export OGCLIENTSIZEMB=1900
|
||||
#export OGCLIENTSIZEMB=1000
|
||||
# export OGCLIENTSIZEKB=500
|
||||
export OGCLIENTLABEL=ogClient
|
||||
#export OGLIB=/opt/opengnsys/client/lib
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ogClientOsInfo ()
|
||||
{
|
||||
#TODO según host, un OSHHTP u otro OSARCH
|
||||
#1 OSCODENAME jaunty|karmic|lucid
|
||||
#devuelve OSDISTRIB(ubuntu,debian),OSCODENAME(lucid,karmic,squeeze):OGRELEASE:httpAPT
|
||||
case $1 in
|
||||
host | HOST)
|
||||
export OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
#OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
export OSCODENAME=$(cat /etc/lsb-release | grep CODENAME | awk -F= '{print $NF}')
|
||||
export OSRELEASE=$(uname -a | awk '{print $3}')
|
||||
uname -a | grep x86_64 > /dev/null && export OSARCH=amd64 || export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
|
||||
;;
|
||||
jaunty|JAUNTY)
|
||||
export OSDISTRIB=ubuntu
|
||||
export OSCODENAME=jaunty
|
||||
export OSRELEASE="2.6.28-11-generic"
|
||||
export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/"
|
||||
;;
|
||||
lenny|LENNY)
|
||||
export OSDISTRIB=debian
|
||||
export OSCODENAME=lenny
|
||||
export OSRELEASE="2.6.28-11-generic"
|
||||
export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
|
||||
;;
|
||||
squeeze|SQUEEZE)
|
||||
export OSDISTRIB=debian
|
||||
export OSCODENAME=squeeze
|
||||
export OSRELEASE="2.6.28-11-generic"
|
||||
export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
|
||||
;;
|
||||
karmic|KARMIC)
|
||||
export OSDISTRIB=ubuntu
|
||||
export OSCODENAME=karmic
|
||||
export OSRELEASE="2.6.31-14-generic"
|
||||
export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
|
||||
;;
|
||||
lucid|LUCID)
|
||||
export OSDISTRIB=ubuntu
|
||||
export OSCODENAME=lucid
|
||||
export OSRELEASE="2.6.32-21-generic-pae"
|
||||
export OSARCH=i386
|
||||
export OSHTTP="http://es.archive.ubuntu.com/ubuntu/ "
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
echo $OSDISTRIB:$OSCODENAME:$OSRELEASE:$OSARCH:$OSHTTP
|
||||
}
|
||||
|
||||
#creación y formateo del disco virtual.
|
||||
ogClient2ndFile ()
|
||||
{
|
||||
local RERROR DISKLOOP PARTLOOP #return code error
|
||||
echoAndLog "$FUNCNAME(): Creación y formateo del disco virtual $OGCLIENTSIZEMB MB "
|
||||
#Desmontamos por si acaso el dispositivo virtual
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
echo "$FUNCNAME(): Creando el directorio donde se montará el disco virtual $OGCLIENTMOUNT"
|
||||
mkdir -p $OGCLIENTMOUNT
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Creando directorio $OGCLIENTMOUNT : ERROR"
|
||||
return 1
|
||||
fi
|
||||
chown -R root:opengnsys $OGCLIENTBASEDIR
|
||||
echo "$FUNCNAME(): Creando el disco virtual que almacenará el FS del cliente $OGCLIENTSIZEMB MB de datos físicos"
|
||||
dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB
|
||||
#qemu-img create $OGCLIENTFILE 3G
|
||||
#dd if=/dev/zero of=$OGCLIENTFILE bs=1k count=$OGCLIENTSIZEKB # necesita 500MB
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Creando el disco virtual: ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
DISKLOOP=$(losetup -f)
|
||||
losetup $DISKLOOP $OGCLIENTFILE
|
||||
echo "$FUNCNAME(): particiondo el disco virtual - $DISKLOOP - con una particion primaria"
|
||||
echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk $DISKLOOP
|
||||
#echo $?
|
||||
# da error, porque no puede actualizar el kernel.
|
||||
#if [ $? -ne 0 ]
|
||||
#then
|
||||
# errorAndLog "$FUNCNAME(): Particionando el disco virutal: ERROR"
|
||||
# return 1
|
||||
#fi
|
||||
|
||||
echoAndLog "$FUNCNAME(): Desmontando $DISKLOOP despues del particionado "
|
||||
losetup -d $DISKLOOP
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Liberando disco virtual despues del particionado: ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
|
||||
#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
|
||||
PARTLOOP=$(losetup -f)
|
||||
echo "$FUNCNAME(): Formateando la particion principal $PARTLOOP"
|
||||
losetup -o 32256 $PARTLOOP $OGCLIENTFILE && mkfs.ext3 -b 4096 -L $OGCLIENTLABEL $PARTLOOP
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Formateando la particion principal del disco virtual: ERROR"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "$FUNCNAME(): Desmontando $PARTLOOP despues del formateo "
|
||||
losetup -d $PARTLOOP
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Liberando la particion virtual despues del formateo: ERROR"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "$FUNCNAME(): $OGCLIENTFILE $OGCLIENTSIZEMB MB : OK"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ogClient2ndFs ()
|
||||
{
|
||||
ogClientOsInfo $1
|
||||
echoAndLog "$FUNCNAME: Iniciando la generación del sistema de archivos "
|
||||
#Montamos el dispositivo virtual en su punto de montaje.
|
||||
mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
|
||||
mount | grep $OGCLIENTMOUNT && echoAndLog "$FUNCNAME: mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256 OK " || errorAndLog "$FUNCNAME: mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256 : FAILURE "
|
||||
|
||||
#debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe ${OSCODENAME} ${OGCLIENTMOUNT} ${OSHTTP}
|
||||
debootstrap --arch=$OSARCH --components=main,universe ${OSCODENAME} ${OGCLIENTMOUNT} ${OSHTTP}
|
||||
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "$FUNCNAME: debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe $OSCODENAME $OGCLIENTMOUNT $OSHTTP
|
||||
: ha fallado!"
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
return 1
|
||||
else
|
||||
echoAndLog "$FUNCNAME: debootstrap --include=linux-image-${OSRELEASE},linux-headers-${OSRELEASE} --arch=$OSARCH --components=main,universe $OSCODENAME $OGCLIENTMOUNT $OSHTTP
|
||||
: ok"
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
return 0
|
||||
fi
|
||||
sleep 5
|
||||
|
||||
##preubas revisar OSRELEASE
|
||||
#debootstrap --include=linux-image-${OSRELEASE} --arch=i386 --variant=minbase $OSVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
#debootstrap --variant=minbase --include=linux-image-${OGRELEASE} --arch=i386 $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
#echo debootstrap --include=linux-image-${OGRELEASE},dbus --arch=i386 --components=main,universe $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
########## configura el segundo sistema de archivos
|
||||
########### parametro: "host"
|
||||
function ogClient2ndSVN()
|
||||
{
|
||||
ogClientOsInfo host
|
||||
#ogClientOsInfo $1
|
||||
#1 la salida de ogClientOsInfo
|
||||
local LERROR
|
||||
LERROR=TRUE
|
||||
echoAndLog "$FUNCNAME: Iniciando la personalización con datos del SVN "
|
||||
# comprobar que está montado $OGCLIENTMOUNT
|
||||
mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
|
||||
# parseamos del apt.source
|
||||
sed -e "s/OSCODENAME/$OSCODENAME/g" ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list.ubuntu > ${SVNCLIENTDIR}/clientstructure/etc/apt/sources.list
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Parsing apt.sources : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#parseamos el script de generación del initrd.
|
||||
sed -e "s/OSRELEASE/$OSRELEASE/g" ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.generic.sh > ${SVNCLIENTDIR}/clientstructure/root/GenerateInitrd.sh
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Parsing GenerateInitrd.sh : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#damos permiso al directorio de scripts
|
||||
chmod 775 ${SVNCLIENTDIR}/clientstructure/root/*
|
||||
|
||||
# los copiamos
|
||||
cp -prv ${SVNCLIENTDIR}/clientstructure/* $OGCLIENTMOUNT
|
||||
mkdir -p ${OGCLIENTMOUNT}/opt/opengnsys/
|
||||
cp -prv ${SVNCLIENTSTRUCTURE}/* ${OGCLIENTMOUNT}/opt/opengnsys/
|
||||
cp -prv ${SVNCLIENTENGINE}/* ${OGCLIENTMOUNT}/opt/opengnsys/lib/engine/bin/
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Copying client data : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# copiamos algunas cosas del nfsexport
|
||||
|
||||
#### Tipos de letra para el Browser.
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/lib/fonts
|
||||
#### Crear enlaces para compatibilidad con las distintas versiones del Browser.
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/
|
||||
mkdir -p $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.2/lib/fonts
|
||||
#ln -fs $OGCLIENTMOUNT/usr/local/lib/fonts /usr/local/QtEmbedded-4.6.3/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/Trolltech/QtEmbedded-4.5.1/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.2/lib/fonts
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/fonts $OGCLIENTMOUNT/usr/local/QtEmbedded-4.6.3/lib/fonts
|
||||
|
||||
|
||||
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Linking Browser fonts : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# B ########################################################
|
||||
cp -pr ${SVNCLIENTSTRUCTURE}/lib/pci.ids $OGCLIENTMOUNT/etc
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Copying pci.ids : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
cp ${SVNCLIENTSTRUCTURE}/bin/browser $OGCLIENTMOUNT/bin
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Copying Browser : ERROR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
#Compatiblidad con og2
|
||||
cp -prv ${SVNOG2}/engine/2.0 en /opt/opengnsys/lib/engine/2.0
|
||||
cp -prv ${SVNOG2}/ogr/ogr /opt/opengnsys/bin/
|
||||
cp -prv ${SVNOG2}/ogr/libogr.py /opt/opengnsys/bin/
|
||||
cp -prv ${SVNOG2}/job_executer /opt/opengnsys/bin/
|
||||
|
||||
|
||||
cp ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $OGCLIENTMOUNT/bin
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
errorAndLog "$FUNCNAME(): Copying ogAdmClient : ERROR"
|
||||
return 1
|
||||
else
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
echoAndLog "$FUNCNAME: Finalizado: OK "
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
ogClientSchrootConf()
|
||||
{
|
||||
echoAndLog "$FUNCNAME: Iniciando la configuración del schroot "
|
||||
cp /etc/schroot/schroot.conf /etc/schroot/schroot.conf.`getDateTime`
|
||||
cat << EOF > /etc/schroot/schroot.conf
|
||||
[IMGogclient]
|
||||
type=loopback
|
||||
file=/var/lib/tftpboot/ogclient/ogclient.img
|
||||
description=ogclient ubuntu luc IMGi
|
||||
#priority=1
|
||||
users=root
|
||||
groups=root
|
||||
root-groups=root
|
||||
mount-options=-o offset=32256
|
||||
root-users=root
|
||||
#[DIRogclient]
|
||||
#type=directory
|
||||
#directory=/var/lib/tftpboot/ogclient/ogclientmount
|
||||
#description=ogclient ubuntu lucid DIR
|
||||
#priority=2
|
||||
#users=root
|
||||
#groups=root
|
||||
#root-groups=root
|
||||
#root-users=root
|
||||
EOF
|
||||
cp /etc/schroot/mount-defaults /etc/schroot/mount-defaults.`getDateTime`
|
||||
cat << EOF > /etc/schroot/mount-defaults
|
||||
# mount.defaults: static file system information for chroots.
|
||||
# Note that the mount point will be prefixed by the chroot path
|
||||
# (CHROOT_PATH)
|
||||
#
|
||||
# <file system> <mount point> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
#procbususb /proc/bus/usb usbfs defaults 0 0
|
||||
#/dev /dev none rw,bind 0 0
|
||||
/dev/pts /dev/pts none rw,bind 0 0
|
||||
/dev/shm /dev/shm none rw,bind 0 0
|
||||
#/home /home none rw,bind 0 0
|
||||
/tmp /tmp none rw,bind 0 0
|
||||
EOF
|
||||
|
||||
echoAndLog "$FUNCNAME: Finalizado: OK "
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
||||
########### param1 "host"
|
||||
ogClientInitrd()
|
||||
{
|
||||
ogClientVar
|
||||
cd /
|
||||
ogClientOsInfo $1
|
||||
schroot -c IMGogclient -- /root/GenerateInitrd.generic.sh
|
||||
echo "cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR"
|
||||
cp /tmp/*-${OSRELEASE} $OGCLIENTBASEDIR
|
||||
cp /tmp/initrd.img-${OSRELEASE} ${OGCLIENTBASEDIR}/oginitrd.img
|
||||
cp /tmp/vmlinuz-${OSRELEASE} ${OGCLIENTBASEDIR}/ogvmlinuz
|
||||
cd -
|
||||
chmod -R 755 $OGCLIENTBASEDIR
|
||||
|
||||
}
|
||||
|
||||
|
||||
ogClient2ndSqfs()
|
||||
{
|
||||
ogClientVar
|
||||
echoAndLog "$FUNCNAME: Iniciando la creación del sistema de archivos en sqfs "
|
||||
# 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`
|
||||
mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
mksquashfs $OGCLIENTMOUNT $OGCLIENTBASEDIR/ogclient.sqfs
|
||||
chmod 744 $OGCLIENTBASEDIR/ogclient.sqfs
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
ogClientSshkeys()
|
||||
{
|
||||
echo comprobamos clave rsa en el host REPO OG.
|
||||
if [ ! -f /root/.ssh/id_rsa.pub ]
|
||||
then
|
||||
echo "creando claves rsa"
|
||||
ssh-keygen -q -f /root/.ssh/id_dsa -t dsa -N "opengnsys"
|
||||
else
|
||||
echo "la claves ya estan creadas"
|
||||
fi
|
||||
echo "copiamos la clave publica a /tmp"
|
||||
cp /root/.ssh/id_dsa.pub /tmp
|
||||
|
||||
cat /tmp/id_dsa.pub
|
||||
|
||||
echo "schroot con instrucciones."
|
||||
schroot -c IMGogclient -- /root/importSshKeys.sh
|
||||
|
||||
echo "limpiando"
|
||||
rm /tmp/id_dsa.pub
|
||||
|
||||
## copiamos ssh rsa del host al guest como authorized-key2
|
||||
##rm ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
|
||||
##cat /root/.ssh/id_rsa.pub >> ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
|
||||
#cat ${OGCLIENTMOUNT}/root/.ssh/id_rsa.pub >> ${OGCLIENTMOUNT}/root/.ssh/authorized-key2
|
||||
##mount | grep $OGCLIENTMOUNT || umount $OGCLIENTMOUNT
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ogCrearISO {
|
||||
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
|
||||
#cd tmp/iso/
|
||||
cp -prv /usr/lib/syslinux/* /tmp/iso/isolinux/
|
||||
cp -prv /usr/share/gpxe/* /tmp/iso/isolinux/
|
||||
mkdir -p /tmp/iso/ogclient
|
||||
#el ogclienteToISO debe tener una copia del ogvmlinuz como linuxISO
|
||||
cp -prv /var/lib/tftpboot/ogclientToIso/* /tmp/iso/ogclient
|
||||
|
||||
|
||||
cat << FIN > /tmp/iso/isolinux/isolinux.cfg
|
||||
DEFAULT menu.c32
|
||||
PROMPT 0
|
||||
ALLOWOPTIONS 1
|
||||
|
||||
MENU TITLE OpenGnsys 1.0.1 v00
|
||||
|
||||
LABEL gpxe
|
||||
MENU LABEL gpxe
|
||||
KERNEL /clonezilla/live/vmlinuz1
|
||||
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
|
||||
MENU LABEL ogClient vga irqpool acpi ogdebug ip:none
|
||||
KERNEL /ogclient/linuxISO
|
||||
APPEND initrd=/ogclient/oginitrd.img ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
|
||||
|
||||
LABEL 1
|
||||
MENU LABEL ogClient irqpoll acpi ip:none
|
||||
KERNEL /ogclient/linuxISO
|
||||
APPEND initrd=/ogclient/oginitrd.img ro irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=false ip=none
|
||||
|
||||
LABEL 2
|
||||
MENU LABEL ogClient acpi debug ip=dhcp
|
||||
KERNEL /ogclient/linuxISO
|
||||
APPEND initrd=/ogclient/oginitrd.img ro acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=dhcp
|
||||
|
||||
LABEL 3
|
||||
MENU LABEL ogClient ip=dhcp
|
||||
KERNEL /ogclient/linuxISO
|
||||
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
|
||||
MENU LABEL local
|
||||
localboot 0x80
|
||||
append -
|
||||
|
||||
|
||||
label 5
|
||||
MENU LABEL Network boot via gPXE lkrn
|
||||
KERNEL gpxe.lkrn
|
||||
|
||||
label 5
|
||||
MENU LABEL Network boot via gPXE usb
|
||||
KERNEL gpxe.usb
|
||||
|
||||
label 5
|
||||
MENU LABEL Network boot via gPXE pxe
|
||||
KERNEL gpxe.pxe
|
||||
|
||||
label 5
|
||||
MENU LABEL Network boot via gPXE iso
|
||||
KERNEL gpxe.iso
|
||||
FIN
|
||||
#### /tmp/iso#
|
||||
mkisofs -V ogClient -o ogClient.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -J -no-emul-boot -boot-load-size 4 -boot-info-table tmp/iso
|
||||
|
||||
### vi /etc/grub.d/40_custom
|
||||
##
|
||||
#menuentry "og cache " {
|
||||
#set root=(hd0,4)
|
||||
#linux /ogvmlinuz ro vga=788 irqpoll acpi=on boot=oginit og2nd=sqfs ogprotocol=local ogactiveadmin=true ogdebug=true ip=none
|
||||
#initrd /oginitrd.img
|
||||
#}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function ogprobarISO {
|
||||
#/tmp/iso
|
||||
qemu -m 256 -boot d -cdrom ogClient.iso
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ogClientConfpxe()
|
||||
{
|
||||
################## DEJAMOS FICHERO DE EJEMPLOS PARA:
|
||||
#default
|
||||
cat << FIN >> /var/lib/tftpboot/pxelinux.cfg/defaultNEWClient
|
||||
LABEL pxe-${OGRELEASE}
|
||||
KERNEL ogclient/vmlinuz-$OGRELEASE
|
||||
APPEND initrd=ogclient/initrd.img-$OGRELEASE ip=dhcp ro boot=og vga=788 irqpoll acpi=on reposerver=
|
||||
LABEL pxe-2.6.32-21-generic-pae
|
||||
KERNEL ogclient/vmlinuz-2.6.32-21-generic-pae
|
||||
APPEND initrd=ogclient/initrd.img-2.6.32-21-generic-pae ip=dhcp ro boot=oginit vga=788 irqpoll acpi=on ogrepo=172.17.36.11 ogprotocol=nfs og2nd=sqfs
|
||||
LABEL cache
|
||||
KERNEL grub.exe
|
||||
APPEND --config-file="find --set-root /vmlinuz; kernel /vmlinuz ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd /initrd.img"
|
||||
LABEL net
|
||||
KERNEL grub.exe
|
||||
APPEND keeppxe --config-file="pxe detect; kernel (pd)/ogclient/vmlinuz-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd (pd)/ogclient/initrd.img-2.6.32-21-generic-pae"
|
||||
LABEL IfNOTcacheGOnet
|
||||
KERNEL grub.exe
|
||||
APPEND keeppxe --config-file="pxe detect; default 0; timeout 0; hiddenmenu; title cache; fallback 1; find --set-root /vmlinuz; kernel /vmlinuz ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd /initrd.img; boot; title net; kernel (pd)/ogclient/vmlinuz-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on engine=testing reposerver=172.17.32.242; initrd (pd)/ogclient/initrd.img-2.6.32-21-generic-pae; boot"
|
||||
#LABEL pxe-2.6.32-21-generic-pae
|
||||
#KERNEL ogclient/vmlinuz-2.6.32-21-generic-pae
|
||||
#APPEND initrd=ogclient/initrd.img-2.6.32-21-generic-pae ip=dhcp ro boot=og vga=788 irqpoll acpi=on reposerver=172.17.32.242
|
||||
#LABEL grub
|
||||
#KERNEL grub.exe
|
||||
#APPEND keeppxe
|
||||
FIN
|
||||
#/etc/hosts
|
||||
echo "/var/lib/tftpboot *(ro,no_subtree_check,no_root_squash,sync)" > /etc/exportsNEWClient
|
||||
/etc/init.d/nfs-kernel-server restart
|
||||
#####################################################################
|
||||
}
|
||||
|
||||
|
||||
|
||||
############### No usados en el instalador, solo en actualizaciones.
|
||||
#/**
|
||||
# ogClientMount [str_program]
|
||||
#@brief Acceso al 2nd FS del cliente desde el Servidor Opengnsys
|
||||
#@param 1 Opciona: scripts o programa a ejecutar para automatizaciones
|
||||
#@return Si no hay parametros: login de acceso.
|
||||
#@return con un parametro: La salida del programa ejecutado
|
||||
#@exception
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.9 - Primera versión para OpenGnSys
|
||||
#@author Antonio J. Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/02/15
|
||||
#*/ ##
|
||||
function ogClientMount ()
|
||||
{
|
||||
#TODO comprobar que OGFILE y OGFILEMOUNT existe.
|
||||
mount | grep $OGCLIENTFILE > /dev/null || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
mount | grep $OGCLIENTMOUNT/proc > /dev/null || mount --bind /proc $OGCLIENTMOUNT/proc
|
||||
mount | grep $OGCLIENTMOUNT/sys > /dev/null || mount --bind /sys $OGCLIENTMOUNT/sys
|
||||
mount | grep $OGCLIENTMOUNT/tmp > /dev/null || mount --bind /tmp $OGCLIENTMOUNT/tmp
|
||||
mount | grep $OGCLIENTMOUNT/dev > /dev/null || mount --bind /dev $OGCLIENTMOUNT/dev
|
||||
mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null || mount --bind /dev/pts $OGCLIENTMOUNT/dev/pts
|
||||
|
||||
|
||||
[ $# = 0 ] && $(chroot $OGCLIENTMOUNT /sbin/getty 38400 `tty`)
|
||||
[ $# = 1 ] && chroot $OGCLIENTMOUNT $1
|
||||
|
||||
}
|
||||
|
||||
#/**
|
||||
# ogClientUnmount
|
||||
#@brief Desmonta el 2nd FS del cliente desde el Servidor Opengnsys
|
||||
#@param
|
||||
#@return
|
||||
#@exception
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.9 - Primera versión para OpenGnSys
|
||||
#@author Antonio J. Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/02/15
|
||||
#*/ ##
|
||||
|
||||
function ogClientUnmount ()
|
||||
{
|
||||
cd /tmp
|
||||
echo "desmontando cliente espere"
|
||||
sleep 5
|
||||
mount | grep $OGCLIENTMOUNT/dev > /dev/null && umount $OGCLIENTMOUNT/dev || ogClientUnmount
|
||||
mount | grep $OGCLIENTMOUNT/dev/pts > /dev/null && umount $OGCLIENTMOUNT/dev/pts || ogClientUnmount
|
||||
mount | grep $OGCLIENTMOUNT/proc > /dev/null && umount $OGCLIENTMOUNT/proc || ogClientUnmount
|
||||
mount | grep $OGCLIENTMOUNT/sys > /dev/null && umount $OGCLIENTMOUNT/sys || ogClientUnmount
|
||||
mount | grep $OGCLIENTMOUNT/tmp > /dev/null && umount $OGCLIENTMOUNT/tmp || ogClientUnmount
|
||||
mount | grep $OGCLIENTMOUNT > /dev/null && umount $OGCLIENTMOUNT || ogClientUnmount
|
||||
#-d -f -l
|
||||
|
||||
}
|
||||
|
||||
|
||||
############################ hasta el final del archivo antiguos
|
||||
############################# ANTIGUOS
|
||||
function ogClientGetRelease ()
|
||||
{
|
||||
#1 OSCODENAME jaunty|karmic|lucid
|
||||
case $1 in
|
||||
jaunty|JAUNTY)
|
||||
OSCODENAME=jaunty
|
||||
OGRELEASE="2.6.28-11-generic"
|
||||
echo $OGRELEASE
|
||||
;;
|
||||
lenny|LENNY)
|
||||
OSCODENAME=lenny
|
||||
OGRELEASE="2.6.28-11-generic"
|
||||
echo $OGRELEASE
|
||||
;;
|
||||
squeeze|SQUEEZE)
|
||||
OSCODENAME=squeeze
|
||||
OGRELEASE="2.6.28-11-generic"
|
||||
echo $OGRELEASE
|
||||
;;
|
||||
karmic|KARMIC)
|
||||
OSCODENAME=karmic
|
||||
OGRELEASE="2.6.31-14-generic"
|
||||
echo $OGRELEASE
|
||||
;;
|
||||
lucid|LUCID)
|
||||
OSCODENAME=lucid
|
||||
OGRELEASE="2.6.32-21-generic-pae"
|
||||
echo $OGRELEASE
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
|
||||
#/**
|
||||
# ogClientGenerator str_versionUbuntu str_release
|
||||
#@brief Crea el 2nd FS del cliente desde el Servidor Opengnsys
|
||||
#@param 1 Versión de ubuntu a generar, jaunty karmic
|
||||
#@return
|
||||
#@exception
|
||||
#@note
|
||||
#@todo
|
||||
#@version 0.9 - Primera versión para OpenGnSys
|
||||
#@author Antonio J. Doblas Viso, Universidad de Málaga
|
||||
#@date 2010/02/15
|
||||
#*/ ##
|
||||
|
||||
function ogClientGeneratorDebootstrap ()
|
||||
{
|
||||
if [ $# != 2 ]
|
||||
then
|
||||
echo Debes introducir como argumento1: jaunty karmic lucid
|
||||
echo Debes introducir como argumento2: la release
|
||||
echo utiliza como entrada ogClientCheckVersion
|
||||
return
|
||||
fi
|
||||
OSCODENAME=$1
|
||||
OGRELEASE=$2
|
||||
|
||||
# instalamos el ultimo debotstrap para permitir instalar versiones superiores a nuestro sistema
|
||||
#apt-get install gdebi-core
|
||||
#wget $LASTDEBOOTSTRAP
|
||||
#gdebi -n debootstrap_1.0.20_all.deb
|
||||
|
||||
#Desmontamos por si acaso el dispositivo virtual
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTMOUNT
|
||||
|
||||
#Creamos el directorio donde montaremos el disco virtual
|
||||
mkdir -p $OGCLIENTMOUNT
|
||||
|
||||
#Creamos el disco virtual con el filesystem del cliente.
|
||||
dd if=/dev/zero of=$OGCLIENTFILE bs=1048576 count=$OGCLIENTSIZEMB
|
||||
#qemu-img create $OGCLIENTFILE 3G
|
||||
#dd if=/dev/zero of=$OGCLIENTFILE bs=1k count=$OGCLIENTSIZEKB # necesita 500MB
|
||||
|
||||
|
||||
#particionamos el disco virtual
|
||||
losetup /dev/loop0 $OGCLIENTFILE
|
||||
echo -e "n\np\n1\n\n\nt\n83\nw" | fdisk /dev/loop0
|
||||
losetup -d /dev/loop0
|
||||
|
||||
|
||||
#formateamos la particion principal.
|
||||
losetup -o 32256 /dev/loop1 $OGCLIENTFILE
|
||||
mkfs.ext3 -b 4096 -L $OGCLIENTLABEL /dev/loop1
|
||||
#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
|
||||
#mkfs.ext3 -L $OGCLIENTLABEL /dev/loop1
|
||||
losetup -d /dev/loop1
|
||||
|
||||
#Montamos el dispositivo virtual en su punto de montaje.
|
||||
mount | grep $OGCLIENTMOUNT || mount $OGCLIENTFILE $OGCLIENTMOUNT -o loop,offset=32256
|
||||
|
||||
#TODO Comprobar arquitectura
|
||||
#Iniciamos la creación del sistema en el directorio de clientes.
|
||||
#echo debootstrap --include=linux-image-${OGRELEASE},dbus --arch=i386 --components=main,universe $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
debootstrap --include=linux-image-${OGRELEASE},linux-headers-${OGRELEASE} --arch=i386 --components=main,universe $OSCODENAME $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
##preubas
|
||||
#debootstrap --include=linux-image-${OGRELEASE} --arch=i386 --variant=minbase $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
#debootstrap --variant=minbase --include=linux-image-${OGRELEASE} --arch=i386 $OGVERSION $OGCLIENTMOUNT http://es.archive.ubuntu.com/ubuntu/
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "ogClientGeneratorDebootstrap(): ha fallado!"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "ogClientGeneratorDebootstrap(): ok"
|
||||
return 0
|
||||
fi
|
||||
sleep 5
|
||||
|
||||
mount | grep $OGCLIENTMOUNT && umount $OGCLIENTFILE
|
||||
|
||||
cat << EOF > /etc/schroot/schroot.conf
|
||||
[DIRogclient]
|
||||
type=directory
|
||||
directory=/var/lib/tftpboot/ogclient/ogclientmount
|
||||
description=ogclient ubuntu lucid DIR
|
||||
priority=2
|
||||
users=root
|
||||
groups=root
|
||||
root-groups=root
|
||||
root-users=root
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,958 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
#####################################################################
|
||||
####### Algunas funciones útiles de propósito general:
|
||||
#####################################################################
|
||||
function getDateTime()
|
||||
{
|
||||
echo `date +%Y%m%d-%H%M%S`
|
||||
}
|
||||
|
||||
# Escribe a fichero y muestra por pantalla
|
||||
function echoAndLog()
|
||||
{
|
||||
echo $1
|
||||
FECHAHORA=`getDateTime`
|
||||
echo "$FECHAHORA;$SSH_CLIENT;$1" >> $LOG_FILE
|
||||
}
|
||||
|
||||
function errorAndLog()
|
||||
{
|
||||
echo "ERROR: $1"
|
||||
FECHAHORA=`getDateTime`
|
||||
echo "$FECHAHORA;$SSH_CLIENT;ERROR: $1" >> $LOG_FILE
|
||||
}
|
||||
|
||||
# comprueba si el elemento pasado en $2 esta en el array $1
|
||||
function isInArray()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): checking if $2 is in $1"
|
||||
local deps
|
||||
eval "deps=( \"\${$1[@]}\" )"
|
||||
elemento=$2
|
||||
|
||||
local is_in_array=1
|
||||
# copia local del array del parametro 1
|
||||
for (( i = 0 ; i < ${#deps[@]} ; i++ ))
|
||||
do
|
||||
if [ "${deps[$i]}" = "${elemento}" ]; then
|
||||
echoAndLog "isInArray(): $elemento found in array"
|
||||
is_in_array=0
|
||||
fi
|
||||
done
|
||||
|
||||
if [ $is_in_array -ne 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): $elemento NOT found in array"
|
||||
fi
|
||||
|
||||
return $is_in_array
|
||||
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
####### Funciones de manejo de paquetes Debian
|
||||
#####################################################################
|
||||
|
||||
function checkPackage()
|
||||
{
|
||||
package=$1
|
||||
if [ -z $package ]; then
|
||||
errorAndLog "checkPackage(): parameter required"
|
||||
exit 1
|
||||
fi
|
||||
echoAndLog "checkPackage(): checking if package $package exists"
|
||||
dpkg -s $package | grep Status | grep -qw install &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echoAndLog "checkPackage(): package $package exists"
|
||||
return 0
|
||||
else
|
||||
echoAndLog "checkPackage(): package $package doesn't exists"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# recibe array con dependencias
|
||||
# por referencia deja un array con las dependencias no resueltas
|
||||
# devuelve 1 si hay alguna dependencia no resuelta
|
||||
function checkDependencies()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "checkDependencies(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echoAndLog "checkDependencies(): checking dependences"
|
||||
uncompletedeps=0
|
||||
|
||||
# copia local del array del parametro 1
|
||||
local deps
|
||||
eval "deps=( \"\${$1[@]}\" )"
|
||||
|
||||
declare -a local_notinstalled
|
||||
|
||||
for (( i = 0 ; i < ${#deps[@]} ; i++ ))
|
||||
do
|
||||
checkPackage ${deps[$i]}
|
||||
if [ $? -ne 0 ]; then
|
||||
local_notinstalled[$uncompletedeps]=$package
|
||||
let uncompletedeps=uncompletedeps+1
|
||||
fi
|
||||
done
|
||||
|
||||
# relleno el array especificado en $2 por referencia
|
||||
for (( i = 0 ; i < ${#local_notinstalled[@]} ; i++ ))
|
||||
do
|
||||
eval "${2}[$i]=${local_notinstalled[$i]}"
|
||||
done
|
||||
|
||||
# retorna el numero de paquetes no resueltos
|
||||
echoAndLog "checkDependencies(): dependencies uncompleted: $uncompletedeps"
|
||||
return $uncompletedeps
|
||||
}
|
||||
|
||||
# Recibe un array con las dependencias y lo instala
|
||||
function installDependencies()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "installDependencies(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
echoAndLog "installDependencies(): installing uncompleted dependencies"
|
||||
|
||||
# copia local del array del parametro 1
|
||||
local deps
|
||||
eval "deps=( \"\${$1[@]}\" )"
|
||||
|
||||
local string_deps=""
|
||||
for (( i = 0 ; i < ${#deps[@]} ; i++ ))
|
||||
do
|
||||
string_deps="$string_deps ${deps[$i]}"
|
||||
done
|
||||
|
||||
if [ -z "${string_deps}" ]; then
|
||||
errorAndLog "installDependencies(): array of dependeces is empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
OLD_DEBIAN_FRONTEND=$DEBIAN_FRONTEND
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
echoAndLog "installDependencies(): now ${string_deps} will be installed"
|
||||
apt-get -y install --force-yes ${string_deps}
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "installDependencies(): error installing dependencies"
|
||||
return 1
|
||||
fi
|
||||
|
||||
DEBIAN_FRONTEND=$OLD_DEBIAN_FRONTEND
|
||||
echoAndLog "installDependencies(): dependencies installed"
|
||||
}
|
||||
|
||||
# Hace un backup del fichero pasado por parámetro
|
||||
# deja un -last y uno para el dÃa
|
||||
function backupFile()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local fichero=$1
|
||||
local fecha=`date +%Y%m%d`
|
||||
|
||||
if [ ! -f $fichero ]; then
|
||||
errorAndLog "${FUNCNAME}(): file $fichero doesn't exists"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): realizando backup de $fichero"
|
||||
|
||||
# realiza una copia de la última configuración como last
|
||||
cp -p $fichero "${fichero}-LAST"
|
||||
|
||||
# si para el dÃa no hay backup lo hace, sino no
|
||||
if [ ! -f "${fichero}-${fecha}" ]; then
|
||||
cp -p $fichero "${fichero}-${fecha}"
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): backup realizado"
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
####### Funciones para el manejo de bases de datos
|
||||
#####################################################################
|
||||
|
||||
# This function set password to root
|
||||
function mysqlSetRootPassword()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "mysqlSetRootPassword(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_mysql=$1
|
||||
echoAndLog "mysqlSetRootPassword(): setting root password in MySQL server"
|
||||
/usr/bin/mysqladmin -u root password ${root_mysql}
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "mysqlSetRootPassword(): error while setting root password in MySQL server"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "mysqlSetRootPassword(): root password saved!"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Si el servicio mysql esta ya instalado cambia la variable de la clave del root por la ya existente
|
||||
function mysqlGetRootPassword(){
|
||||
local pass_mysql
|
||||
local pass_mysql2
|
||||
# Comprobar si MySQL está instalado con la clave de root por defecto.
|
||||
if mysql -u root -p"$MYSQL_ROOT_PASSWORD" <<<"quit" 2>/dev/null; then
|
||||
echoAndLog "${FUNCNAME}(): Using default mysql root password."
|
||||
else
|
||||
stty -echo
|
||||
echo "Existe un servicio mysql ya instalado"
|
||||
read -p "Insertar clave de root de Mysql: " pass_mysql
|
||||
echo ""
|
||||
read -p "Confirmar clave:" pass_mysql2
|
||||
echo ""
|
||||
stty echo
|
||||
if [ "$pass_mysql" == "$pass_mysql2" ] ;then
|
||||
MYSQL_ROOT_PASSWORD=$pass_mysql
|
||||
echo "La clave es: ${MYSQL_ROOT_PASSWORD}"
|
||||
return 0
|
||||
else
|
||||
echo "Las claves no coinciden no se configura la clave del servidor de base de datos."
|
||||
echo "las operaciones con la base de datos daran error"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# comprueba si puede conectar con mysql con el usuario root
|
||||
function mysqlTestConnection()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "mysqlTestConnection(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
echoAndLog "mysqlTestConnection(): checking connection to mysql..."
|
||||
echo "" | mysql -uroot -p"${root_password}"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "mysqlTestConnection(): connection to mysql failed, check root password and if daemon is running!"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "mysqlTestConnection(): connection success"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# comprueba si la base de datos existe
|
||||
function mysqlDbExists()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "mysqlDbExists(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
local database=$2
|
||||
echoAndLog "mysqlDbExists(): checking if $database exists..."
|
||||
echo "show databases" | mysql -uroot -p"${root_password}" | grep "^${database}$"
|
||||
if [ $? -ne 0 ]; then
|
||||
echoAndLog "mysqlDbExists():database $database doesn't exists"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "mysqlDbExists():database $database exists"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
function mysqlCheckDbIsEmpty()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "mysqlCheckDbIsEmpty(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
local database=$2
|
||||
echoAndLog "mysqlCheckDbIsEmpty(): checking if $database is empty..."
|
||||
num_tablas=`echo "show tables" | mysql -uroot -p"${root_password}" "${database}" | wc -l`
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "mysqlCheckDbIsEmpty(): error executing query, check database and root password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $num_tablas -eq 0 ]; then
|
||||
echoAndLog "mysqlCheckDbIsEmpty():database $database is empty"
|
||||
return 0
|
||||
else
|
||||
echoAndLog "mysqlCheckDbIsEmpty():database $database has tables"
|
||||
return 1
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
function mysqlImportSqlFileToDb()
|
||||
{
|
||||
if [ $# -ne 3 ]; then
|
||||
errorAndLog "${FNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
local database=$2
|
||||
local sqlfile=$3
|
||||
|
||||
if [ ! -f $sqlfile ]; then
|
||||
errorAndLog "${FUNCNAME}(): Unable to locate $sqlfile!!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): importing sql file to ${database}..."
|
||||
perl -pi -e "s/SERVERIP/$SERVERIP/g; s/DEFAULTUSER/$OPENGNSYS_DB_DEFAULTUSER/g; s/DEFAULTPASSWD/$OPENGNSYS_DB_DEFAULTPASSWD/g" $sqlfile
|
||||
mysql -uroot -p"${root_password}" --default-character-set=utf8 "${database}" < $sqlfile
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while importing $sqlfile in database $database"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "${FUNCNAME}(): file imported to database $database"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Crea la base de datos
|
||||
function mysqlCreateDb()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
local database=$2
|
||||
|
||||
echoAndLog "${FUNCNAME}(): creating database..."
|
||||
mysqladmin -u root --password="${root_password}" create $database
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while creating database $database"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "${FUNCNAME}(): database $database created"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
function mysqlCheckUserExists()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "mysqlCheckUserExists(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password="${1}"
|
||||
local userdb=$2
|
||||
|
||||
echoAndLog "mysqlCheckUserExists(): checking if $userdb exists..."
|
||||
echo "select user from user where user='${userdb}'\\G" |mysql -uroot -p"${root_password}" mysql | grep user
|
||||
if [ $? -ne 0 ]; then
|
||||
echoAndLog "mysqlCheckUserExists(): user doesn't exists"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "mysqlCheckUserExists(): user already exists"
|
||||
return 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Crea un usuario administrativo para la base de datos
|
||||
function mysqlCreateAdminUserToDb()
|
||||
{
|
||||
if [ $# -ne 4 ]; then
|
||||
errorAndLog "mysqlCreateAdminUserToDb(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local root_password=$1
|
||||
local database=$2
|
||||
local userdb=$3
|
||||
local passdb=$4
|
||||
|
||||
echoAndLog "mysqlCreateAdminUserToDb(): creating admin user ${userdb} to database ${database}"
|
||||
|
||||
cat > $WORKDIR/create_${database}.sql <<EOF
|
||||
GRANT USAGE ON *.* TO '${userdb}'@'localhost' IDENTIFIED BY '${passdb}' ;
|
||||
GRANT ALL PRIVILEGES ON ${database}.* TO '${userdb}'@'localhost' WITH GRANT OPTION ;
|
||||
FLUSH PRIVILEGES ;
|
||||
EOF
|
||||
mysql -u root --password=${root_password} < $WORKDIR/create_${database}.sql
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "mysqlCreateAdminUserToDb(): error while creating user in mysql"
|
||||
rm -f $WORKDIR/create_${database}.sql
|
||||
return 1
|
||||
else
|
||||
echoAndLog "mysqlCreateAdminUserToDb(): user created ok"
|
||||
rm -f $WORKDIR/create_${database}.sql
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
####### Funciones para el manejo de Subversion
|
||||
#####################################################################
|
||||
|
||||
function svnExportCode()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local url=$1
|
||||
|
||||
echoAndLog "${FUNCNAME}(): downloading subversion code..."
|
||||
|
||||
svn export "${url}" opengnsys
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error getting code from ${url}, verify your user and password"
|
||||
return 1
|
||||
fi
|
||||
echoAndLog "${FUNCNAME}(): subversion code downloaded"
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
### Detectar red
|
||||
############################################################
|
||||
|
||||
function getNetworkSettings()
|
||||
{
|
||||
# Variables globales definidas:
|
||||
# - SERVERIP: IP local del servidor.
|
||||
# - NETIP: IP de la red.
|
||||
# - NETMASK: máscara de red.
|
||||
# - NETBROAD: IP de difusión de la red.
|
||||
# - ROUTERIP: IP del router.
|
||||
# - DNSIP: IP del servidor DNS.
|
||||
|
||||
local MAINDEV
|
||||
|
||||
echoAndLog "${FUNCNAME}(): Detecting default network parameters."
|
||||
MAINDEV=$(ip -o link show up | awk '!/loopback/ {d=d$2} END {sub(/:.*/,"",d); print d}')
|
||||
if [ -z "$MAINDEV" ]; then
|
||||
errorAndLog "${FUNCNAME}(): Network device not detected."
|
||||
exit 1
|
||||
fi
|
||||
SERVERIP=$(ip -o addr show dev $MAINDEV | awk '$3~/inet$/ {sub (/\/.*/, ""); print ($4)}')
|
||||
NETMASK=$(LANG=C ifconfig $MAINDEV | awk '/Mask/ {sub(/.*:/,"",$4); print $4}')
|
||||
NETBROAD=$(ip -o addr show dev $MAINDEV | awk '$3~/inet$/ {print ($6)}')
|
||||
NETIP=$(netstat -nr | grep $MAINDEV | awk '$1!~/0\.0\.0\.0/ {if (n=="") n=$1} END {print n}')
|
||||
ROUTERIP=$(netstat -nr | awk '$1~/0\.0\.0\.0/ {print $2}')
|
||||
DNSIP=$(awk '/nameserver/ {print $2}' /etc/resolv.conf | head -n1)
|
||||
if [ -z "$NETIP" -o -z "$NETMASK" ]; then
|
||||
errorAndLog "${FUNCNAME}(): Network not detected."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Variables de ejecución de Apache
|
||||
# - APACHE_RUN_USER
|
||||
# - APACHE_RUN_GROUP
|
||||
if [ -f /etc/apache2/envvars ]; then
|
||||
source /etc/apache2/envvars
|
||||
fi
|
||||
APACHE_RUN_USER=${APACHE_RUN_USER:-"www-data"}
|
||||
APACHE_RUN_GROUP=${APACHE_RUN_GROUP:-"www-data"}
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
### Esqueleto para el Servicio pxe y contenedor tftpboot ###
|
||||
############################################################
|
||||
|
||||
function tftpConfigure() {
|
||||
echo "Configurando el servicio tftp"
|
||||
basetftp=/var/lib/tftpboot
|
||||
|
||||
# reiniciamos demonio internet ????? porque ????
|
||||
/etc/init.d/openbsd-inetd start
|
||||
|
||||
# preparacion contenedor tftpboot
|
||||
cp -pr /usr/lib/syslinux/ ${basetftp}/syslinux
|
||||
cp /usr/lib/syslinux/pxelinux.0 ${basetftp}
|
||||
# prepamos el directorio de la configuracion de pxe
|
||||
mkdir -p ${basetftp}/pxelinux.cfg
|
||||
cat > ${basetftp}/pxelinux.cfg/default <<EOF
|
||||
DEFAULT pxe
|
||||
|
||||
LABEL pxe
|
||||
KERNEL linux
|
||||
APPEND initrd=initrd.gz ip=dhcp ro vga=788 irqpoll acpi=on
|
||||
EOF
|
||||
# comprobamos el servicio tftp
|
||||
sleep 1
|
||||
testPxe
|
||||
## damos perfimos de lectura a usuario web.
|
||||
chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP ${basetftp}
|
||||
}
|
||||
|
||||
function testPxe () {
|
||||
cd /tmp
|
||||
echo "comprobando servicio pxe ..... Espere"
|
||||
tftp -v localhost -c get pxelinux.0 /tmp/pxelinux.0 && echo "servidor tftp OK" || echo "servidor tftp KO"
|
||||
cd /
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Configuracion servicio NFS
|
||||
########################################################################
|
||||
|
||||
# ADVERTENCIA: usa variables globales NETIP y NETMASK!
|
||||
function nfsConfigure()
|
||||
{
|
||||
echoAndLog "${FUNCNAME}(): Config nfs server."
|
||||
|
||||
backupFile /etc/exports
|
||||
|
||||
nfsAddExport /opt/opengnsys/client ${NETIP}/${NETMASK}:ro,no_subtree_check,no_root_squash,sync
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while adding nfs client config"
|
||||
return 1
|
||||
fi
|
||||
|
||||
nfsAddExport /opt/opengnsys/images ${NETIP}/${NETMASK}:rw,no_subtree_check,no_root_squash,sync,crossmnt
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while adding nfs images config"
|
||||
return 1
|
||||
fi
|
||||
|
||||
nfsAddExport /opt/opengnsys/log/clients ${NETIP}/${NETMASK}:rw,no_subtree_check,no_root_squash,sync
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while adding logging client config"
|
||||
return 1
|
||||
fi
|
||||
|
||||
/etc/init.d/nfs-kernel-server restart
|
||||
|
||||
exportfs -va
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while configure exports"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): Added NFS configuration to file \"/etc/exports\"."
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
# ejemplos:
|
||||
#nfsAddExport /opt/opengnsys 192.168.0.0/255.255.255.0:ro,no_subtree_check,no_root_squash,sync
|
||||
#nfsAddExport /opt/opengnsys 192.168.0.0/255.255.255.0
|
||||
#nfsAddExport /opt/opengnsys 80.20.2.1:ro 192.123.32.2:rw
|
||||
function nfsAddExport()
|
||||
{
|
||||
if [ $# -lt 2 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/exports ]; then
|
||||
errorAndLog "${FUNCNAME}(): /etc/exports don't exists"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local export="${1}"
|
||||
local contador=0
|
||||
local cadenaexport
|
||||
|
||||
grep "^${export}" /etc/exports > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): $export exists in /etc/exports, omiting"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cadenaexport="${export}"
|
||||
for parametro in $*
|
||||
do
|
||||
if [ $contador -gt 0 ]
|
||||
then
|
||||
host=`echo $parametro | awk -F: '{print $1}'`
|
||||
options=`echo $parametro | awk -F: '{print $2}'`
|
||||
if [ "${host}" == "" ]; then
|
||||
errorAndLog "${FUNCNAME}(): host can't be empty"
|
||||
return 1
|
||||
fi
|
||||
cadenaexport="${cadenaexport}\t${host}"
|
||||
|
||||
if [ "${options}" != "" ]; then
|
||||
cadenaexport="${cadenaexport}(${options})"
|
||||
fi
|
||||
fi
|
||||
let contador=contador+1
|
||||
done
|
||||
|
||||
echo -en "$cadenaexport\n" >> /etc/exports
|
||||
|
||||
echoAndLog "${FUNCNAME}(): add $export to /etc/exports"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
########################################################################
|
||||
## Configuracion servicio DHCP
|
||||
########################################################################
|
||||
|
||||
function dhcpConfigure()
|
||||
{
|
||||
echoAndLog "${FUNCNAME}(): Sample DHCP Configuration."
|
||||
|
||||
backupFile /etc/dhcp3/dhcpd.conf
|
||||
|
||||
sed -e "s/SERVERIP/$SERVERIP/g" \
|
||||
-e "s/NETIP/$NETIP/g" \
|
||||
-e "s/NETMASK/$NETMASK/g" \
|
||||
-e "s/NETBROAD/$NETBROAD/g" \
|
||||
-e "s/ROUTERIP/$ROUTERIP/g" \
|
||||
-e "s/DNSIP/$DNSIP/g" \
|
||||
$WORKDIR/opengnsys/server/DHCP/dhcpd.conf > /etc/dhcp3/dhcpd.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while configuring dhcp server"
|
||||
return 1
|
||||
fi
|
||||
|
||||
/etc/init.d/dhcp3-server restart
|
||||
echoAndLog "${FUNCNAME}(): Sample DHCP Configured in file \"/etc/dhcp3/dhcpd.conf\"."
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
####### Funciones especÃficas de la instalación de Opengnsys
|
||||
#####################################################################
|
||||
|
||||
# Copiar ficheros del OpenGnSys Web Console.
|
||||
function installWebFiles()
|
||||
{
|
||||
echoAndLog "${FUNCNAME}(): Installing web files..."
|
||||
cp -ar $WORKDIR/opengnsys/admin/WebConsole/* $INSTALL_TARGET/www #*/ comentario para doxigen
|
||||
if [ $? != 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): Error copying web files."
|
||||
exit 1
|
||||
fi
|
||||
find $INSTALL_TARGET/www -name .svn -type d -exec rm -fr {} \; 2>/dev/null
|
||||
# Cambiar permisos para ficheros especiales.
|
||||
chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP \
|
||||
$INSTALL_TARGET/www/includes \
|
||||
$INSTALL_TARGET/www/comandos/gestores/filescripts \
|
||||
$INSTALL_TARGET/www/images/iconos
|
||||
echoAndLog "${FUNCNAME}(): Web files installed successfully."
|
||||
}
|
||||
|
||||
# Configuración especÃfica de Apache.
|
||||
function openGnsysInstallWebConsoleApacheConf()
|
||||
{
|
||||
if [ $# -ne 2 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local path_opengnsys_base=$1
|
||||
local path_apache2_confd=$2
|
||||
local path_web_console=${path_opengnsys_base}/www
|
||||
|
||||
if [ ! -d $path_apache2_confd ]; then
|
||||
errorAndLog "${FUNCNAME}(): path to apache2 conf.d can not found, verify your server installation"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mkdir -p $path_apache2_confd/{sites-available,sites-enabled}
|
||||
|
||||
echoAndLog "${FUNCNAME}(): creating apache2 config file.."
|
||||
|
||||
|
||||
# genera configuración
|
||||
cat > $path_opengnsys_base/etc/apache.conf <<EOF
|
||||
# OpenGnSys Web Console configuration for Apache
|
||||
|
||||
Alias /opengnsys ${path_web_console}
|
||||
|
||||
<Directory ${path_web_console}>
|
||||
Options -Indexes FollowSymLinks
|
||||
DirectoryIndex acceso.php
|
||||
</Directory>
|
||||
EOF
|
||||
|
||||
ln -fs $path_opengnsys_base/etc/apache.conf $path_apache2_confd/sites-available/opengnsys.conf
|
||||
ln -fs $path_apache2_confd/sites-available/opengnsys.conf $path_apache2_confd/sites-enabled/opengnsys.conf
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): config file can't be linked to apache conf, verify your server installation"
|
||||
return 1
|
||||
else
|
||||
echoAndLog "${FUNCNAME}(): config file created and linked, restarting apache daemon"
|
||||
/etc/init.d/apache2 restart
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
# Crear documentación Doxygen para la consola web.
|
||||
function makeDoxygenFiles()
|
||||
{
|
||||
echoAndLog "${FUNCNAME}(): Making Doxygen web files..."
|
||||
$WORKDIR/opengnsys/installer/ogGenerateDoc.sh \
|
||||
$WORKDIR/opengnsys/client/engine $INSTALL_TARGET/www
|
||||
if [ ! -d "$INSTALL_TARGET/www/html" ]; then
|
||||
errorAndLog "${FUNCNAME}(): unable to create Doxygen web files."
|
||||
return 1
|
||||
fi
|
||||
mv "$INSTALL_TARGET/www/html" "$INSTALL_TARGET/www/api"
|
||||
chown -R $APACHE_RUN_USER:$APACHE_RUN_GROUP $INSTALL_TARGET/www/api
|
||||
echoAndLog "${FUNCNAME}(): Doxygen web files created successfully."
|
||||
}
|
||||
|
||||
|
||||
# Crea la estructura base de la instalación de opengnsys
|
||||
function openGnsysInstallCreateDirs()
|
||||
{
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local path_opengnsys_base=$1
|
||||
|
||||
echoAndLog "${FUNCNAME}(): creating directory paths in $path_opengnsys_base"
|
||||
|
||||
mkdir -p $path_opengnsys_base
|
||||
mkdir -p $path_opengnsys_base/admin/{autoexec,comandos,menus,usuarios}
|
||||
mkdir -p $path_opengnsys_base/bin
|
||||
mkdir -p $path_opengnsys_base/client
|
||||
mkdir -p $path_opengnsys_base/doc
|
||||
mkdir -p $path_opengnsys_base/etc
|
||||
mkdir -p $path_opengnsys_base/lib
|
||||
mkdir -p $path_opengnsys_base/log/clients
|
||||
mkdir -p $path_opengnsys_base/sbin
|
||||
mkdir -p $path_opengnsys_base/www
|
||||
mkdir -p $path_opengnsys_base/images
|
||||
ln -fs /var/lib/tftpboot $path_opengnsys_base
|
||||
ln -fs $path_opengnsys_base/log /var/log/opengnsys
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while creating dirs. Do you have write permissions?"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): directory paths created"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Copia ficheros de configuración y ejecutables genéricos del servidor.
|
||||
function openGnsysCopyServerFiles () {
|
||||
if [ $# -ne 1 ]; then
|
||||
errorAndLog "${FUNCNAME}(): invalid number of parameters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local path_opengnsys_base=$1
|
||||
|
||||
local SOURCES=( client/boot/initrd-generator \
|
||||
client/boot/upgrade-clients-udeb.sh \
|
||||
client/boot/udeblist.conf \
|
||||
client/boot/udeblist-jaunty.conf \
|
||||
client/boot/udeblist-karmic.conf \
|
||||
client/boot/udeblist-lucid.conf \
|
||||
server/PXE/pxelinux.cfg/default \
|
||||
doc )
|
||||
local TARGETS=( bin/initrd-generator \
|
||||
bin/upgrade-clients-udeb.sh \
|
||||
etc/udeblist.conf \
|
||||
etc/udeblist-jaunty.conf \
|
||||
etc/udeblist-karmic.conf \
|
||||
etc/udeblist-lucid.conf \
|
||||
tftpboot/pxelinux.cfg/default \
|
||||
doc )
|
||||
|
||||
if [ ${#SOURCES[@]} != ${#TARGETS[@]} ]; then
|
||||
errorAndLog "${FUNCNAME}(): inconsistent number of array items"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echoAndLog "${FUNCNAME}(): copying files to server directories"
|
||||
|
||||
pushd $WORKDIR/opengnsys
|
||||
local i
|
||||
for (( i = 0; i < ${#SOURCES[@]}; i++ )); do
|
||||
if [ -f "${SOURCES[$i]}" ]; then
|
||||
echoAndLog "Copying ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
cp -p "${SOURCES[$i]}" "${path_opengnsys_base}/${TARGETS[$i]}"
|
||||
elif [ -d "${SOURCES[$i]}" ]; then
|
||||
echoAndLog "Copying content of ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
cp -a "${SOURCES[$i]}"/* "${path_opengnsys_base}/${TARGETS[$i]}"
|
||||
else
|
||||
echoAndLog "Warning: Unable to copy ${SOURCES[$i]} to $path_opengnsys_base/${TARGETS[$i]}"
|
||||
fi
|
||||
done
|
||||
popd
|
||||
}
|
||||
|
||||
####################################################################
|
||||
### Funciones de compilación de códifo fuente de servicios
|
||||
####################################################################
|
||||
|
||||
# Compilar los servicios de OpenGNsys
|
||||
function servicesCompilation ()
|
||||
{
|
||||
local hayErrores=0
|
||||
|
||||
# Compilar OpenGnSys Server
|
||||
echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Admin Server"
|
||||
pushd $WORKDIR/opengnsys/admin/Services/ogAdmServer
|
||||
make && make install
|
||||
if [ $? -ne 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Admin Server"
|
||||
hayErrores=1
|
||||
fi
|
||||
popd
|
||||
# Compilar OpenGnSys Repository Manager
|
||||
echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Repository Manager"
|
||||
pushd $WORKDIR/opengnsys/admin/Services/ogAdmRepo
|
||||
make && make install
|
||||
if [ $? -ne 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Repository Manager"
|
||||
hayErrores=1
|
||||
fi
|
||||
popd
|
||||
# Compilar OpenGnSys Client
|
||||
echoAndLog "${FUNCNAME}(): Compiling OpenGnSys Admin Client"
|
||||
pushd $WORKDIR/opengnsys/admin/Services/ogAdmClient
|
||||
make && mv ogAdmClient ../../../client/nfsexport/bin
|
||||
if [ $? -ne 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): error while compiling OpenGnSys Admin Client"
|
||||
hayErrores=1
|
||||
fi
|
||||
popd
|
||||
|
||||
return $hayErrores
|
||||
}
|
||||
|
||||
|
||||
####################################################################
|
||||
### Funciones instalacion cliente opengnsys
|
||||
####################################################################
|
||||
|
||||
function openGnsysClientCreate()
|
||||
{
|
||||
local OSDISTRIB OSCODENAME
|
||||
|
||||
local hayErrores=0
|
||||
|
||||
echoAndLog "${FUNCNAME}(): Copying OpenGnSys Client files."
|
||||
cp -ar $WORKDIR/opengnsys/client/nfsexport/* $INSTALL_TARGET/client
|
||||
find $INSTALL_TARGET/client -name .svn -type d -exec rm -fr {} \; 2>/dev/null
|
||||
echoAndLog "${FUNCNAME}(): Copying OpenGnSys Cloning Engine files."
|
||||
mkdir -p $INSTALL_TARGET/client/lib/engine/bin
|
||||
cp -ar $WORKDIR/opengnsys/client/engine/*.lib $INSTALL_TARGET/client/lib/engine/bin
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while copying engine files"
|
||||
hayErrores=1
|
||||
fi
|
||||
|
||||
# Cargar Kernel, Initrd y paquetes udeb para la distribución del servidor (o por defecto).
|
||||
OSDISTRIB=$(lsb_release -i | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
OSCODENAME=$(lsb_release -c | awk -F: '{sub(/\t/,""); print $2}') 2>/dev/null
|
||||
if [ "$OSDISTRIB" = "Ubuntu" -a -n "$OSCODENAME" ]; then
|
||||
echoAndLog "${FUNCNAME}(): Loading Kernel and Initrd files for $OSDISTRIB $OSCODENAME."
|
||||
$INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot -v "$OSCODENAME"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while generating initrd OpenGnSys Admin Client"
|
||||
hayErrores=1
|
||||
fi
|
||||
echoAndLog "${FUNCNAME}(): Loading udeb files for $OSDISTRIB $OSCODENAME."
|
||||
$INSTALL_TARGET/bin/upgrade-clients-udeb.sh "$OSCODENAME"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGnSys Admin Client"
|
||||
hayErrores=1
|
||||
fi
|
||||
else
|
||||
echoAndLog "${FUNCNAME}(): Loading default Kernel and Initrd files."
|
||||
$INSTALL_TARGET/bin/initrd-generator -t $INSTALL_TARGET/tftpboot/
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while generating initrd OpenGnSys Admin Client"
|
||||
hayErrores=1
|
||||
fi
|
||||
echoAndLog "${FUNCNAME}(): Loading default udeb files."
|
||||
$INSTALL_TARGET/bin/upgrade-clients-udeb.sh
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error while upgrading udeb files OpenGnSys Admin Client"
|
||||
hayErrores=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $hayErrores -eq 0 ]; then
|
||||
echoAndLog "${FUNCNAME}(): Client generation success."
|
||||
else
|
||||
errorAndLog "${FUNCNAME}(): Client generation with errors"
|
||||
fi
|
||||
|
||||
return $hayErrores
|
||||
}
|
||||
|
||||
|
||||
# Configuración básica de servicios de OpenGnSys
|
||||
function openGnsysConfigure()
|
||||
{
|
||||
echoAndLog "openGnsysConfigure(): Copying init files."
|
||||
cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.init /etc/init.d/opengnsys
|
||||
cp -p $WORKDIR/opengnsys/admin/Services/opengnsys.default /etc/default/opengnsys
|
||||
update-rc.d opengnsys defaults
|
||||
echoAndLog "openGnsysConfigure(): Creating OpenGnSys config file in \"$INSTALL_TARGET/etc\"."
|
||||
perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmServer.cfg
|
||||
perl -pi -e "s/SERVERIP/$SERVERIP/g" $INSTALL_TARGET/etc/ogAdmRepo.cfg
|
||||
echoAndLog "${FUNCNAME}(): Creating Web Console config file"
|
||||
OPENGNSYS_CONSOLEURL="http://$SERVERIP/opengnsys"
|
||||
perl -pi -e "s/SERVERIP/$SERVERIP/g; s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $INSTALL_TARGET/www/controlacceso.php
|
||||
sed -e "s/SERVERIP/$SERVERIP/g" -e "s/OPENGNSYSURL/${OPENGNSYS_CONSOLEURL//\//\\/}/g" $WORKDIR/opengnsys/admin/Services/ogAdmClient/ogAdmClient.cfg > $INSTALL_TARGET/client/etc/ogAdmClient.cfg
|
||||
echoAndLog "openGnsysConfiguration(): Starting OpenGnSys services."
|
||||
/etc/init.d/opengnsys start
|
||||
}
|
||||
|
||||
|
||||
#####################################################################
|
||||
####### Función de resumen informativo de la instalación
|
||||
#####################################################################
|
||||
|
||||
function installationSummary(){
|
||||
echo
|
||||
echoAndLog "OpenGnSys Installation Summary"
|
||||
echo "=============================="
|
||||
echoAndLog "Project version: $(cat $INSTALL_TARGET/doc/VERSION.txt 2>/dev/null)"
|
||||
echoAndLog "Installation directory: $INSTALL_TARGET"
|
||||
echoAndLog "Repository directory: $INSTALL_TARGET/images"
|
||||
echoAndLog "TFTP configuracion directory: /var/lib/tftpboot"
|
||||
echoAndLog "DHCP configuracion file: /etc/dhcp3/dhcpd.conf"
|
||||
echoAndLog "NFS configuracion file: /etc/exports"
|
||||
echoAndLog "Web Console URL: $OPENGNSYS_CONSOLEURL"
|
||||
echoAndLog "Web Console admin user: $OPENGNSYS_DB_USER"
|
||||
echoAndLog "Web Console admin password: $OPENGNSYS_DB_PASSWD"
|
||||
echoAndLog "Web Console default user: $OPENGNSYS_DB_DEFAULTUSER"
|
||||
echoAndLog "Web Console default password: $OPENGNSYS_DB_DEFAULTPASSWD"
|
||||
echo
|
||||
echoAndLog "Post-Installation Instructions:"
|
||||
echo "==============================="
|
||||
echoAndLog "Review or edit all configuration files."
|
||||
echoAndLog "Insert DHCP configuration data and restart service."
|
||||
echoAndLog "Log-in as Web Console admin user."
|
||||
echoAndLog " - Review default Organization data and default user."
|
||||
echoAndLog "Log-in as Web Console organization user."
|
||||
echoAndLog " - Insert OpenGnSys data (rooms, computers, etc)."
|
||||
echo
|
||||
}
|
||||
|