« Auto-éditer un wikilivre/Annexer (Version internationalisée)/cp-src2bin.sh » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
Re-copie du fichier source
m Révision
Ligne 1 : Ligne 1 :
; {{rouge|WARNING, this is an old version revised on Sep 18, 2021}}
; Install this executable shell code in sbin ( /usr/local/sbin | ~/Add_appendix/sbin | ~/Annexer/sbin )
; Install this executable shell code in sbin ( /usr/local/sbin | ~/Add_appendix/sbin | ~/Annexer/sbin )
; Installer ce code shell éxécutable dans sbin
; Installer ce code shell éxécutable dans sbin
Ligne 12 : Ligne 13 :
VERSION=210419
VERSION=210419


if [ "$1" = "-v" ]; then echo "cp-src2bin.sh : VERSION $VERSION"; exit 0; fi
if [ "$1" = "--v" ]; then echo "cp-src2bin.sh : VERSION $VERSION rrevised on Sep 18, 2021"; exit 0; fi


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


#P Find the working name directory
#P Find the working name directory
cat pwd.txt | cut -d "/" -f4 > workname.txt
cat pwd.txt | cut -d "/" -f4 > workname.txt
read Workname < workname.txt
read Workname<workname.txt
echo -n "Working name directory= $Workname"
echo -n "Working name directory= $Workname"
if [ $Workname = "Annexer" ] || [ $Workname = "Add_appendix" ]
if [ $Workname = "Annexer" ] || [ $Workname = "Add_appendix" ]
Ligne 28 : Ligne 29 :
#P Find full directories install, working etc.
#P Find full directories install, working etc.
source ~/$Workname/datas/installdir.var
source ~/$Workname/vars/installdir.var
echo "Install directory : $Installdir"
echo "Install directory : $Installdir"
echo "Working dir : $Workdir"
echo "Working dir : $Workdir"

echo "Bin dir : $Bindir"
echo "Lib dir : $Libdir"
echo "Sbindir : $Sbindir"
#T Test break exit 0
#T Test break exit 0


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


#P If files.pj is not empty copy all files *.sh to executable directory
#P If files.pj is not empty copy all files *.sh to executable directory
if [ -s "files.pj" ];
if [ -s "files.pj" ]
then
then
echo "files in files.pj :"
echo "files in files.pj :"
Ligne 51 : Ligne 50 :


#P Copy copy without extension .sh, and make files executables
#P Copy copy without extension .sh, and make files executables
echo "#####################################################################"
echo "# Warning: this script move all src/*.sh to bin/* without comments. #"
echo "# Warning: is not available to product POT files for translations. #"
echo "#####################################################################"
while read line
while read line
do
do

Version du 18 septembre 2021 à 18:31

WARNING, this is an old version revised on Sep 18, 2021
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/cp-src2bin.sh. 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.

clear

VERSION=210419

if [ "$1" = "--v" ]; then echo "cp-src2bin.sh : VERSION $VERSION rrevised on Sep 18, 2021"; 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
	fi
	
#P Find full directories install, working etc.
	source ~/$Workname/vars/installdir.var
    echo "Install directory : $Installdir"
	echo "Working dir : $Workdir"

#T Test break exit 0

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

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

#P Copy copy without extension .sh, and make files executables
    echo "#####################################################################"
    echo "# Warning: this script move all src/*.sh to bin/* without comments. #"
    echo "# Warning: is not available to product POT files for translations.  #"
    echo "#####################################################################"
    while read line
    do
#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/$Exename.sh to $Installdir/bin/$Exename"
      cat $Installdir/src/$Exename.sh | 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