?login_element?

Subversion Repositories NedoOS

Rev

Rev 289 | Blame | Compare with Previous | Last modification | View Log | Download

  1. @echo off
  2. set DMIMG=%~dp0dmimg.exe
  3. if not exist %DMIMG% echo ERROR: "%DMIMG%" not found.&&exit
  4. if "%1"=="" goto usage
  5. if "%2"=="" goto usage
  6. if not "%3"=="" goto usage
  7. setlocal EnableDelayedExpansion
  8. set IMAGEFILE=%1
  9. set SOURCEDIR=%~dpn2
  10. set SCRIPTFILE=script.tmp
  11. echo Scanning directory "%SOURCEDIR%"...
  12. if exist %SCRIPTFILE% del /q %SCRIPTFILE% > nul
  13. for /r %SOURCEDIR% %%i in (.) do (
  14.         rem disk:/path/file
  15.         set j=%%~dpni
  16.         if not "!j:%SOURCEDIR%=!"=="" echo mkdir !j:%SOURCEDIR%=!>> %SCRIPTFILE%
  17. )
  18. for /r %SOURCEDIR% %%i in (*.*) do (
  19.         set j=%%~dpnxi
  20.         echo put %%i !j:%SOURCEDIR%=!>> %SCRIPTFILE%
  21. )
  22. if not exist "%SCRIPTFILE%" (
  23.         echo Nothing to add - skipping. File "%IMAGEFILE%" was not modified.
  24.         exit /b
  25. )
  26. echo Adding files from directory "%SOURCEDIR%" to the image "%IMAGEFILE%"...
  27. %DMIMG% %IMAGEFILE% conf %SCRIPTFILE%
  28. del /q %SCRIPTFILE%
  29. echo File "%IMAGEFILE%" is successfully updated.
  30. exit /b
  31.  
  32. :usage
  33. echo Usage:
  34. echo   %~nx0 IMAGE_FILE SOURCE_DIR
  35. echo Where:
  36. echo   IMAGE_FILE is an image file, supported by "dmimg".
  37. echo   SOURCE_DIR is a source directory to add files from.
  38. exit
  39.