Make all modifications you want Beber.  It's in git for this ...

I said :

It's a little bit creepy .. sorry when I have time I clean this and document a lot

I agree with you .. it's creepy .. :)


Beber a écrit :
Le jeudi 16 novembre à 01:00:55, « The Stupid User » à écrit :

add some scripts to compile ruby and another to create a bootbase.gz for rimelse isntallation It's a little bit creepy .. sorry when I have time I clean this and document a lot

Some comments bellow

---

 rimelse/puppetmaster_stuff/install_ruby.sh |   28 +++++++++
 rimelse/puppetmaster_stuff/mkrimelse.conf  |   11 ++++
rimelse/puppetmaster_stuff/mkrimelse.sh | 87 ++++++++++++++++++++++++++++

Many they can be helpfull for everyone so
maybe s/puppetmaster_staff/<what ever>/ ?

+#!/bin/bash
+
+RUBY_PREFIX="/root/rimelse/usr"

Humm, I think this doesn't need to be root dependant
No of corse, thas why I put this on Variables ... you can change this like you want ...
maybe this is more apropriate :
RUBY_PREFIX="$HOME/rimelse/usr"
Yes

+RUBY_SOURCE_FILE="ruby-1.8.5.tar.gz"
+RUBY_SOURCE_URL="ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz";
+RUBY_SOURCE_DIR="$(pwd)/ruby-1.8.5"
+RUBY_CONFIGURE_OPT="--with-static-linked-ext --without-ssl --without-sitedir --without-winsock2 --prefix=${RUBY_PREFIX} --without-zlib --without-curses"
+PRG_WGET="wget"
+PRG_TAR="tar"
+OPT_TAR="-xzvf"

hum, well ...

+IN_FILE_TO_REMOVE=${1}
+
+
+[[ ! -r ${RUBY_SOURCE_FILE} ]] && ${PRG_WGET} ${RUBY_SOURCE_URL}
+
+${PRG_TAR} ${OPT_TAR} ${RUBY_SOURCE_FILE}

I don't thins $PRG_TAR and $OPT_TAR (etc ...) are needed but ok
I don't think so but I love Variables ;)

+cd ${RUBY_SOURCE_DIR}
+
+./configure ${RUBY_CONFIGURE_OPT}
+[ ${?} -ne 0 ] && echo "RUBY CONFIGURE ERROR" && exit 2

./configure ${RUBY_CONFIGURE_OPT} || {  echo "RUBY CONFIGURE
ERROR" ;
                                        exit 2 ;
                                     }

Better for eyes no ?
yes yes yes

And what about

./configure ${RUBY_CONFIGURE_OPT} || exit 2

as configure show the error.

or :

eerror()
{
   echo $1
   exit -2
}

./configure ${RUBY_CONFIGURE_OPT} || eerror "RUBY CONFIGURE ERROR"

for eyes better too imho

+make
+[ ${?} -ne 0 ] && echo "RUBY MAKE ERROR" && exit 2
+make install
+[ ${?} -ne 0 ] && echo "RUBY MAKE INSTALL ERROR" && exit 2

Same here.


diff --git a/rimelse/puppetmaster_stuff/mkrimelse.conf b/rimelse/puppetmaster_stuff/mkrimelse.conf
new file mode 100644
index 0000000..58b7afe
--- /dev/null
+++ b/rimelse/puppetmaster_stuff/mkrimelse.conf
@@ -0,0 +1,11 @@
+USB_KEY_MOUNT_POINT="/media/usb"

in dur :)
It's mkrimelse.conf configuration file
+USB_KEY_DEVICE="$(mount | grep "${USB_KEY_MOUNT_POINT}" | cut -d " " -f 1)"

grep ${USB_KEY_MOUNT_POINT} /proc/mounts | cut ...

avoid the mount suckage if nfs or any disk HS.

+ROOT_DIR="${PWD}/racine"
+BOOTBASEFILE="${PWD}/bootbase.gz"
+KERNEL_SOURCE_DIR="${PWD}/rimelse_kernel"
+RUBY_SOURCE_DIR="${PWD}/ruby_sources"

Many a PREFIX set before ?

+CPIO_OPT="-o -Hnewc"
+
+RB_COMP=0
+KR_COMP=0
+BB_COMP=0
diff --git a/rimelse/puppetmaster_stuff/mkrimelse.sh b/rimelse/puppetmaster_stuff/mkrimelse.sh
new file mode 100755
index 0000000..07514f8
--- /dev/null
+++ b/rimelse/puppetmaster_stuff/mkrimelse.sh
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+#
+# A DIRTY SCRIPT TO INSTALL A RIMELSE WITH RUBY
+#
+#
+
+
+. ./mkrimelse.conf

ROOT_DIR and all install and output dir are not checked, so it will
be a lot of error if they don't exist (expected thoses which are
created by make install)

+usage()
+{
+       echo "$(basename $0 -a | -b | -r)"

usage of basename is totaly sucky imho (copy/paste attrocity)

+       exit 2
+}
+
+ruby_compile()
+{
+       cd $RUBY_SOURCE_DIR
+       ./install_ruby.sh
+       RET=${?}
+       [[ ${RET} -ne 0 ]] && exit $RET

./install_ruby.sh || exit $? (or any error fonction)
in my mind really better (ksh sucky past)

+       return 0
+}
+
+kernel_compile()
+{
+       cd $KERNEL_SOURCE_DIR
+       make
+       make install

Here you need to do make && make install as if make failed make install
will. But error message will be above, so not really helpful here and
will make some noises on ml.

Many add a check for user, and so do a su - -c 'make install' ?

+       return 0

not always 0

+}
+
+boot_base_create()
+{
+       echo "CREATION OF ${BOOTBASEFILE}"
+
+       cd ${ROOT_DIR}
+       find . -print | cpio ${CPIO_OPT} | gzip > ${BOOTBASEFILE}
+       cp "${BOOTBASEFILE}" "${USB_KEY_MOUNT_POINT}/boot"
+}
+
+if [[ ${#} -eq 1 ]] +then
+       for opt in $@
+       do
+               case $opt in +                  --all | -a )
+                               RB_COMP=1
+                               KR_COMP=1
+                               BB_COMP=1

what about call the function directly ? and so kill 10 lign is script ?

no I want to make it in order .. you can't compile ruby after make bootbase.gz ...



--
Puppet_Master
Else in your mind
www.else-projects.org


Reply via email to