From 2ef609d09c26326d9752c303a0fcddc5fea6cdaa Mon Sep 17 00:00:00 2001 From: sinthuja Date: Wed, 19 Apr 2017 19:07:35 +0530 Subject: [PATCH] Bug files for the profile-creator.bat after testing in windows machine, and improvements for script file. --- .../src/core/bin/profile-creator.bat | 326 ++++++++++++------ .../src/core/bin/profile-creator.sh | 10 +- 2 files changed, 225 insertions(+), 111 deletions(-) diff --git a/modules/distribution/src/core/bin/profile-creator.bat b/modules/distribution/src/core/bin/profile-creator.bat index 2b56bb75..9bbb8296 100644 --- a/modules/distribution/src/core/bin/profile-creator.bat +++ b/modules/distribution/src/core/bin/profile-creator.bat @@ -21,7 +21,8 @@ REM --------------------------------------------------------------------------- set DIR=%~dp0 set DISTRIBUTION=wso2iot-@product.version@ REM get the desired profile -echo This tool will erase all the files which are not required for the selected profile. +echo This tool will erase all the files which are not required for the selected profile +echo and provide you a light weight package for the target profile. echo WSO2 IoT Server Supports following profiles. echo 1.IoT Gateway Profile echo 2.IoT Key Manager Profile @@ -38,173 +39,280 @@ IF /I "%profileNumber%" EQU "2" goto KeyManager IF /I "%profileNumber%" EQU "3" goto Backend IF /I "%profileNumber%" EQU "4" goto Manager IF /I "%profileNumber%" EQU "5" goto Analytics -IF /I "%profileNumber%" EQU "5" goto Broker -IF /I "%profileNumber%" EQU "5" goto All +IF /I "%profileNumber%" EQU "6" goto Broker +IF /I "%profileNumber%" EQU "7" goto All echo Invalid profile identifier. -goto Exit + +:COPY_DIST +set TEMPDIR=%DIR%..\..\target +IF NOT EXIST %TEMPDIR% mkdir %TEMPDIR% +IF EXIST %TEMPDIR%\%DISTRIBUTION% @RD /S /Q %TEMPDIR%\%DISTRIBUTION% +IF EXIST %TEMPDIR%\%DISTRIBUTION%%PROFILE% @RD /S /Q %TEMPDIR%\%DISTRIBUTION%%PROFILE% +xcopy %DIR%..\..\%DISTRIBUTION% %TEMPDIR%\%DISTRIBUTION%\ /s /e /h +set DIR=%TEMPDIR%\%DISTRIBUTION%\bin\ +goto :eof :Gateway echo Preparing the Gateway profile distribution. + SET PROFILE=_gateway + call :COPY_DIST set DEFAULT_BUNDLES=%DIR%..\wso2\components\http-gateway\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info call :Remove_BROKER call :Remove_ANALYTICS call :Remove_JARS - IF EXIST %DIR%\..\wso2\components\default @RD /S /Q %DIR%\..\wso2\components\default - IF EXIST %DIR%\..\wso2\components\device-backend @RD /S /Q %DIR%\..\wso2\components\device-backend - IF EXIST %DIR%\..\wso2\components\device-key-manager @RD /S /Q %DIR%\..\wso2\components\device-key-manager - IF EXIST %DIR%\..\wso2\components\device-manager @RD /S /Q %DIR%\..\wso2\components\device-manager - IF EXIST %DIR%\..\samples @RD /S /Q %DIR%\..\samples - IF EXIST %DIR%\..\plugins @RD /S /Q %DIR%\..\plugins - IF EXIST %DIR%\profile-creator.sh del %DIR%\profile-creator.sh - IF EXIST %DIR%\profile-creator.bat del %DIR%\profile-creator.bat - for /R %DIR%\..\repository\resources\profiles\gateway %%f in (*.sh) do copy %%f %DIR%\..\bin\ - copy /y %DIR%\..\repository\resources\profiles\gateway\carbon.xml %DIR%\..\conf\ - IF EXIST %DIR%\..\repository\deployment\server\jaggeryapps del %DIR%\..\repository\deployment\server\jaggeryapps\* - IF EXIST %DIR%\..\repository\deployment\server\webapps del %DIR%\..\repository\deployment\server\webapps\* - IF EXIST %DIR%\..\repository\deployment\server\carbonapps del %DIR%\..\repository\deployment\server\carbonapps\* - IF EXIST %DIR%\..\repository\deployment\server\axis2services @RD /S /Q %DIR%\..\repository\deployment\server\axis2services\* - IF EXIST %DIR%\..\repository\deployment\server\devicetypes @RD /S /Q %DIR%\..\repository\deployment\server\devicetypes\* - IF EXIST %DIR%\..\conf\identity\sso-idp-config.xml del %DIR%\..\conf\identity\sso-idp-config.xml - echo Gateway profile created successfully. + IF EXIST %DIR%..\wso2\components\default @RD /S /Q %DIR%..\wso2\components\default + IF EXIST %DIR%..\wso2\components\device-backend @RD /S /Q %DIR%..\wso2\components\device-backend + IF EXIST %DIR%..\wso2\components\device-key-manager @RD /S /Q %DIR%..\wso2\components\device-key-manager + IF EXIST %DIR%..\wso2\components\device-manager @RD /S /Q %DIR%..\wso2\components\device-manager + IF EXIST %DIR%..\samples @RD /S /Q %DIR%..\samples + IF EXIST %DIR%..\plugins @RD /S /Q %DIR%..\plugins + for /R %DIR%..\repository\resources\profiles\gateway %%f in (*.sh) do copy %%f %DIR%..\bin\ + for /R %DIR%..\repository\resources\profiles\gateway %%f in (*.bat) do copy %%f %DIR%..\bin\ + copy /y %DIR%..\repository\resources\profiles\gateway\carbon.xml %DIR%..\conf\ + IF EXIST %DIR%..\repository\deployment\server\jaggeryapps @RD /S /Q %DIR%..\repository\deployment\server\jaggeryapps + IF EXIST %DIR%..\repository\deployment\server\webapps @RD /S /Q %DIR%..\repository\deployment\server\webapps + IF EXIST %DIR%..\repository\deployment\server\carbonapps @RD /S /Q %DIR%..\repository\deployment\server\carbonapps + IF EXIST %DIR%..\repository\deployment\server\axis2services @RD /S /Q %DIR%..\repository\deployment\server\axis2services + IF EXIST %DIR%..\repository\deployment\server\devicetypes @RD /S /Q %DIR%..\repository\deployment\server\devicetypes + mkdir %DIR%..\repository\deployment\server\jaggeryapps + mkdir %DIR%..\repository\deployment\server\webapps + mkdir %DIR%..\repository\deployment\server\carbonapps + mkdir %DIR%..\repository\deployment\server\axis2services + mkdir %DIR%..\repository\deployment\server\devicetypes + IF EXIST %DIR%..\conf\identity\sso-idp-config.xml del %DIR%..\conf\identity\sso-idp-config.xml + call :RENAME_DIST + echo Gateway profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. goto Exit :KeyManager - echo Preparing the Gateway profile distribution. - set DEFAULT_BUNDLES=%DIR%..\wso2\components\http-gateway\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info + echo Preparing the KeyManager profile distribution. + SET PROFILE=_keymanager + call :COPY_DIST + set DEFAULT_BUNDLES=%DIR%..\wso2\components\device-key-manager\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info call :Remove_BROKER call :Remove_ANALYTICS call :Remove_JARS - IF EXIST %DIR%\..\wso2\components\default @RD /S /Q %DIR%\..\wso2\components\default - IF EXIST %DIR%\..\wso2\components\http-gateway @RD /S /Q %DIR%\..\wso2\components\http-gateway - IF EXIST %DIR%\..\wso2\components\device-backend @RD /S /Q %DIR%\..\wso2\components\device-backend - IF EXIST %DIR%\..\wso2\components\device-manager @RD /S /Q %DIR%\..\wso2\components\device-manager - IF EXIST %DIR%\..\samples @RD /S /Q %DIR%\..\samples - IF EXIST %DIR%\..\plugins @RD /S /Q %DIR%\..\plugins - IF EXIST %DIR%\profile-creator.sh del %DIR%\profile-creator.sh - IF EXIST %DIR%\profile-creator.bat del %DIR%\profile-creator.bat - for /R %DIR%\..\repository\resources\profiles\keymanager %%f in (*.sh) do copy %%f %DIR%\..\bin\ - copy /y %DIR%\..\repository\resources\profiles\keymanager\carbon.xml %DIR%\..\conf\ - copy /y %DIR%\..\repository\resources\profiles\keymanager\identity\application-authentication.xml %DIR%\..\conf\identity\ - IF EXIST %DIR%\..\repository\deployment\server\jaggeryapps del %DIR%\..\repository\deployment\server\jaggeryapps\* - IF EXIST %DIR%\..\repository\deployment\server\carbonapps del %DIR%\..\repository\deployment\server\carbonapps\* - IF EXIST %DIR%\..\repository\deployment\server\axis2services @RD /S /Q %DIR%\..\repository\deployment\server\axis2services\* - IF EXIST %DIR%\..\repository\deployment\server\devicetypes @RD /S /Q %DIR%\..\repository\deployment\server\devicetypes\* - IF EXIST %DIR%\..\repository\deployment\server\synapse-configs\default\api @RD /S /Q %DIR%\..\repository\deployment\server\synapse-configs\default\api\* - IF EXIST %DIR%\..\repository\deployment\server\synapse-configs\default\sequences @RD /S /Q %DIR%\..\repository\deployment\server\synapse-configs\default\sequences\_*.xml - mkdir %DIR%\..\repository\deployment\server\tempwebapp - copy /y %DIR%\..\repository\deployment\server\webapps\oauth2.war %DIR%\..\repository\deployment\server\tempwebapp\ - copy /y %DIR%\..\repository\deployment\server\webapps\client-registration#v0.11.war %DIR%\..\repository\deployment\server\tempwebapp\ - copy /y %DIR%\..\repository\deployment\server\webapps\dynamic-client-web.war %DIR%\..\repository\deployment\server\tempwebapp\ - copy /y %DIR%\..\repository\deployment\server\webapps\authenticationendpoint.war %DIR%\..\repository\deployment\server\tempwebapp\ - IF EXIST %DIR%\..\repository\deployment\server\webapps del %DIR%\..\repository\deployment\server\webapps\* - echo Gateway profile created successfully. + IF EXIST %DIR%..\wso2\components\default @RD /S /Q %DIR%..\wso2\components\default + IF EXIST %DIR%..\wso2\components\http-gateway @RD /S /Q %DIR%..\wso2\components\http-gateway + IF EXIST %DIR%..\wso2\components\device-backend @RD /S /Q %DIR%..\wso2\components\device-backend + IF EXIST %DIR%..\wso2\components\device-manager @RD /S /Q %DIR%..\wso2\components\device-manager + IF EXIST %DIR%..\samples @RD /S /Q %DIR%..\samples + IF EXIST %DIR%..\plugins @RD /S /Q %DIR%..\plugins + for /R %DIR%..\repository\resources\profiles\keymanager %%f in (*.sh) do copy %%f %DIR%..\bin\ + for /R %DIR%..\repository\resources\profiles\keymanager %%f in (*.bat) do copy %%f %DIR%..\bin\ + copy /y %DIR%..\repository\resources\profiles\keymanager\carbon.xml %DIR%..\conf\ + copy /y %DIR%..\repository\resources\profiles\keymanager\identity\application-authentication.xml %DIR%..\conf\identity\ + IF EXIST %DIR%..\repository\deployment\server\jaggeryapps @RD /S /Q %DIR%..\repository\deployment\server\jaggeryapps + IF EXIST %DIR%..\repository\deployment\server\carbonapps @RD /S /Q %DIR%..\repository\deployment\server\carbonapps + IF EXIST %DIR%..\repository\deployment\server\axis2services @RD /S /Q %DIR%..\repository\deployment\server\axis2services + IF EXIST %DIR%..\repository\deployment\server\devicetypes @RD /S /Q %DIR%..\repository\deployment\server\devicetypes + IF EXIST %DIR%..\repository\deployment\server\synapse-configs\default\api @RD /S /Q %DIR%..\repository\deployment\server\synapse-configs\default\api + del /s /q /f %DIR%..\repository\deployment\server\synapse-configs\default\sequences\_*.xml + mkdir %DIR%..\repository\deployment\server\tempwebapp + copy /y %DIR%..\repository\deployment\server\webapps\oauth2.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\client-registration#v0.11.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\dynamic-client-web.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\authenticationendpoint.war %DIR%..\repository\deployment\server\tempwebapp\ + IF EXIST %DIR%..\repository\deployment\server\webapps @RD /S /Q %DIR%..\repository\deployment\server\webapps + mkdir %DIR%..\repository\deployment\server\jaggeryapps + mkdir %DIR%..\repository\deployment\server\carbonapps + mkdir %DIR%..\repository\deployment\server\axis2services + mkdir %DIR%..\repository\deployment\server\devicetypes + mkdir %DIR%..\repository\deployment\server\webapps + mkdir %DIR%..\repository\deployment\server\synapse-configs\default\api + for /R %DIR%..\repository\deployment\server\tempwebapp %%f in (*.war) do copy %%f %DIR%..\repository\deployment\server\webapps\ + IF EXIST %DIR%..\repository\deployment\server\tempwebapp @RD /S /Q %DIR%..\repository\deployment\server\tempwebapp + IF EXIST %DIR%start-all.bat del %DIR%start-all.bat + IF EXIST %DIR%start-all.sh del %DIR%start-all.sh + IF EXIST %DIR%stop-all.bat del %DIR%stop-all.bat + IF EXIST %DIR%stop-all.sh del %DIR%stop-all.sh + call :RENAME_DIST + echo Key Manager profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. goto Exit :Backend - echo Preparing the Gateway profile distribution. + echo Preparing the Device Backend profile distribution. + SET PROFILE=_device-backend + call :COPY_DIST set DEFAULT_BUNDLES=%DIR%..\wso2\components\device-backend\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info call :Remove_BROKER call :Remove_ANALYTICS call :Remove_JARS - IF EXIST %DIR%\..\wso2\components\default @RD /S /Q %DIR%\..\wso2\components\default - IF EXIST %DIR%\..\wso2\components\http-gateway @RD /S /Q %DIR%\..\wso2\components\http-gateway - IF EXIST %DIR%\..\wso2\components\device-key-manager @RD /S /Q %DIR%\..\wso2\components\device-key-manager - IF EXIST %DIR%\..\wso2\components\device-manager @RD /S /Q %DIR%\..\wso2\components\device-manager - IF EXIST %DIR%\..\samples @RD /S /Q %DIR%\..\samples - IF EXIST %DIR%\..\plugins @RD /S /Q %DIR%\..\plugins - IF EXIST %DIR%\profile-creator.sh del %DIR%\profile-creator.sh - IF EXIST %DIR%\profile-creator.bat del %DIR%\profile-creator.bat - for /R %DIR%\..\repository\resources\profiles\backend %%f in (*.sh) do copy %%f %DIR%\..\bin\ - copy /y %DIR%\..\repository\resources\profiles\backend\carbon.xml %DIR%\..\conf\ - IF EXIST %DIR%\..\repository\deployment\server\synapse-configs\default\api @RD /S /Q %DIR%\..\repository\deployment\server\synapse-configs\default\api\* - IF EXIST %DIR%\..\repository\deployment\server\synapse-configs\default\sequences @RD /S /Q %DIR%\..\repository\deployment\server\synapse-configs\default\sequences\_*.xml - IF EXIST %DIR%\..\repository\deployment\server\jaggeryapps del %DIR%\..\repository\deployment\server\jaggeryapps\* - IF EXIST %DIR$%\..\repository\deployment\server\webapps\oauth2.war del %DIR$%\..\repository\deployment\server\webapps\oauth2.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\shindig.war del %DIR$%\..\repository\deployment\server\webapps\shindig.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\api#am#publisher#v0.11.war del %DIR$%\..\repository\deployment\server\webapps\api#am#publisher#v0.11.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\api#am#store#v0.11.war del %DIR$%\..\repository\deployment\server\webapps\api#am#store#v0.11.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\api#appm#oauth#v1.0.war del %DIR$%\..\repository\deployment\server\webapps\api#appm#oauth#v1.0.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\api#appm#publisher#v1.1.war del %DIR$%\..\repository\deployment\server\webapps\api#appm#publisher#v1.1.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\api#appm#store#v1.1.war del %DIR$%\..\repository\deployment\server\webapps\api#appm#store#v1.1.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\dynamic-client-web.war del %DIR$%\..\repository\deployment\server\webapps\dynamic-client-web.war - IF EXIST %DIR$%\..\repository\deployment\server\webapps\client-registration#v0.11.war del %DIR$%\..\repository\deployment\server\webapps\client-registration#v0.11.war - IF EXIST %DIR%\..\repository\deployment\server\carbonapps del %DIR%\..\repository\deployment\server\carbonapps\* - IF EXIST %DIR%\..\repository\deployment\server\axis2services @RD /S /Q %DIR%\..\repository\deployment\server\axis2services\* - IF EXIST %DIR%\..\repository\deployment\server\devicetypes @RD /S /Q %DIR%\..\repository\deployment\server\devicetypes\* - IF EXIST %DIR%\..\conf\identity\sso-idp-config.xml del %DIR%\..\conf\identity\sso-idp-config.xml - echo Backend profile created successfully. + IF EXIST %DIR%..\wso2\components\default @RD /S /Q %DIR%..\wso2\components\default + IF EXIST %DIR%..\wso2\components\http-gateway @RD /S /Q %DIR%..\wso2\components\http-gateway + IF EXIST %DIR%..\wso2\components\device-key-manager @RD /S /Q %DIR%..\wso2\components\device-key-manager + IF EXIST %DIR%..\wso2\components\device-manager @RD /S /Q %DIR%..\wso2\components\device-manager + IF EXIST %DIR%..\samples @RD /S /Q %DIR%..\samples + IF EXIST %DIR%..\plugins @RD /S /Q %DIR%..\plugins + for /R %DIR%..\repository\resources\profiles\backend %%f in (*.sh) do copy %%f %DIR%..\bin\ + for /R %DIR%..\repository\resources\profiles\backend %%f in (*.bat) do copy %%f %DIR%..\bin\ + copy /y %DIR%..\repository\resources\profiles\backend\carbon.xml %DIR%..\conf\ + IF EXIST %DIR%..\repository\deployment\server\synapse-configs\default\api @RD /S /Q %DIR%..\repository\deployment\server\synapse-configs\default\api + del /s /q /f %DIR%..\repository\deployment\server\synapse-configs\default\sequences\_*.xml + IF EXIST %DIR%..\repository\deployment\server\jaggeryapps @RD /S /Q %DIR%..\repository\deployment\server\jaggeryapps + IF EXIST %DIR%..\repository\deployment\server\axis2services @RD /S /Q %DIR%..\repository\deployment\server\axis2services + IF EXIST %DIR%..\repository\deployment\server\webapps\shindig.war del %DIR%..\repository\deployment\server\webapps\shindig.war + IF EXIST %DIR%..\repository\deployment\server\webapps\api#am#publisher#v0.11.war del %DIR%..\repository\deployment\server\webapps\api#am#publisher#v0.11.war + IF EXIST %DIR%..\repository\deployment\server\webapps\api#am#store#v0.11.war del %DIR%..\repository\deployment\server\webapps\api#am#store#v0.11.war + IF EXIST %DIR%..\repository\deployment\server\webapps\api#appm#oauth#v1.0.war del %DIR%..\repository\deployment\server\webapps\api#appm#oauth#v1.0.war + IF EXIST %DIR%..\repository\deployment\server\webapps\api#appm#publisher#v1.1.war del %DIR%..\repository\deployment\server\webapps\api#appm#publisher#v1.1.war + IF EXIST %DIR%..\repository\deployment\server\webapps\api#appm#store#v1.1.war del %DIR%..\repository\deployment\server\webapps\api#appm#store#v1.1.war + IF EXIST %DIR%..\repository\deployment\server\webapps\dynamic-client-web.war del %DIR%..\repository\deployment\server\webapps\dynamic-client-web.war + IF EXIST %DIR%..\repository\deployment\server\webapps\client-registration#v0.11.war del %DIR%..\repository\deployment\server\webapps\client-registration#v0.11.war + mkdir %DIR%..\repository\deployment\server\jaggeryapps + mkdir %DIR%..\repository\deployment\server\axis2services + mkdir %DIR%..\repository\deployment\server\synapse-configs\default\api + IF EXIST %DIR%..\conf\identity\sso-idp-config.xml del %DIR%..\conf\identity\sso-idp-config.xml + IF EXIST %DIR%start-all.bat del %DIR%start-all.bat + IF EXIST %DIR%start-all.sh del %DIR%start-all.sh + IF EXIST %DIR%stop-all.bat del %DIR%stop-all.bat + IF EXIST %DIR%stop-all.sh del %DIR%stop-all.sh + call :RENAME_DIST + echo Device Backend profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. + goto Exit + +:Manager + echo Preparing the Gateway profile distribution. + SET PROFILE=_device-manager + call :COPY_DIST + set DEFAULT_BUNDLES=%DIR%..\wso2\components\device-manager\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info + call :Remove_BROKER + call :Remove_ANALYTICS + call :Remove_JARS + IF EXIST %DIR%..\wso2\components\default @RD /S /Q %DIR%..\wso2\components\default + IF EXIST %DIR%..\wso2\components\http-gateway @RD /S /Q %DIR%..\wso2\components\http-gateway + IF EXIST %DIR%..\wso2\components\device-key-manager @RD /S /Q %DIR%..\wso2\components\device-key-manager + IF EXIST %DIR%..\wso2\components\device-backend @RD /S /Q %DIR%..\wso2\components\device-backend + IF EXIST %DIR%..\samples @RD /S /Q %DIR%..\samples + IF EXIST %DIR%..\plugins @RD /S /Q %DIR%..\plugins + for /R %DIR%..\repository\resources\profiles\manager %%f in (*.sh) do copy %%f %DIR%..\bin\ + for /R %DIR%..\repository\resources\profiles\manager %%f in (*.bat) do copy %%f %DIR%..\bin\ + copy /y %DIR%..\repository\resources\profiles\manager\carbon.xml %DIR%..\conf\ + IF EXIST %DIR%..\repository\deployment\server\synapse-configs\default\api @RD /S /Q %DIR%..\repository\deployment\server\synapse-configs\default\api + del /s /q /f %DIR%..\repository\deployment\server\synapse-configs\default\sequences\_*.xml + mkdir %DIR%..\repository\deployment\server\tempwebapp + copy /y %DIR%..\repository\deployment\server\webapps\api#am#publisher#v0.11.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\api#am#store#v0.11.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\api#appm#oauth#v1.0.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\api#appm#publisher#v1.1.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\api#appm#store#v1.1.war %DIR%..\repository\deployment\server\tempwebapp\ + copy /y %DIR%..\repository\deployment\server\webapps\shindig.war %DIR%..\repository\deployment\server\tempwebapp\ + IF EXIST %DIR%..\repository\deployment\server\webapps @RD /S /Q %DIR%..\repository\deployment\server\webapps + IF EXIST %DIR%..\repository\deployment\server\axis2services @RD /S /Q %DIR%..\repository\deployment\server\axis2services + mkdir %DIR%..\repository\deployment\server\axis2services + mkdir %DIR%..\repository\deployment\server\synapse-configs\default\api + mkdir %DIR%..\repository\deployment\server\webapps + for /R %DIR%..\repository\deployment\server\tempwebapp %%f in (*.war) do copy %%f %DIR%..\repository\deployment\server\webapps\ + IF EXIST %DIR%..\conf\identity\sso-idp-config.xml del %DIR%..\conf\identity\sso-idp-config.xml + IF EXIST %DIR%..\repository\deployment\server\tempwebapp @RD /S /Q %DIR%..\repository\deployment\server\tempwebapp + IF EXIST %DIR%start-all.bat del %DIR%start-all.bat + IF EXIST %DIR%start-all.sh del %DIR%start-all.sh + IF EXIST %DIR%stop-all.bat del %DIR%stop-all.bat + IF EXIST %DIR%stop-all.sh del %DIR%stop-all.sh + call :RENAME_DIST + echo Device Manager profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. goto Exit :Analytics echo Preparing the Analytics profile. + SET PROFILE=_analytics + call :COPY_DIST set DEFAULT_BUNDLES=%DIR%..\wso2\components\analytics-default\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info call :Remove_IoT call :Remove_BROKER call :Remove_JARS - echo Analytics profile created successfully. + call :RENAME_DIST + echo Analytics profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. goto Exit :Broker echo Preparing the Broker profile. + SET PROFILE=_broker + call :COPY_DIST set DEFAULT_BUNDLES=%DIR%..\wso2\components\broker-default\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info call :Remove_IOT call :Remove_ANALYTICS call :Remove_JARS - echo Broker profile created successfully. + call :RENAME_DIST + echo Broker profile created successfully in %TEMPDIR%\%DISTRIBUTION%%PROFILE%. goto Exit - +:All + echo Creating all profiles in IoT distribution + call :Gateway + call :KeyManager + call :Backend + call :Manager + call :Analytics + call :Broker + echo All profiles are created successfully in %TEMPDIR%. + goto :eof :Remove_BROKER echo Removing Broker profile - IF EXIST %DIR%\..\wso2\broker @RD /S /Q %DIR%\..\wso2\broker - IF EXIST %DIR%\..\wso2\components\broker-default @RD /S /Q %DIR%\..\wso2\components\broker-default - IF EXIST %DIR%\broker.bat del %DIR%\broker.bat - IF EXIST %DIR%\broker.sh del %DIR%\broker.sh + IF EXIST %DIR%..\wso2\broker @RD /S /Q %DIR%..\wso2\broker + IF EXIST %DIR%..\wso2\components\broker-default @RD /S /Q %DIR%..\wso2\components\broker-default + IF EXIST %DIR%broker.bat del %DIR%broker.bat + IF EXIST %DIR%broker.sh del %DIR%broker.sh goto :eof :Remove_ANALYTICS echo Removing Analytics profile - IF EXIST %DIR%\..\wso2\analytics @RD /S /Q %DIR%\..\wso2\analytics - IF EXIST %DIR%\..\wso2\components\analytics-default @RD /S /Q %DIR%\..\wso2\components\analytics-default - IF EXIST %DIR%\..\wso2\components\analytics-worker @RD /S /Q %DIR%\..\wso2\components\analytics-worker - IF EXIST %DIR%\analytics.bat del %DIR%\analytics.bat - IF EXIST %DIR%\analytics.sh del %DIR%\analytics.sh + IF EXIST %DIR%..\wso2\analytics @RD /S /Q %DIR%..\wso2\analytics + IF EXIST %DIR%..\wso2\components\analytics-default @RD /S /Q %DIR%..\wso2\components\analytics-default + IF EXIST %DIR%..\wso2\components\analytics-worker @RD /S /Q %DIR%..\wso2\components\analytics-worker + IF EXIST %DIR%analytics.bat del %DIR%analytics.bat + IF EXIST %DIR%analytics.sh del %DIR%analytics.sh goto :eof :Remove_IoT - echo Removing Integrator profile - IF EXIST %DIR%\..\conf @RD /S /Q %DIR%\..\conf - IF EXIST %DIR%\..\wso2\components\default @RD /S /Q %DIR%\..\wso2\components\default - IF EXIST %DIR%\..\wso2\components\device-manager @RD /S /Q %DIR%\..\wso2\components\device-manager - IF EXIST %DIR%\..\wso2\components\device-key-manager @RD /S /Q %DIR%\..\wso2\components\device-key-manager - IF EXIST %DIR%\..\wso2\components\device-backend @RD /S /Q %DIR%\..\wso2\components\device-backend - IF EXIST %DIR%\..\wso2\components\http-gateway @RD /S /Q %DIR%\..\wso2\components\http-gateway - IF EXIST %DIR%\..\samples @RD /S /Q %DIR% %DIR%\..\samples - IF EXIST %DIR%\..\modules @RD /S /Q %DIR% %DIR%\..\modules - IF EXIST %DIR%\..\dbscripts @RD /S /Q %DIR% %DIR%\..\dbscripts - IF EXIST %DIR%\..\plugins @RD /S /Q %DIR% %DIR%\..\plugins - IF EXIST %DIR%\..\repository @RD /S /Q %DIR% %DIR%\..\repository - IF EXIST %DIR%\..\tmp @RD /S /Q %DIR% %DIR%\..\tmp - IF EXIST %DIR%\..\resources @RD /S /Q %DIR% %DIR%\..\resources - IF EXIST %DIR%\profile-creator.bat del %DIR%\profile-creator.bat - IF EXIST %DIR%\profile-creator.sh del %DIR%\profile-creator.sh - IF EXIST %DIR%\iot-server.bat del %DIR%\iot-server.bat - IF EXIST %DIR%\iot-server.sh del %DIR%\iot-server.sh + echo Removing IoT profile + IF EXIST %DIR%..\conf @RD /S /Q %DIR%..\conf + IF EXIST %DIR%..\wso2\components\default @RD /S /Q %DIR%..\wso2\components\default + IF EXIST %DIR%..\wso2\components\device-manager @RD /S /Q %DIR%..\wso2\components\device-manager + IF EXIST %DIR%..\wso2\components\device-key-manager @RD /S /Q %DIR%..\wso2\components\device-key-manager + IF EXIST %DIR%..\wso2\components\device-backend @RD /S /Q %DIR%..\wso2\components\device-backend + IF EXIST %DIR%..\wso2\components\http-gateway @RD /S /Q %DIR%..\wso2\components\http-gateway + IF EXIST %DIR%..\samples @RD /S /Q %DIR%..\samples + IF EXIST %DIR%..\modules @RD /S /Q %DIR%..\modules + IF EXIST %DIR%..\dbscripts @RD /S /Q %DIR%..\dbscripts + IF EXIST %DIR%..\plugins @RD /S /Q %DIR%..\plugins + IF EXIST %DIR%..\repository @RD /S /Q %DIR%..\repository + IF EXIST %DIR%..\tmp @RD /S /Q %DIR%..\tmp + IF EXIST %DIR%..\resources @RD /S /Q %DIR%..\resources + IF EXIST %DIR%iot-server.bat del %DIR%iot-server.bat + IF EXIST %DIR%iot-server.sh del %DIR%iot-server.sh + IF EXIST %DIR%carbondump.bat del %DIR%carbondump.bat + IF EXIST %DIR%carbondump.sh del %DIR%carbondump.sh + IF EXIST %DIR%chpasswd.bat del %DIR%chpasswd.bat + IF EXIST %DIR%chpasswd.sh del %DIR%chpasswd.sh + IF EXIST %DIR%ciphertool.bat del %DIR%ciphertool.bat + IF EXIST %DIR%ciphertool.sh del %DIR%ciphertool.sh + IF EXIST %DIR%start-all.bat del %DIR%start-all.bat + IF EXIST %DIR%start-all.sh del %DIR%start-all.sh + IF EXIST %DIR%stop-all.bat del %DIR%stop-all.bat + IF EXIST %DIR%stop-all.sh del %DIR%stop-all.sh goto :eof :Remove_JARS echo Removing unnecessary jars - mkdir %DIR%\..\wso2\components\tmp_plugins + mkdir %DIR%..\wso2\components\tmp_plugins - FOR /F "tokens=1,2* delims=, " %%i in (%DEFAULT_BUNDLES%) do copy %DIR%\..\wso2\components\plugins\%%i_%%j.jar %DIR%\..\wso2\components\tmp_plugins + FOR /F "tokens=1,2* delims=, " %%i in (%DEFAULT_BUNDLES%) do copy %DIR%..\wso2\components\plugins\%%i_%%j.jar %DIR%..\wso2\components\tmp_plugins - @RD /S /Q %DIR%\..\wso2\components\plugins - rename %DIR%\..\wso2\components\tmp_plugins plugins + @RD /S /Q %DIR%..\wso2\components\plugins + rename %DIR%..\wso2\components\tmp_plugins plugins goto :eof +:RENAME_DIST + rename %TEMPDIR%\%DISTRIBUTION% %DISTRIBUTION%%PROFILE% + SET DIR=%TEMPDIR%\%DISTRIBUTION%%PROFILE%\bin\ + del /f %DIR%profile-creator.sh + del /f %DIR%profile-creator.bat + goto :eof :Exit + set DIR=%~dp0 pause diff --git a/modules/distribution/src/core/bin/profile-creator.sh b/modules/distribution/src/core/bin/profile-creator.sh index 12cb09ee..678c7527 100644 --- a/modules/distribution/src/core/bin/profile-creator.sh +++ b/modules/distribution/src/core/bin/profile-creator.sh @@ -42,13 +42,14 @@ read profileNumber create_profile(){ echo "Creating profile - "${profileNumber} if [ "$profileNumber" -lt 7 ] && [ "$profileNumber" -gt 0 ] ; then - TEMPDIR=${DIR}/../../tmp + TEMPDIR=${DIR}/../../target if [ ! -d "$TEMPDIR" ]; then echo "Creating temporary directory" mkdir ${TEMPDIR} fi + rm -rf ${TEMPDIR}/${DISTRIBUTION} echo "Copying the distribution to the temporary directory" cp -rf ${DIR}/../../${DISTRIBUTION} ${TEMPDIR}/ DIR=${TEMPDIR}/${DISTRIBUTION}/bin @@ -81,6 +82,7 @@ then rm -rf ${DIR}/profile-creator.sh rm -rf ${DIR}/profile-creator.bat cp -rf ${DIR}/../repository/resources/profiles/gateway/*.sh ${DIR}/../bin/ + cp -rf ${DIR}/../repository/resources/profiles/gateway/*.bat ${DIR}/../bin/ cp -rf ${DIR}/../repository/resources/profiles/gateway/carbon.xml ${DIR}/../conf/ rm -rf ${DIR}/../repository/deployment/server/jaggeryapps/* rm -rf ${DIR}/../repository/deployment/server/webapps/* @@ -118,6 +120,7 @@ then rm -rf ${DIR}/profile-creator.sh rm -rf ${DIR}/profile-creator.bat cp -rf ${DIR}/../repository/resources/profiles/keymanager/*.sh ${DIR}/../bin/ + cp -rf ${DIR}/../repository/resources/profiles/keymanager/*.bat ${DIR}/../bin/ cp -rf ${DIR}/../repository/resources/profiles/keymanager/carbon.xml ${DIR}/../conf/ cp -rf ${DIR}/../repository/resources/profiles/keymanager/identity/application-authentication.xml ${DIR}/../conf/identity/ rm -rf ${DIR}/../repository/deployment/server/jaggeryapps/* @@ -166,6 +169,7 @@ then rm -rf ${DIR}/../repository/deployment/server/synapse-configs/default/api/* rm -rf ${DIR}/../repository/deployment/server/synapse-configs/default/sequences/_*.xml cp -rf ${DIR}/../repository/resources/profiles/backend/*.sh ${DIR}/../bin/ + cp -rf ${DIR}/../repository/resources/profiles/backend/*.bat ${DIR}/../bin/ cp -rf ${DIR}/../repository/resources/profiles/backend/carbon.xml ${DIR}/../conf/ rm -rf ${DIR}/../repository/deployment/server/webapps/oauth2.war ${DIR}/../repository/deployment/server/webapps/shindig.war ${DIR}/../repository/deployment/server/webapps/api#am#publisher#v0.11.war ${DIR}/../repository/deployment/server/webapps/api#am#store#v0.11.war ${DIR}/../repository/deployment/server/webapps/api#appm#oauth#v1.0.war ${DIR}/../repository/deployment/server/webapps/api#appm#publisher#v1.1.war ${DIR}/../repository/deployment/server/webapps/api#appm#store#v1.1.war rm -rf ${DIR}/../repository/deployment/server/webapps/dynamic-client-web.war ${DIR}/../repository/deployment/server/webapps/client-registration#v0.11.war @@ -202,6 +206,7 @@ then rm -rf ${DIR}/profile-creator.sh rm -rf ${DIR}/profile-creator.bat cp -rf ${DIR}/../repository/resources/profiles/manager/*.sh ${DIR}/../bin/ + cp -rf ${DIR}/../repository/resources/profiles/manager/*.bat ${DIR}/../bin/ cp -rf ${DIR}/../repository/resources/profiles/manager/carbon.xml ${DIR}/../conf/ mkdir ${DIR}/../repository/deployment/server/tempwebapp cp ${DIR}/../repository/deployment/server/webapps/api#am#publisher#v0.11.war ${DIR}/../repository/deployment/server/tempwebapp/ @@ -295,7 +300,7 @@ mkdir -p ${DIR}/../wso2/components/tmp_plugins for BUNDLE in $DEFAULT_BUNDLES; do IFS=',' read -a bundleArray <<< "$BUNDLE" JAR=${bundleArray[0]}_${bundleArray[1]}.jar - cp ${DIR}/../wso2/components/plugins/${JAR} ${DIR}/../wso2/components/tmp_plugins + cp ${DIR}/../wso2/components/plugins/${JAR} ${DIR}/../wso2/components/tmp_plugins 2> /dev/null done rm -r ${DIR}/../wso2/components/plugins @@ -303,6 +308,7 @@ mv ${DIR}/../wso2/components/tmp_plugins ${DIR}/../wso2/components/plugins echo "Preparing a profile distribution archive." cd ${DIR}/../../ +rm -rf ${DISTRIBUTION}${PROFILE} mv ${DISTRIBUTION} ${DISTRIBUTION}${PROFILE} zip -r ${DISTRIBUTION}${PROFILE}.zip ${DISTRIBUTION}${PROFILE}/ cd ${BINDIR}