@ECHO OFF

SET "SCRIPT_PATH=%~dp0"
cd %SCRIPT_PATH%

cd ..
cd ..
cd ..

SET "SKD_PATH=%cd%
SET "SKD_GIT_DIR=%SKD_PATH%\.git"

if exist %SKD_GIT_DIR% (
  if exist "%SKD_PATH%\kernels" (
      echo INSTALLING POST-MERGE AND POST-CHECKOUT HOOKS TO:

      if not exist "%SKD_GIT_DIR%\hooks" (
        echo Creating git/hooks path...
        mkdir "%SKD_GIT_DIR%\hooks"
      )

      copy "%SCRIPT_PATH%\git_hooks\post-merge" "%SKD_GIT_DIR%\hooks"

      copy "%SCRIPT_PATH%\git_hooks\post-checkout" "%SKD_GIT_DIR%\hooks"

      copy "%SCRIPT_PATH%\update_local_mks.sh" "%SKD_GIT_DIR%\hooks"

      echo Installed at %SKD_GIT_DIR%

  ) else (
    echo Error: kernels folder not found at %SKD_PATH%
  )
) else (
    echo Error: .git folder not found at %SKD_PATH%
)
