patdie421 / mea-edomus

Automatically exported from code.google.com/p/mea-edomus
0 stars 0 forks source link

MEA-EDOMUS : création d'un package d'installation #98

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Le package doit contenir :

le binaire de mea-edomus
Un tar contenant l'ihm (tar à faire par le makefile)
le binaire xpl_hub
le binaire php (version light)
1 script "1ist_install.sh" qui déclenche l'installation. Un seul paramètre, 
le basepath de l'installation, le reste est pris en charge, y compris 
l'installation des bin dans le bon répertoire et l'installation de l'IHM.

Le package est simplement un tar de l'ensemble des éléments.

Original issue reported on code.google.com by patrice....@gmail.com on 1 Sep 2014 at 12:53

GoogleCodeExporter commented 9 years ago
Pour la compilation du php light voici les options :

 ./configure --prefix=/usr/local/php --disable-all --enable-session --enable-pdo --with-sqlite3 --with-pdo-sqlite --enable-json

supprimer aussi "-g" dans Makefile pour une taille minimum de l'executable

Original comment by patrice....@gmail.com on 1 Sep 2014 at 1:45

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by patrice....@gmail.com on 3 Sep 2014 at 7:11

GoogleCodeExporter commented 9 years ago
// script pour faire un package

cd $SOURCE

rm -r $SOURCE/build/tmp

mkdir -p $SOURCE/build/tmp
mkdir -p $SOURCE/build/tmp/bin
mkdir -p $SOURCE/build/tmp/lib
mkdir -p $SOURCE/build/tmp/lib/mea-gui
mkdir -p $SOURCE/build/tmp/lib/mea-plugins
mkdir -p $SOURCE/build/tmp/etc/init.d

cp $SOURCE/mea-edomus $SOURCE/build/tmp/bin

cd $SOURCE/ihm
tar cf - . | ( cd $SOURCE/build/tmp/lib/mea-gui ; tar xvf - )

cd $SOURCE/plugins
tar cf - . | ( cd $SOURCE/build/tmp/lib/mea-plugins ; tar xvf - )

