Skip to content

Commit

Permalink
Merge pull request #13 from NebzHB/beta
Browse files Browse the repository at this point in the history
Better languages management
  • Loading branch information
NebzHB authored Sep 12, 2024
2 parents b0ad16f + 5636a54 commit 71d20fd
Show file tree
Hide file tree
Showing 5 changed files with 174 additions and 323 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
---------

# 12/09/2024
- Manage translation command (needed only for the lib, the dependancies per plugins are one language only) and put english in an external json file (open the door for other languages)
- Change doc to use the -4 parameter for wget to force ipv4
- Change doc to use the --no-cache parameter for wget to force re-download
- Simplification of some of the fix_handlers
- add postSubScript to be used at the end of a subScript to clean vars (only for subScripts)


# 02/09/2024 - First Changelog
- Rewrite documentation
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ see : [CHANGELOG](https://github.com/NebzHB/dependance.lib/blob/master/CHANGELOG
```
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib -O $BASEDIR/dependance.lib &>/dev/null
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib --no-cache -O $BASEDIR/dependance.lib &>/dev/null
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
. ${BASEDIR}/dependance.lib
##################################################################
Expand Down Expand Up @@ -120,7 +120,7 @@ E: Unable to locate package fdsfqfqfsqdf
```
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib -O $BASEDIR/dependance.lib &>/dev/null
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib --no-cache -O $BASEDIR/dependance.lib &>/dev/null
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
LANG_DEP=en
. ${BASEDIR}/dependance.lib
Expand All @@ -129,6 +129,24 @@ LANG_DEP=en
pre
```

## DEF_LANG=en (for subscript only !! (like install_nodejs.sh or pyenv.lib))

> Use it before the `. ${BASEDIR}/dependance.lib` line if you use english keys in your subscript using dependance.lib.
**example** :
```
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib --no-cache -O $BASEDIR/dependance.lib &>/dev/null
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
DEF_LANG=en
. ${BASEDIR}/dependance.lib
##################################################################
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/install_nodejs.sh --no-cache -O $BASEDIR/install_nodejs.sh &>/dev/null
pre
```

## TIMED=1

> Use it before the `. ${BASEDIR}/dependance.lib` line to time each step.
Expand All @@ -137,7 +155,7 @@ pre
```
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib -O $BASEDIR/dependance.lib &>/dev/null
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib --no-cache -O $BASEDIR/dependance.lib &>/dev/null
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
TIMED=1
. ${BASEDIR}/dependance.lib
Expand Down Expand Up @@ -234,7 +252,7 @@ Example calling the subscript install-something.sh here :
#!/bin/bash
######################### INCLUSION LIB ##########################
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
wget https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib -O $BASEDIR/dependance.lib &>/dev/null
wget -4 https://raw.githubusercontent.com/NebzHB/dependance.lib/master/dependance.lib --no-cache -O $BASEDIR/dependance.lib &>/dev/null
PLUGIN=$(basename "$(realpath $BASEDIR/..)")
. ${BASEDIR}/dependance.lib
##################################################################
Expand Down Expand Up @@ -305,6 +323,24 @@ will display :
======================================================================
```

## language choice between english or french for error messages (for subscript only !! (like install_nodejs.sh or pyenv.lib))

use that form : $(t "Clé en francais par défaut") in your bash file

example :
```
echo 1 > $TMPFOLDER/hasError.$$
echo -e ":fg-danger:$HR:/fg:" >> $TMPFOLDER/errorLog.$$
echo -e ":fg-danger:== $(t "ATTENTION Debian 10 Buster n'est officiellement plus supportée depuis le 30 juin 2024, merci de mettre à jour votre système en version plus récente de Debian !!!"):/fg:" >> $TMPFOLDER/errorLog.$$
echo -e ":fg-danger:== $(t "Les dépendances sont bloquées afin d'éviter tout problème, soit") $PLUGIN $(t "fonctionne et donc on y touche plus tant qu'il tourne, soit il ne fonctionne plus et donc il faut mettre à jour votre système en version plus récente de Debian."):/fg:" >> $TMPFOLDER/errorLog.$$
echo -e ":fg-danger:== $(t "Fin Septembre, Jeedom passe à NodeJS 20 qui est incompatible avec Debian 10. PLUS AUCUN SUPPORT NE SERA FAIT !!! Migrez donc au plus vite !"):/fg:" >> $TMPFOLDER/errorLog.$$
echo -e ":fg-danger:$HR:/fg:" >> $TMPFOLDER/errorLog.$$
post
exit 1
```
> Note that variables cannot be included in translation strings, so you need to split !
> If you want to use English keys, set LANG_DEF=en in the header
# This library has some auto-fixes already included for this common errors :

Expand Down
Loading

0 comments on commit 71d20fd

Please sign in to comment.