Auto-éditer un wikilivre/Annexer (Version internationalisée)/

Un livre de Wikilivres.
Aller à la navigation Aller à la recherche
Install this executable shell code in sbin ( /usr/local/sbin | ~/Add_appendix/sbin | ~/Annexer/sbin )
Installer ce code shell éxécutable dans sbin
espagnol ; Instale este código de shell ejecutable en sbin
#! /bin/bash
#P File : .../sbin/ This file must be copied in executable mode
#P Copy the source files to the executables directory.
#P The tests directory is used to individual test bash files from annex programm.



if [ "$1" = "-v" ]; then echo " : VERSION $VERSION"; exit 0; fi

#P Find the current directory
    pwd > pwd.txt
    read Currentdir < pwd.txt

#P Find the working name directory
    cat pwd.txt | cut -d "/" -f4 > workname.txt
    read Workname < workname.txt
	echo -n "Working name directory= $Workname"
	if [ $Workname = "Annexer" ] || [ $Workname = "Add_appendix" ]
	then echo " is found"; 
	else echo " is not a working name directory"; exit -1
#P Find full directories install, working etc.
	source ~/$Workname/datas/installdir.var
    echo "Install directory : $Installdir"
	echo "Working dir : $Workdir"
	echo "Bin dir : $Bindir"
    echo "Lib dir : $Libdir"
    echo "Sbindir : $Sbindir"
#T Test break exit 0

#P Make list files.pj 
    echo "Make files list from src directory in files.pj"
    ls $Installdir/src/*.sh > files.pj

#P If files.pj is not empty copy all files *.sh to executable directory
    if [ -s "files.pj" ];
      echo "files in files.pj :"
      cat files.pj
      echo "files.pj is empty, exit from"
      exit 1

#P Copy copy without extension .sh, and make files executables
    while read line
#T      echo "copy the ligne $line from files.pj '.sh' in the file exename without extension .sh"
      echo $line | sed s/.sh//g | awk -F "/" '{print $NF}'> exename.txt

#P   Affect the value in 'exename.txt' at the variable $Exename
      read Exename < exename.txt
      echo "copy $Installdir/src/$ to $Installdir/bin/$Exename"
      cat $Installdir/src/$ | grep -v "#O\|#P\|#T" >  $Installdir/bin/$Exename
      echo "Add mode 755 'executable' at file $Installdir/bin/$Exename"
      chmod 755 $Installdir/bin/$Exename
      echo "----"
    done < files.pj
#T Breakpoint exit 0

#P clean sbin directory
    rm files.pj pwd.txt exename.txt

#P End cp-src2bin