diff --git a/includes/usr/bin/boot-tools/CompileSoftware.sh b/includes/usr/bin/boot-tools/CompileSoftware.sh new file mode 100755 index 0000000..a421352 --- /dev/null +++ b/includes/usr/bin/boot-tools/CompileSoftware.sh @@ -0,0 +1,40 @@ +#!/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/ + + +#apt-get remove build-essential libattr* attr make m4 gettext libmhash-dev gdebi-core gawk + diff --git a/includes/usr/bin/boot-tools/ConfFS.sh b/includes/usr/bin/boot-tools/ConfFS.sh new file mode 100755 index 0000000..3e0f4b5 --- /dev/null +++ b/includes/usr/bin/boot-tools/ConfFS.sh @@ -0,0 +1,24 @@ +#!/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 \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/GenerateGraphicBoot.sh b/includes/usr/bin/boot-tools/GenerateGraphicBoot.sh new file mode 100644 index 0000000..b12eeb2 --- /dev/null +++ b/includes/usr/bin/boot-tools/GenerateGraphicBoot.sh @@ -0,0 +1,17 @@ +#!/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 \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/GenerateInitrd.generic.sh b/includes/usr/bin/boot-tools/GenerateInitrd.generic.sh new file mode 100755 index 0000000..eaeb475 --- /dev/null +++ b/includes/usr/bin/boot-tools/GenerateInitrd.generic.sh @@ -0,0 +1,16 @@ +#!/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 \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/InstallSoftware.sh b/includes/usr/bin/boot-tools/InstallSoftware.sh new file mode 100755 index 0000000..11838ea --- /dev/null +++ b/includes/usr/bin/boot-tools/InstallSoftware.sh @@ -0,0 +1,80 @@ +#!/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 + + + diff --git a/includes/usr/bin/boot-tools/ReconfigureLocales.sh b/includes/usr/bin/boot-tools/ReconfigureLocales.sh new file mode 100755 index 0000000..5480d14 --- /dev/null +++ b/includes/usr/bin/boot-tools/ReconfigureLocales.sh @@ -0,0 +1,4 @@ +#!/bin/bash +dpkg-reconfigure console-data +dpkg-reconfigure console-setup +dpkg-reconfigure locales \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/generateSshKeysClient.sh b/includes/usr/bin/boot-tools/generateSshKeysClient.sh new file mode 100755 index 0000000..9857ad4 --- /dev/null +++ b/includes/usr/bin/boot-tools/generateSshKeysClient.sh @@ -0,0 +1,23 @@ +#!/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 \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/importSVNboot-tools.sh b/includes/usr/bin/boot-tools/importSVNboot-tools.sh new file mode 100644 index 0000000..0067715 --- /dev/null +++ b/includes/usr/bin/boot-tools/importSVNboot-tools.sh @@ -0,0 +1,118 @@ +#!/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="" + + +OSDISTRIB=$(lsb_release -i | 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 " + +# 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 +#else +# rm /root/GenerateInitrd.generic.sh +#fi + +#damos permiso al directorio de scripts +chmod 775 ${SVNCLIENTDIR}/clientstructure/root/* + +# los copiamos +cp -prv ${SVNCLIENTDIR}/includes/* / +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/ +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 + +######################################################### +cp -pr ${SVNCLIENTSTRUCTURE}/lib/pci.ids $OGCLIENTMOUNT/etc +if [ $? -ne 0 ] +then + echo "$FUNCNAME(): Copying pci.ids : ERROR" + exit 1 +fi +####### Browsser +cp ${SVNCLIENTSTRUCTURE}/bin/browser $OGCLIENTMOUNT/bin +if [ $? -ne 0 ] +then + echo "$FUNCNAME(): Copying Browser : ERROR" + exit 1 +fi + + +#Compatiblidad con og2 +cp ${SVNCLIENTSTRUCTURE}/bin/browser2 $OGCLIENTMOUNT/bin + +cp -prv ${SVNOG2}/ogr/ogr $OGCLIENTMOUNT/opt/opengnsys/bin/ + +cp -prv ${SVNOG2}/ogr/libogr.py $OGCLIENTMOUNT/usr/lib/python2.7/libogr.py +cp -prv ${SVNOG2}/ogr/libogr.py $OGCLIENTMOUNT/usr/lib/python2.6/libogr.py +cp -prv ${SVNOG2}/ogr/libogr.py $OGCLIENTMOUNT/opt/opengnsys/lib/python + + +echo "mkdir -p /opt/opengnsys/lib/engine/" +mkdir -p /opt/opengnsys/lib/engine/ +echo "cp -prv ${SVNOG2}/engine/2.0/* $OGCLIENTMOUNT/opt/opengnsys/lib/engine/" +cp -prv ${SVNOG2}/engine/2.0/* $OGCLIENTMOUNT/opt/opengnsys/lib/engine/ + + +cp -prv ${SVNOG2}/job_executer $OGCLIENTMOUNT/opt/opengnsys/bin/ + + +cp ${SVNCLIENTSTRUCTURE}/bin/ogAdmClient $OGCLIENTMOUNT/bin + + + + diff --git a/includes/usr/bin/boot-tools/importSshKeys.sh b/includes/usr/bin/boot-tools/importSshKeys.sh new file mode 100755 index 0000000..17a797f --- /dev/null +++ b/includes/usr/bin/boot-tools/importSshKeys.sh @@ -0,0 +1,17 @@ +#!/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" + \ No newline at end of file diff --git a/includes/usr/bin/boot-tools/qemu.sh b/includes/usr/bin/boot-tools/qemu.sh new file mode 100755 index 0000000..c5a93cd --- /dev/null +++ b/includes/usr/bin/boot-tools/qemu.sh @@ -0,0 +1,9 @@ +#/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 \ No newline at end of file