#! /bin/bash
#H File : admins_install_annex.sh in ~/Tmp or re-install_annex.sh in /usr/local/sbin directory
#H Origine : https://fr.wikibooks.org/wiki/Auto-éditer_un_wikilivre/Annexer_(Version_internationalisée)/users_install_annex.sh
#H Codage UTF-8 without BOM
#H
#D users_install_annex.sh documentation
#D ------------------------------------
#D This program install or re-install the directory structure for the annex
#D program of wikibooks.
#D Syntax for all annex programs : ~/Tmp/users_install_annex.sh [ OPTIONS ]
#D Do not use ./users_install_annex.sh
#D The installation Directories can be ~/Annexer or ~/Add_appendix
#D OPTIONS :
#D * Annexer, Add_appendix
#D * --v to print version
#D * ? to print syntax and usage
#D
#D To uninstall see users_uninstall_annex.sh
#D
#P Creation date : 2021/04/16 by GC
#P Modification date : 2021/04/18 by Clara
#P Modification date : 2021/04/25 by GC
#P Last test date : 2021/04/19 by Clara
#P Update and tests : 2021/07/16 by Clara.
#P Update and tests : 2021/07/21 by JPL for new french program "Annexer"
#P update annex.lib and copy this program to Annexer/sbin
#P
#D This Documentation is included in source file
#H Header of file included in source file
#O Organigram of program included in source file
#P Comments for programmers included in source file
#S Structure comments of program included in source file
#w Warnings comments in program included in source file
#O clean screen
clear
#O Install users_install_annex.sh only if annex.lib and users_install_annex.sh are found
if test -e $HOME/Tmp/users_install_annex.sh && test -e $HOME/lib/annex.lib
then echo "----"
else
echo "Create lib directory in your $HOME 'mkdir $HOME/lib'"
echo "Create Tmp directory in your $HOME 'mkdir $HOME/Tmp'"
echo "Copy 'annex.lib' in $HOME/lib/."
echo "Copy 'users_install_annex.sh' in $HOME/Tmp"
echo " and re-execute $HOME/Tmp/users_install_annex.sh"
exit -1
fi
#O Version
VERSION=211026
#O Print the version if the --v option is requested
if [ "$1" = "--v" ]; then echo "Version of users_install_annex.sh "$VERSION; exit 0; fi
#O If the first parameter '$1' is '?' print doc or syntax.
if [ "$1" = "?" ]
then
echo "Copy users_install_annex.sh in ~/Tmp directory"
echo "Syntax ~/Tmp/users_install_annex.sh [ --v | ? | Add_appendix | Annexer ]"; exit -1
echo "OPTIONS:"
echo "'--v' print users_install_annex.sh version"
echo "'?' Print syntax and OPTIONS"
echo "'Add_appendix' create directory structure for Add_appendix program"
echo "'Annexer' create directory structure for french Annexer program"
exit 0
fi
#O If the first parameter '$1' is empty print syntax.
if [ -z $1 ]
then
echo "Copy users_install_annex.sh in ~/Tmp directory"
echo "Syntax ~/Tmp/users_install_annex.sh [ --v | ? | Add_appendix | Annexer ]"; exit -1
fi
#P Do not use sudo
if [ $USER = "root" ]; then echo "USER = $USER"; echo "Do not use 'sudo' please."; exit -1; fi
#O Go to home directory and print the current directory.
cd ~
echo; echo -n "current directory = "; pwd; echo
#O If the first parameter is not empty
if [ $1 ]
then
if [ "$1" = "Annexer" ]; then Installdir=~/Annexer; echo "Installdir = "$Installdir
elif [ "$1" = "Add_appendix" ]; then Installdir=~/Add_appendix; echo "Installdir = "$Installdir
else echo "Syntax error ! "
echo "Copy users_install_annex.sh in ~/Tmp directory"
echo "Syntax ~/Tmp/users_install_annex.sh [ --v | ? | Add_appendix | Annexer ]"
exit -1
fi
fi
#O Test if Install directory exist
if [ -d $Installdir ];
then echo " is ok, $Installdir is found."
else echo " $Installdir not exist, i create it"; mkdir $Installdir;
fi
#O Create variables : Workdir, Bindir
if [ $1 = "Add_appendix" ]; then Workdir=~/Add_appendix; echo "Workdir = "$Workdir; fi
if [ $1 = "Annexer" ]; then Workdir=~/Annexer; echo "Workdir = "$Workdir; fi
if [ -d $Workdir ]; then echo " $Workdir is present."; else echo " $Workdir is not present, i create it."; mkdir $Workdir; fi
Bindir="$Installdir/bin"; echo "Bindir : "$Bindir
if test -d $Bindir
then echo " $Bindir is found."
else echo " $Bindir not found, create it"; mkdir $Bindir
fi
#T Breakpoint exit 0
#O Create or recreate directory hierarchy
cd $Workdir
echo -n "The current directory to create $Workdir sub directories = "; pwd
mkdir archives bin books datas lib lib/src sbin share src temp tests vars
cd $Workdir/tests
echo "$Workdir/tests is the current directory to create sub tests directories."; pwd
mkdir 00-install_annex 01-sbsrc 02-manuels
mkdir 0-pre-annex.sh 1-annex.lib 2-annex.sh 3-header.inc.sh 4-list.sh 5-download.sh 6-add_sclt.sh
mkdir 7-scli.inc.sh 8-add_sclic.sh 9-add_sclipco.sh 10-add_sclipwb.sh 11-annexer.sh 12-addappendix.sh
cd $Workdir/share
echo "$Workdir/share is the current directory to create sub share directories."; pwd
mkdir addappendix doc doc/html icons locale man mime mime/application
install -d addappendix/resources/lang/po/fr
install -d addappendix/resources/lang/po/es
install -d addappendix/resources/lang/po/en
install -d addappendix/resources/man/man1
install -d addappendix/resources/man/fr/man1
install -d addappendix/resources/man/fr/doc/html
install -d addappendix/resources/man/fr/doc/txt
install -d addappendix/resources/man/fr.UTF-8/man1
install -d addappendix/resources/man/fr.UTF-8/doc/html
install -d addappendix/resources/man/fr.UTF-8/doc/txt
install -d addappendix/resources/man/es/man1
install -d addappendix/resources/man/es/doc/html
install -d addappendix/resources/man/es/doc/txt
mkdir -p man/{man1,fr,fr/man1,fr.UTF8,fr.UTF8/man1,es,es/man1}
ln -sv $Workdir/share/man $Workdir/man
mkdir -p locale/{en,en/LC_MESSAGES,fr,fr/LC_MESSAGES,es,es/LC_MESSAGES}
mkdir -p mime
#T Breakpoint exit 0
#O Create variables
#Workdir=$Wokdir #redefinition
Booksdir=$Workdir/books
Testsdir=$Workdir/tests
Varsdir=$Workdir/vars
#Installdir=$Installdir #redefinition
Bindir=$Installdir/bin
Includedir=$Installdir/include
Libdir=$Installdir/lib
Mandir=$Installdir/man #lien vers /usr/local/share/man
Sbindir=$Installdir/sbin
Sharedir=$Installdir/share
Srcdir=$Installdir/src
#P Extra directories added
Datasdir=$Installdir/datas
Resourcesdir=$Workdir/share/addappendix/resources
#O Print variables and copy to $Varsdir/installdir.var with tee option -a (not ovewride)
rm $Varsdir/installdir.var
echo "Workdir=$Workdir" | tee $Varsdir/installdir.var
echo "Booksdir=$Booksdir" | tee -a $Varsdir/installdir.var
echo "Testsdir=$Testsdir" | tee -a $Varsdir/installdir.var
echo "Varsdir=$Varsdir" | tee -a $Varsdir/installdir.var
echo "Installdir=$Installdir" | tee -a $Varsdir/installdir.var
echo "Bindir=$Bindir" | tee -a $Varsdir/installdir.var
echo "Includedir=$Includedir" | tee -a $Varsdir/installdir.var
echo "Libdir=$Libdir" | tee -a $Varsdir/installdir.var
echo "Mandir=$Mandir" | tee -a $Varsdir/installdir.var
echo "Sbindir=$Sbindir" | tee -a $Varsdir/installdir.var
echo "Sharedir=$Sharedir" | tee -a $Varsdir/installdir.var
echo "Srcdir=$Srcdir" | tee -a $Varsdir/installdir.var
echo "Datadir=$Datasdir" | tee -a $Varsdir/installdir.var
echo "Resourcesdir=$Resourcesdir" | tee -a $Varsdir/installdir.var
echo; echo "Content of file $Workdir/vars/installdir.var"
cat $Workdir/vars/installdir.var
########################################
#P LIBS
echo "To update annex.lib in lib directory:"
echo " Testsdir = $Testsdir"
echo " Libdir = $Libdir"
echo "------------------------------------"
#P Update annex.lib
if test -e $Testsdir/1-annex.lib/updt-annex-lib.sh
then
cp $Testsdir/1-annex.lib/updt-annex-lib.sh $Libdir/.
$Libdir/updt-annex-lib.sh
fi
#P Copy -rf $Libdir if exist annex.lib in $Libdir
install -d ~/lib
cp -ru $Libdir/* ~/lib
if test -e ~/lib/annex.lib
then
source $Libdir/annex.lib
echo "Use $Libdir/annex.lib"
else
source $HOME/lib/annex.lib
echo "Use $HOME/lib/annex.lib"
fi
#O Clean program sources files and add .pot files
# SRCS
echo "To update sources files in Testsdir to Src directory:"
echo " Testsdir = $Testsdir"
echo " Srcdir = $Srcdir"
echo " Bindir = $Bindir"
echo " Verbode = $Verbose"
echo "------------------------------------"
source $Libdir/src/cpcleaned2bin.sh
# add_sclic
if test -e $Testsdir/8-add_sclic.sh/add_sclic.sh; then cp -f $Testsdir/8-add_sclic.sh/add_sclic.sh $Srcdir/add_sclic.sh; fi
if test -e $Srcdir/add_sclic.sh; then cpcleaned2bin add_sclic.sh; else echo "$Srcdir/add_sclic.sh not found by users_install_annex.sh"; fi
# add_sclipco
if test -e $Testsdir/9-add_sclipco.sh/add_sclipco.sh; then cp -f $Testsdir/9-add_sclipco.sh/add_sclipco.sh $Srcdir/add_sclipco.sh; fi
if test -e $Srcdir/add_sclipco.sh; then cpcleaned2bin add_sclipco.sh; else echo "$Srcdir/add_sclipco.sh not found by users_install_annex.sh"; fi
# add_sclipwb
if test -e $Testsdir/10-add_sclipwb.sh/add_sclipwb.sh; then cp -f $Testsdir/10-add_sclipwb.sh/add_sclipwb.sh $Srcdir/add_sclipwb.sh; fi
if test -e $Srcdir/add_sclipwb.sh; then cpcleaned2bin add_sclipwb.sh; else echo "$Srcdir/add_sclipwb.sh not found by users_install_annex.sh"; fi
# add_sclt
if test -e $Testsdir/6-add_sclt.sh/add_sclt.sh; then cp -f $Testsdir/6-add_sclt.sh/add_sclt.sh $Srcdir/add_sclt.sh; fi
if test -e $Srcdir/add_sclt.sh; then cpcleaned2bin add_sclt.sh; else echo "$Srcdir/add_sclt.sh not found by users_install_annex.sh"; fi
# annex
if test -e $Testsdir/2-annex.sh/annex.sh; then cp -f $Testsdir/2-annex.sh/annex.sh $Srcdir/annex.sh; fi
if test -e $Srcdir/annex.sh; then cpcleaned2bin annex.sh; else echo "$Srcdir/annex.sh not found by users_install_annex.sh"; fi
# download
if test -e $Testsdir/5-download.sh/download.sh; then cp -f $Testsdir/5-download.sh/download.sh $Srcdir/download.sh; fi
if test -e $Srcdir/download.sh; then cpcleaned2bin download.sh; else echo "$Srcdir/download.sh not found by users_install_annex.sh"; fi
# en_sclic.inc
if test -e $Testsdir/8-add_sclic.sh/en_sclic.inc.sh; then cp -f $Testsdir/8-add_sclic.sh/en_sclic.inc.sh $Srcdir/en_sclic.inc.sh; fi
if test -e $Srcdir/en_sclic.inc.sh; then cpcleaned2bin en_sclic.inc.sh; else echo "$Srcdir/en_sclic.inc.sh not found by users_install_annex.sh"; fi
# en_sclipco.inc
if test -e $Testsdir/9-add_sclipco.sh/en_sclipco.inc.sh; then cp -f $Testsdir/9-add_sclipco.sh/en_sclipco.inc.sh $Srcdir/en_sclipco.inc.sh; fi
if test -e $Srcdir/en_sclipco.inc.sh; then cpcleaned2bin $Srcdir/en_sclipco.inc.sh; else echo "$Srcdir/en_sclipco.inc.sh not found by users_install_annex.sh"; fi
# en_sclipwb.inc
if test -e $Testsdir/10-add_sclipwb.sh/en_sclipwb.inc.sh; then cp -f $Testsdir/10-add_sclipwb.sh/en_sclipwb.inc.sh $Srcdir/en_sclipwb.inc.sh;fi
if test -e $Srcdir/en_sclipwb.inc.sh; then cpcleaned2bin en_sclipwb.inc.sh; else echo "$Srcdir/en_sclipwb.inc.sh not found by users_install_annex.sh"; fi
# en_sclt.inc
if test -e $Testsdir/6-add_sclt.sh/en_sclt.inc.sh; then cp -f $Testsdir/6-add_sclt.sh/en_sclt.inc.sh $Srcdir/en_sclt.inc.sh; fi
if test -e $Srcdir/en_sclt.inc.sh; then cpcleaned2bin en_sclt.inc.sh; else echo "$Srcdir/en_sclt.inc.sh not found by users_install_annex.sh"; fi
# fr_sclic.inc
if test -e $Testsdir/8-add_sclic.sh/fr_sclic.inc.sh; then cp -f $Testsdir/8-add_sclic.sh/fr_sclic.inc.sh $Srcdir/fr_sclic.inc.sh; fi
if test -e $Srcdir/fr_sclic.inc.sh; then cpcleaned2bin fr_sclic.inc.sh; else echo "$Srcdir/fr_sclic.inc.sh not found by users_install_annex.sh"; fi
# fr_sclipco.inc
if test -e $Testsdir/9-add_sclipco.sh/fr_sclipco.inc.sh; then cp -f $Testsdir/9-add_sclipco.sh/fr_sclipco.inc.sh $Srcdir/fr_sclipco.inc.sh; fi
if test -e $Srcdir/fr_sclipco.inc.sh; then cpcleaned2bin fr_sclipco.inc.sh; else echo "$Srcdir/fr_sclipco.inc.sh not found by users_install_annex.sh"; fi
# fr_sclipwb.inc
if test -e $Testsdir/10-add_sclipwb.sh/fr_sclipwb.inc.sh; then cp -f $Testsdir/10-add_sclipwb.sh/fr_sclipwb.inc.sh $Srcdir/fr_sclipwb.inc.sh; fi
if test -e $Srcdir/fr_sclipwb.inc.sh; then cpcleaned2bin fr_sclipwb.inc.sh; else echo "$Srcdir/fr_sclipwb.inc.sh not found by users_install_annex.sh"; fi
# fr_sclt.inc
if test -e $Testsdir/6-add_sclt.sh/fr_sclt.inc.sh; then cp -f $Testsdir/6-add_sclt.sh/fr_sclt.inc.sh $Srcdir/fr_sclt.inc.sh; fi
if test -e $Srcdir/fr_sclt.inc.sh; then cpcleaned2bin fr_sclt.inc.sh; else echo "$Srcdir/fr_sclt.inc.sh not found by users_install_annex.sh"; fi
# header.inc
if test -e $Testsdir/3-header.inc.sh/header.inc.sh; then cp -f $Testsdir/3-header.inc.sh/header.inc.sh $Srcdir/header.inc.sh; fi
if test -e $Srcdir/header.inc.sh; then cpcleaned2bin header.inc.sh; else echo "$Srcdir/header.inc.sh not found by users_install_annex.sh"; fi
# list
if test -e $Testsdir/4-list.sh/list.sh; then cp -f $Testsdir/4-list.sh/list.sh $Srcdir/list.sh; fi
if test -e $Srcdir/list.sh; then cpcleaned2bin list.sh; else echo "$Srcdir/list.sh not found by users_install_annex.sh"; fi
# pre-annex
if test -e $Testsdir/0-pre-annex.sh/pre-annex.sh; then cp -f $Testsdir/0-pre-annex.sh/pre-annex.sh $Srcdir/pre-annex.sh; fi
if test -e $Srcdir/pre-annex.sh; then cpcleaned2bin pre-annex.sh; else echo "$Srcdir/pre-annex.sh not found by users_install_annex.sh"; fi
# scli.inc
if test -e $Testsdir/7-scli.inc.sh/scli.inc.sh; then cp -f $Testsdir/7-scli.inc.sh/scli.inc.sh $Srcdir/scli.inc.sh; fi
if test -e $Srcdir/scli.inc.sh; then cpcleaned2bin scli.inc.sh; else echo "$Srcdir/scli.inc.sh not found by users_install_annex.sh"; fi
# addappendix
if test -e $Testsdir/12-addappendix.sh/addappendix.sh; then cp -f $Testsdir/12-addappendix.sh/addappendix.sh $Srcdir/addappendix.sh; fi
if test -e $Srcdir/addappendix.sh; then cpcleaned2bin addappendix.sh; else echo "$Srcdir/addappendix.sh not found by users_install_annex.sh"; fi
# annexer
if test -e $Testsdir/11-annexer.sh/annexer.sh; then cp -f $Testsdir/11-annexer.sh/annexer.sh $Srcdir/annexer.sh; fi
if test -e $Srcdir/annexer.sh; then cpcleaned2bin annexer.sh; else echo "$Srcdir/annexer.sh not found by users_install_annex.sh"; fi
# SBINS files may not exist in sbsrc
echo "To update SBINS sources files in Testsdir to sbin directory:"
echo " Testsdir = $Testsdir"
echo " Sbindir = $Sbindir"
echo "------------------------------------
source $Libdir/src/killalldoc.sh
if test -e $Testsdir/01-sbsrc/compil2bin.sh; then killALLDOC $Testsdir/01-sbsrc/compil2bin.sh > $Sbindir/compil2bin; fi
if test -e $Testsdir/01-sbsrc/cp-src2bin.sh; then killALLDOC $Testsdir/01-sbsrc/cp-src2bin.sh > $Sbindir/cp-src2bin; fi
if test -e $Testsdir/01-sbsrc/docu2html.sh; then killALLDOC $Testsdir/01-sbsrc/docu2html.sh > $Sbindir/docu2html; fi
if test -e $Testsdir/01-sbsrc/install_datasfiles.sh; then killALLDOC $Testsdir/01-sbsrc/install_datasfiles.sh > $Sbindir/install_datasfiles; fi
if test -e $Testsdir/01-sbsrc/makeman_annex.sh; then killALLDOC $Testsdir/01-sbsrc/makeman_annex.sh > $Sbindir/makeman_annex; fi
if test -e $Testsdir/01-sbsrc/users_install_annex.sh; then cp -f $Testsdir/01-sbsrc/users_install_annex.sh $Sbindir/users_install_annex.sh; fi
if test -e $Testsdir/01-sbsrc/install_annex.sh; then cp -f $Testsdir/01-sbsrc/install_annex.sh $Sbindir/install_annex.sh; fi
if [ "$1" = "Annexer" ]
then
echo; echo "Installation de '$1' " | tee $Workdir/installer.txt
echo; echo "Se connecter à l'url :" | tee -a $Workdir/installer.txt
echo "https://fr.wikibooks.org/wiki/Autoéditer_un_wikilivre/Annexer_\(Version_internationalisée\)#src.orig_en_français" | tee -a $Workdir/installer.txt
echo "Copier les pages de codes, les coller dans un éditeur de texte et les enregistrer dans les répertoires spécialisés" | tee -a $Workdir/installer.txt
echo "Les fichiers : " | tee -a $Workdir/installer.txt
echo " sources, dans le répertoire $1/src" | tee -a $Workdir/installer.txt
echo " de données dans $1/datas" | tee -a $Workdir/installer.txt
echo " de librairies, dans $1/lib" | tee -a $Workdir/installer.txt
echo " d'exécutables de maintenance, dans $1/sbin" | tee -a $Workdir/installer.txt
echo " de documentation dans $1/share/doc" | tee -a $Workdir/installer.txt
echo " de manuels dans $1/share/man" | tee -a $Workdir/installer.txt
echo "Utiliser cette version imprimable : " | tee -a $Workdir/installer.txt
echo " https://fr.wikibooks.org/wiki/Auto-éditer_un_wikilivre/Annexer_\(Version_internationalisée\)/Version_imprimable" | tee -a $Workdir/installer.txt
echo " pour copier les scripts bash" | tee -a $Workdir/installer.txt
echo; echo "Finalement ré-exécuter cette commande ~/Annexer/sbin/users_install_annex.sh" | tee -a $Workdir/installer.txt
fi
if [ "$1" = "Add_appendix" ]
then
echo; echo "'$1' installation." | tee $Workdir/install.txt
echo; echo "Login to url :" | tee -a $Workdir/install.txt
echo "https://fr.wikibooks.org/wiki/Autoéditer_un_wikilivre/Annexer_\(Version_internationalisée\)#Codes_sources_\(internationalized_source_code\)" | tee -a $Workdir/install.txt
echo "Copy code pages in memory, paste them in a text editor and save in the specialized directory" | tee -a $Workdir/install.txt
echo "The files :" | tee -a $Workdir/install.txt
echo " sources in the directory Add_appendix/src" | tee -a $Workdir/install.txt
echo " datas in Add_appendix/datas" | tee -a $Workdir/install.txt
echo " library in Add_appendix/lib" | tee -a $Workdir/install.txt
echo " executable for maintenance, in Add_appendix/sbin 'chmod 755' * in sbin" | tee -a $Workdir/install.txt
echo " documentation in Add_appendix/share/doc" | tee -a $Workdir/install.txt
echo " manuals in Add_appendix/share/man" | tee -a $Workdir/install.txt
echo "Use this printable version : " | tee -a $Workdir/install.txt
echo " https://fr.wikibooks.org/wiki/Auto-éditer_un_wikilivre/Annexer_\(Version_internationalisée\)/Version_imprimable" | tee -a $Workdir/install.txt
echo " to copy the bash code" | tee -a $Workdir/install.txt
echo; echo "Finaly reexecute this command ~/Add_appendix/sbin/users_install_annex.sh" | tee -a $Workdir/install.txt
fi
echo
#O Initialize $Conversions variable
Datasdir=$Workdir/datas; echo "Datadir = $Datasdir"
Conversions=$Datasdir/conversions.dat; echo "Conversion file = $Conversions"
#O Create or recreate the conversions.dat file in datas directory
if test -e $Conversions
then echo "The $Conversions file is present and will not be updated"
else
{
echo "s/%24/\$/g;s/%21/\!/g;s/%25/%/g;s/%2B/+/g;s/%3C/\\\<\;/g;s/%3E/\>\;/g;" > $Conversions
echo "s/%5C/\\\/g;s/%B0/°/g" >> $Conversions
echo "s/%E0/à/g;s/%E2/â/g" >> $Conversions
echo "s/%E8/è/g;s/%E9/é/g;s/%EA/ê/g;s/%EB/ë/g" >> $Conversions
echo "s/%EE/î/g;s/%EF/ï/g" >> $Conversions
echo "s/%F4/ô/g" >> $Conversions
echo "s/%F9/ù/g;s/%FB/û/g" >> $Conversions
echo "s/%25/%/g;" >> $Conversions
echo "s/%28/(/g;s/%29/)/g;" >> $Conversions
echo "s/%2B/+/g;" >> $Conversions
echo "s/%3A/:/g;" >> $Conversions
echo "s/%3D/=/g;" >> $Conversions
echo "s/%5B/[/g;" >> $Conversions
echo "s/%5D/]/g" >> $Conversions
echo "s/%3B/;/g;s/%2F/\//g;s/%27/'/g" >> $Conversions
echo 's/%22/"/g' >> $Conversions
echo "s/%C3%A7/ç/g;s/%E7/ç/g" >> $Conversions
echo "s/%C3%A0/à/g;s/%C3%A2/â/g" >> $Conversions
echo "s/%C3%A9/é/g;s/%C3%A8/è/g;s/%C3%AA/ê/g" >> $Conversions
echo "s/%C3%AE/î/g;s/%C3%AF/ï/g" >> $Conversions
echo "s/%C3%B4/ô/g" >> $Conversions
echo "s/%C3%B9/ù/g;s/%C3%BB/û/g" >> $Conversions
echo "s/%C2%B7/-/g;s/%C2%AB/«/g;s/%C2%BB/»/g" >> $Conversions
}
fi
echo "----"
#O Initialize $Content_cleaner variable
Content_cleaner=$Datasdir/content_cleaner.dat
echo "Content_cleaner = $Content_cleaner"
#O If not exist create the content_cleaner.dat in datas directory
if test -e $Content_cleaner
then echo "The $Content_cleaner file is present and will not be updated"
else
{
echo "s/: \[/\[/g;s/:\[/\[/g" > $Content_cleaner
echo "s/# \[/[/g;s/#\[/\[/g" >> $Content_cleaner
echo "s/* \[/[/g;s/*\[/\[/g" >> $Content_cleaner
echo "s/; /;/g" >> $Content_cleaner
}
fi
echo "----"
#O Initialize $Unrecognized_links variable
Unrecognized_links=$Datasdir/unrecognized_links.dat
echo "Unrecognized_links = $Unrecognized_links"
#O If not exist, create the file Unrecognized_links.dat
#O If not exist create the content_cleaner.dat in datas directory
if test -e $Unrecognized_links
then echo "The $Unrecognized_links file is present and will not be updated"
else
{
echo "fr.wikibooks.org: unrecognized_link.dat ignore les liens non contenus dans les pages Résumé ou Sommaire"
echo "title" > $Unrecognized_links
echo "Spécial" >> $Unrecognized_links
echo "Accueil" >> $Unrecognized_links
echo "Vitrine" >> $Unrecognized_links
echo "Tous_les_livres" >> $Unrecognized_links
echo "Rechercher_un_livre" >> $Unrecognized_links
echo "Wikijunior" >> $Unrecognized_links
echo "Portail_communautaire" >> $Unrecognized_links
echo "Le_Bistro" >> $Unrecognized_links
echo "Special:" >> $Unrecognized_links
echo "Aide:Accueil" >> $Unrecognized_links
echo "propos_de" >> $Unrecognized_links
echo "https://fr.wikibooks.org/wiki/Wikilivres" >> $Unrecognized_links
echo "Wikilivres:" >> $Unrecognized_links
echo "Catégorie:" >> $Unrecognized_links
echo "en.wikibooks.org: unrecognized_link.dat ignore the uncontained Links in the Summary or Contents pages"
echo "Main_Page" >> $Unrecognized_links
echo "Help:Contents" >> $Unrecognized_links
echo "Card_Catalog_Office" >> $Unrecognized_links
echo "Cookbook:Table_of_Contents" >> $Unrecognized_links
echo "Featured_books" >> $Unrecognized_links
echo "Using_Wikibooks" >> $Unrecognized_links
echo "Reading_room" >> $Unrecognized_links
echo "Community_Portal" >> $Unrecognized_links
echo "Reading_room/Bulletin_Board" >> $Unrecognized_links
echo "Maintenance" >> $Unrecognized_links
echo "Policies_and_guidelines" >> $Unrecognized_links
echo "Contact_us" >> $Unrecognized_links
echo "Welcome" >> $Unrecognized_links
echo "General_disclaimer" >> $Unrecognized_links
echo "Category:" >> $Unrecognized_links
}
fi
echo "----"
#O Write README in bin directory
#T echo "param 1 = $1"
if [ "$1" = "Add_appendix" ]
then
echo "*** Write bin/README file "
echo "README to use bin directory" > $Workdir/bin/README
echo "This directory is reserved for commands without a '.sh' file suffix." >> $Workdir/bin/README
echo "Commands without '.sh' are stripped of comments. They come from the" >> $Workdir/bin/README
echo " 'src' directory or from the 'tests' subdirectories." >> $Workdir/bin/README
echo "Executables commands with '.bash', '.sh', '.x' or .exe suffix are" >> $Workdir/bin/README
echo " commands for maintainers in 'sbin' directory" >> $Workdir/bin/README
echo "*** Write README in Add_appendix"
echo "README file in Add_appendix" > $Workdir/README
echo "Type ~/Add_appendix/bin/annex to launch the annex application" >> $Workdir/README
echo " or ~/add_appendix/bin/addappendix to launch the global application." >> $Workdir/README
fi
if [ "$1" = "Annexer" ]
then
echo "*** écriture du fichier bin/LISEZ-MOI"
echo "LISEZ-MOI pour l'utilisation du répertoire 'bin'" > $Workdir/bin/LISEZ-MOI
echo "Ce répertoire est réservé aux commandes shell sans l'extension '.sh'." >> $Workdir/bin/LISEZ-MOI
echo "Les commandes sans '.sh' proviennent du répertoire 'src' ou des sous-répertoires" >> $Workdir/bin/LISEZ-MOI
echo " des 'tests', dépouillées des commentaires." >> $Workdir/bin/README
echo "Les exécutables avec l'extension '.bash', 'sh', '.x' ou .exe sont" >> $Workdir/bin/LISEZ-MOI
echo " pour les mainteneurs dans le répertoire 'sbin'" >> $Workdir/bin/LISEZ-MOI
echo "*** écriture du fichier LISEZ-MOI dans Annexer"
echo "Fichier LISEZ-MOI dans Annexer" > $Workdir/LISEZ-MOI
echo "Taper ~/Annexer/bin/annex pour lancer l'application annex" >> $Workdir/LISEZ-MOI
echo " ou ~/Annexer/bin/annexer pour lancer l'application globale." >> $Workdir/LISEZ-MOI
fi
#O Clean tmpfiles
if test -d ~/tmp; then rm -r ~/tmp; fi
#O End of admins_install_annex.sh