source: installer/client_initrd_installer.sh @ 1c04494

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 1c04494 was 8964f9b, checked in by ramon <ramongomez@…>, 16 years ago

Resstructuración de trunk.

git-svn-id: https://opengnsys.es/svn/trunk@390 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100755
File size: 3.2 KB
RevLine 
[bf1443c]1#!/bin/bash
2
[8d651a7]3TFTPBOOT=/var/lib/tftpboot
4OGROOT=/opt/opengnsys
[fee895e]5INITRD=0
[9d7e97c]6UPDATE=0
[c967185]7
[bf1443c]8function arguments_parser
9{
[c967185]10    while [ $# -gt 0 ];do
[bf1443c]11        case $1 in
12            ("-t")
13            shift
14            if [ $# -eq 0 ];then
15                echo "Error parseando argumentos"
[c967185]16                exit -1
[bf1443c]17            else
[c967185]18                OGROOT=$1
[bf1443c]19                shift
20            fi
21            ;;
22
23            ("-s")
24            shift
[c967185]25            if [ $# -eq 0 ]; then
[bf1443c]26                echo "Error parseando argumentos"
[8d651a7]27                        exit -1
[bf1443c]28            else
29                SVNROOT=$1
30                shift
31            fi
32            ;;
[8d651a7]33
34            ("-u")
35            shift
[fee895e]36            UPDATE=1
37            ;;
38
39            ("-i")
40            shift
41            INITRD=1
[8d651a7]42            ;;
[bf1443c]43        esac
44    done
[c967185]45}
[bf1443c]46
[c967185]47function checking
48{
49    if [ $UID != 0 ]; then
50        echo "No tiene permisos suficientes para ejecutar este script"
51        exit -1
52    fi
[8d651a7]53    if [ -z $SVNROOT ]; then
54           echo "Necesito saber la ruta de las fuentes del proyecto."
55           echo "$0 -s /ruta/hacia/las/fuentes"
56           echo "Tambien puedes editar el script y anyadirlo manualmente."
57           exit -1
58    else
59       if [ ! -d $SVNROOT/opengnsys-admin ] ||
60          [ ! -d $SVNROOT/opengnsys-client ] ||
61          [ ! -d $SVNROOT/opengnsys-doc ] ||
62          [ ! -d $SVNROOT/opengnsys-repoman ] ||
63          [ ! -d $SVNROOT/opengnsys-installer ] ||
64          [ ! -d $SVNROOT/opengnsys-server ] ; then
65           echo "La ruta dada para las fuentes del proyecto son incorrectas"
66           exit -1;
67       fi
[c967185]68    fi
[bf1443c]69}
70
[139053a]71function install_necesary_packages
72{
[c967185]73    apt-get install pxe dhcp3-server tftpd-hpa nfs-kernel-server
[139053a]74}
75
[bf1443c]76function create_file_system
77{
[139053a]78    mkdir -p $TFTPBOOT
79
[bf1443c]80    mkdir -p $OGROOT
81
[139053a]82    mkdir -p $OGROOT/bin
83    mkdir -p $OGROOT/lib
84    mkdir -p $OGROOT/images
[8d651a7]85    mkdir -p $OGROOT/client
86    mkdir -p $OGROOT/client/lib/engine/bin
[139053a]87
[8d651a7]88    mkdir -p /etc/opengnsys
89    mkdir -p /var/log/opengnsys/clients
[bf1443c]90
[fee895e]91    ln -fs $TFTPBOOT $OGROOT/tftpboot
92    ln -fs /etc/opengnsys/ $OGROOT/etc
93    ln -fs /var/log/opengnsys/ $OGROOT/log
[8d651a7]94
95    cp -ar $SVNROOT/opengnsys-client/nfsexport/* $OGROOT/client
96    cp -ar $SVNROOT/opengnsys-client/engine/*.lib $OGROOT/client/lib/engine/bin
[456398c]97    cp -ar $SVNROOT/opengnsys-client/engine/*.sh $OGROOT/client/lib/engine/bin
[139053a]98}
99
[c967185]100function install_dhcpd
[139053a]101{
102    cat $SVNROOT/opengnsys-server/DHCP/dhcpd.conf >> /etc/dhcp3/dhcpd.conf
[c967185]103    /etc/init.d/dhcp3-server restart
[139053a]104    echo "Revise el archivo /etc/dhcp3/dhcpd.conf para configurarlo para su red"
[bf1443c]105}
106
[c967185]107function install_tftpboot
[bf1443c]108{
[139053a]109    mkdir -p $OGROOT/tftpboot/pxelinux.cfg/
[fee895e]110    cat $SVNROOT/opengnsys-server/PXE/pxelinux.cfg/default >> $OGROOT/tftpboot/pxelinux.cfg/default
111}
112
113function install_initrd
114{
115    $SVNROOT/opengnsys-client/boot/initrd-generator -t $OGROOT/tftpboot/
[bf1443c]116}
117
[c967185]118function install_nfsexport
[bf1443c]119{
[8d651a7]120    cat $SVNROOT/opengnsys-server/NFS/exports >> /etc/exports
[139053a]121    /etc/init.d/nfs-kernel-server restart
122
123    echo "Revise el archivo /etc/exports para configurarlo para su red"
[bf1443c]124}
125
126arguments_parser $@
[c967185]127checking
[8d651a7]128
[9d7e97c]129if [ $INITRD -eq 1 ]; then
[40488da]130    install_initrd
131fi
132
[9d7e97c]133if [ $UPDATE -eq 1 ]; then
[fee895e]134    create_file_system
135else
[8d651a7]136    install_necesary_packages
137    create_file_system
138    install_dhcpd
139    install_tftpboot
[fee895e]140    install_initrd
[8d651a7]141    install_nfsexport
142fi
Note: See TracBrowser for help on using the repository browser.