rabbitmq / rabbitmq-server

Open source RabbitMQ: core server and tier 1 (built-in) plugins
https://www.rabbitmq.com/
Other
12.07k stars 3.9k forks source link

Windows: move the `ERLANG_HOME` configuration to the startup script #782

Open Gsantomaggio opened 8 years ago

Gsantomaggio commented 8 years ago

Move the ERLANG_HOME configuration to the startup script and remove it form the setup. The setup script has to find the erlang path itself if there is no ERLANG_HOME.

Gsantomaggio commented 8 years ago

To avoid to use the ERLANG_HOME the cmd tools have to query the windows registry.

I tried to implement it, but (obviously) works only as admin. The RabbitMQ cmd tools work also with the standard users, so it is not possible to apply the fix I tried.

For now I'd leave the setup as it.

Thoughts ?

Since I spent time on it, I report it here, maybe it is useful for the future.

call :finderlang "/reg:64" KEY_64
if "%KEY_64%"=="" ( 
   call :finderlang "/reg:32" KEY_32
   echo KEY 32 "%KEY_32%"

   if "%KEY_32%"=="" ( 
      echo "not found" 
   ) else (
   ERLANG_HOME = %KEY_32%
   )   
) else  ERLANG_HOME = %KEY_64%

:finderlang
setlocal
for /f "skip=2" %%a in ('reg query HKEY_LOCAL_MACHINE\Software\Ericsson\Erlang %1 ') do (
  ( endlocal
  FOR /F "tokens=2*" %%L IN ('reg query %%a %1 /v "" ') DO (
       set "%~2=%%M"
    )
   )
 )
exit /b