SveDec / Mattermost-Yunohost-LDAP

Mattermost LDAP integration into YunoHost
1 stars 1 forks source link

Mattermost_LDAP.sh: 84: Bad substitution #1

Open stepcellwolf opened 8 months ago

stepcellwolf commented 8 months ago

Hi,

When I try to run the bash script I get the following error:

# sh Mattermost_LDAP.sh 
Mattermost_LDAP.sh: 84: Bad substitution

yunohost version 11.2.10 mattermost version 9.4.2

Any suggestion or guide on how to run the scrip?

SveDec commented 7 months ago

Hi,

Line 84 is this one : OAUTH_DB_NAME="${OAUTH_APP_NAME,,}_db" This is a bash case expansion expansion, according to the bash man :

       ${parameter^pattern}
       ${parameter^^pattern}
       ${parameter,pattern}
       ${parameter,,pattern}
              Case  modification.   This  expansion modifies the case of alphabetic characters in parameter.  The pattern is expanded to produce a pattern just as in pathname
              expansion.  Each character in the expanded value of parameter is tested against pattern, and, if it matches the pattern, its case  is  converted.   The  pattern
              should  not attempt to match more than one character.  The ^ operator converts lowercase letters matching pattern to uppercase; the , operator converts matching
              uppercase letters to lowercase.  The ^^ and ,, expansions convert each matched character in the expanded value; the ^ and , expansions match  and  convert  only
              the first character in the expanded value.  If pattern is omitted, it is treated like a ?, which matches every character.  If parameter is @ or *, the case mod‐
              ification operation is applied to each positional parameter in turn, and the expansion is the resultant list.  If parameter is  an  array  variable  subscripted
              with @ or *, the case modification operation is applied to each member of the array in turn, and the expansion is the resultant list.

According to your quote, you are using the classic shell (actually, if you run a standard Yunohost distribution, it is dash), which can't interpret bash expansions.

As bash should be your default shell, please try running the script with bash Mattermost_LDAP.sh or simply ./Mattermost_LDAP.sh and report the result here.

SveDec commented 7 months ago

Please note the issue i just opened about another part of the script. I will try to update it today or in the coming days.

stepcellwolf commented 7 months ago

It worked, but somehow it crashed the entire yunohost. I restored it back, however now when I try to run it back again I get that Oauth server seems to be installed. How can I delete the Oauth server?

An Oauth server seems already installed Installation aborted

SveDec commented 7 months ago

This is caused by the check line 120. You have a directory called Mattermost-LDAP (which contains a clone of Crivaledaz's repository) either in your home directory, or in root's home directory. You have to delete it in order to pass that check. The message could be more specific, I may change it in a future update.

About the big crash after your first try, to provide you some help I'm going to need some details, diagnostics, logs ... can you be more specific about what happened ?

stepcellwolf commented 7 months ago

Hi, yes I tried to find the folder inside the user directly but it is not there. I also looked in the code and show in line 120 that checks for outh directory but it is not there. Any suggestions? I will try to troubleshoot it later this evening too. Thanks for your response.