::
:: mkmozapd.bat
::
::   copies registry.dat / profiles.ini to
::   %APPDATA/...
::
::   if the profile folder does not yet exist
::
@echo off

:: VAR
set PROFILE_NEW=profiles.ini
set PROFILE_OLD=registry.dat

set H_FIREFOX=%HOMEDRIVE%\.mozilla\firefox
set APPDATA_FIREFOX_SOURCE=%LOGONSERVER%\netlogon\mozilla\profiles.ini.FIREFOX
set APPDATA_FIREFOX_TARGET_FOLDER=%APPDATA%\Mozilla\Firefox
set APPDATA_FIREFOX_TARGET_FILE=%PROFILE_NEW%

rem set H_THUNDERBIRD=%HOMEDRIVE%\.mozilla-thunderbird
rem set APPDATA_THUNDERBIRD_SOURCE=%LOGONSERVER%\netlogon\mozilla\profiles.ini.THUNDERBIRD
rem set APPDATA_THUNDERBIRD_TARGET_FOLDER=%APPDATA%\Thunderbird
rem set APPDATA_THUNDERBIRD_TARGET_FILE=%PROFILE_NEW%

:: Mozilla-Firefox
if EXIST "%H_FIREFOX%" (

  if not EXIST "%APPDATA_FIREFOX_TARGET_FOLDER%" (

    mkdir "%APPDATA_FIREFOX_TARGET_FOLDER%"

    if not EXIST "%APPDATA_FIREFOX_TARGET_FOLDER%\%PROFILE_OLD%" (

      if not EXIST "%APPDATA_FIREFOX_TARGET_FOLDER%\%PROFILE_NEW%" (

        echo Creating DebianEdu_FIREFOX_APPDATA: %APPDATA_FIREFOX_TARGET_FILE%
        copy "%APPDATA_FIREFOX_SOURCE%" "%APPDATA_FIREFOX_TARGET_FOLDER%\%APPDATA_FIREFOX_TARGET_FILE%" > NUL

      )

    )

  )

)

:: Mozilla-Thunderbird
rem  if EXIST "%H_THUNDERBIRD%" (
rem    if not EXIST "%APPDATA_THUNDERBIRD_TARGET_FOLDER%" (
rem      mkdir "%APPDATA_THUNDERBIRD_TARGET_FOLDER%"
rem      if not EXIST "%APPDATA_THUNDERBIRD_TARGET_FOLDER%\%PROFILE_OLD%" (
rem        if not EXIST "%APPDATA_THUNDERBIRD_TARGET_FOLDER%\%PROFILE_NEW%" (
rem          echo Creating DebianEdu_THUNDERBIRD_APPDATA: %APPDATA_FIREFOX_TARGET_FILE%
rem          copy "%APPDATA_THUNDERBIRD_SOURCE%" "%APPDATA_THUNDERBIRD_TARGET_FOLDER%\%APPDATA_THUNDERBIRD_TARGET_FILE%" > NUL
rem        )
rem      )
rem    )
rem  )