cp $SOURCE/linux/init.d/* $SOURCE/build/tmp/etc/init.d

if [ -f $SOURCE/complements/php-cgi/php-5.x.x/sapi/cgi/php-cgi ]
then
   cp $SOURCE/complements/php-cgi/php-5.x.x/sapi/cgi/php-cgi $SOURCE/build/tmp/bin
fi

// rajouter ici les copies des autres fichiers de complements

cd $SOURCE/build/tmp
tar cvf $SOURCE/build/mea-edomus.tar *

cd $SOURCE/build
tar cvf $SOURCE/build/mea-edomus.tar.pkg mea-edomus.tar install.sh

// Pour install.sh : a lancer en pi

ICI=`pwd`;

mkdir -p $1
cd $1
tar xf $ICI/mea-edomus.tar

strip ./bin/mea-edomus
if [ -f ./bin/php-cgi ]
then
   strip ./bin/php-cgi
fi

./bin/mea-edomus --autoinit --basepath=$1
sudo sed -e '1,$s/<BASEPATH>/$1/g' ./etc/init.d/mea-edomus > 
/etc/init.d/mea-edomus
sudo update-rc.d mea-edomus defaults
sudo service mea-edomus start
cd $ICI

Original comment by patrice....@gmail.com on 3 Sep 2014 at 4:10

GoogleCodeExporter commented 9 years ago
// Pour install.sh : a lancer en pi ?

if [ $# -ne 1 ]
then
   echo "usage : $0 BASEPATH"
   exit 1
fi

# recupération des parametres
BASEPATH=$1

if [ "$BASEPATH" == "/usr" || "$BASEPATH" == "/" ]
then
   echo "ERROR : can't install in $BASEPATH. Choose an other directory, or install manualy !"
   exit 0
fi

if [ ! -d "$BASEPATH" ]
then
   echo "ERROR : $BASEPATH must exist. Create it !"
   exit 1
fi

if [ ! -w "$BASEPATH" ]
then
   echo "ERROR : You must have write permissions on $BASEPATH !"
   exit 1
fi

NBFILEINBASEPATH=`ls -a "$BASEPATH" | wc -l`
if [ $NBFILEINBASEPATH -ne 2 ]
then
   echo -n "WARNING : $BASEPATH is not empty. Continue (Y/N) ?"
# lire reponse et traiter en fonction
fi

# les slashs sont transformés en \/ pour sed
# echo $BASEPATH | sed -e 's/\//\\\//g' donne le résultat attendu
# mais pour utilisation avec les `` il faut remplacer en plus les \ par des \\
BASEPATH4SED=`echo $BASEPATH | sed -e 's/\\//\\\\\\//g'`

CURRENTPATH=`pwd`;
cd $BASEPATH

tar xf $CURRENTPATH/mea-edomus.tar

strip ./bin/*

./bin/mea-edomus --autoinit --basepath="$BASEPATH"

sudo sed -e 's/<BASEPATH>/'"$BASEPATH4SED"'/g' -e 's/<USER>/'"$USER"'/g' 
./etc/init.d/mea-edomus > /etc/init.d/mea-edomus
sudo update-rc.d mea-edomus defaults
sudo service mea-edomus start
cd $CURRENTPATH

Original comment by patrice....@gmail.com on 4 Sep 2014 at 11:42

GoogleCodeExporter commented 9 years ago
# à lancer de préférence en sudo

if [ $# -ne 1 ]
then
   echo "usage : $0 BASEPATH"
   echo "suggestion : $0 /usr/local/mea-edomus"
   exit 1
fi

# recupération des parametres
BASEPATH="$1"

if [ "$BASEPATH" == "/usr" || "$BASEPATH" == "/" ]
then
   echo "ERROR : can't actualy install in $BASEPATH. Choose an other directory, or install manualy !"
   exit 0
fi

if [ ! -d "$BASEPATH" ]
then
   echo "ERROR : $BASEPATH must exist. Create it !"
   exit 1
fi

if [ ! -w "$BASEPATH" ]
then
   echo "ERROR : You must have write permissions on $BASEPATH ! (use sudo)"
   exit 1
fi

NBFILEINBASEPATH=`ls -a "$BASEPATH" | wc -l`
if [ $NBFILEINBASEPATH -ne 2 ]
then
   echo "WARNING : $BASEPATH is not empty. Installation could be instable ... or other(s) application(s) could be damadged"
   while true; do
      read -p "Continue (Y/N) ? " YESNO
      case $YESNO in
        [YyOo] ) break;;
        [Nn] ) exit 1;;
        * ) echo "Please answer y or n !";;
      esac
   done
fi

MEAUSER='mea-edomus'
MEAGROUP='mea-edomus'

sudo groupadd -f "$MEAUSER" > /dev/null 2>&1
sudo useradd -r -N -g "$MEAGROUP" -M -d '' -s /dev/false > /dev/null 2>&1

CURRENTPATH=`pwd`;
cd "$BASEPATH"

sudo tar xf "$CURRENTPATH"/mea-edomus.tar

sudo strip ./bin/*

sudo ./bin/mea-edomus --autoinit --basepath="$BASEPATH"

sudo chown -R "$MEAUSER":"$MEAGROUP" "$BASEPATH"/lib/mea-gui
sudo chmod -R 775 "$MEAUSER":"$MEAGROUP" "$BASEPATH"/lib/mea-gui
sudo chown -R "$MEAUSER":"$MEAGROUP" "$BASEPATH"/lib/mea-plugin
sudo chmod -R 775 "$MEAUSER":"$MEAGROUP" "$BASEPATH"/lib/mea-plugin
sudo chown -R "$MEAUSER":"$MEAGROUP" "$BASEPATH"/var/log
sudo chmod -R 775 "$MEAUSER":"$MEAGROUP" "$BASEPATH"/var/log
sudo chown -R "$MEAUSER":"$MEAGROUP" "$BASEPATH"/var/db
sudo chmod -R 775 "$MEAUSER":"$MEAGROUP" "$BASEPATH"/var/db
sudo chown -R "$MEAUSER":"$MEAGROUP" "$BASEPATH"/etc
sudo chmod -R 775 "$MEAUSER":"$MEAGROUP" "$BASEPATH"/etc

# déclaration du service
# les slashs sont transformés en \/ pour sed
BASEPATH4SED=`echo "$BASEPATH" | sed -e 's/\\//\\\\\\//g'`
# Pour mémoire :
# echo $BASEPATH | sed -e 's/\//\\\//g' donne le résultat attendu
# mais pour utilisation avec les `` il faut remplacer en plus les \ par des \\

# déclaration du service
sudo sed -e 's/<BASEPATH>/'"$BASEPATH4SED"'/g' -e 's/<USER>/'"$MEAUSER"'/g' 
./etc/init.d/mea-edomus > /etc/init.d/mea-edomus

# activation du service
sudo update-rc.d mea-edomus defaults

# lancement du service
sudo service mea-edomus start

cd "$CURRENTPATH"

Original comment by patrice....@gmail.com on 4 Sep 2014 at 2:19

GoogleCodeExporter commented 9 years ago
Terminé

Original comment by patrice....@gmail.com on 4 Sep 2014 at 9:08