Auto-éditer un wikilivre/Annexer (Version internationalisée)/install datasfiles.sh

  • Ce script installe ou met à jour le répertoire datas des logiciels Add-appendix ou Annexer il est normalemnt inclus dans les scripts d'installation où la variable $Workdir est définie.
Pour metrre à jour il est nécessère de procéder à une mise à jour des répertoires avec la commande users install annex
  • install_datasfiles install or update datas files in datas directory with users install annex or install_annex
#!/bin/bash
#H File install_datasfiles.sh in $Workdir/sbin
#D this script install data files in $Workdir/datas
VERSION=211125
#O Initialize variable Workdir for install_annex in /usr/local
    echo "Working directory is $Workdir for install_annex in /usr/local"
    Workdir=Add_appendix
#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/\\\&lt\;/g;s/%3E/\&gt\;/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