From: Heiko Z. <smi...@us...> - 2010-11-06 21:36:54
|
Update of /cvsroot/devil-linux/build/scripts/scripts In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv12161/scripts/scripts Modified Files: install-on-usb.bat Added Files: install-on-usb.exe Log Message: updated windows version of install-usb and added executable version --- NEW FILE: install-on-usb.exe --- (This appears to be a binary file; contents omitted.) Index: install-on-usb.bat =================================================================== RCS file: /cvsroot/devil-linux/build/scripts/scripts/install-on-usb.bat,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- install-on-usb.bat 4 Nov 2010 18:10:12 -0000 1.2 +++ install-on-usb.bat 6 Nov 2010 21:36:46 -0000 1.3 @@ -1,3 +1,23 @@ +ECHO OFF +REM QBFC Project Options Begin +REM HasVersionInfo: Yes +REM Companyname: DEVIL-LINUX +REM Productname: winstall-on-usb +REM Filedescription: Devil-Linux USB Windows Installer Program +REM Copyrights: +REM Trademarks: +REM Originalname: install-on-usb.bat +REM Comments: coded by Dominic +REM Productversion: 0. 0. 0. 0 +REM Fileversion: 0. 5. 0. 0 +REM Internalname: +REM Appicon: devil-linux.ico +REM Embeddedfile: fart.exe +REM Embeddedfile: syslinux.exe +REM QBFC Project Options End +ECHO ON +ECHO OFF +ECHO OFF @ECHO OFF : Devil-Linux Windows USB Installer @@ -18,21 +38,29 @@ : Rev 0.3a 2010-11-01 - made it work as bare system no auto-drive searching and copy progress : - best using it by dragging the drive icon on top of this batchfile : - or by using as a command line tool, specifying the drive as parameter -: Rev 0.4b 2010-11-01 - restore copy with progress indicator +: Rev 0.4b 2010-11-01 - restore copy-with-progress indicator : - prevent run if a file rather than a drive has been specified : - tidy messages, add colour, check for admin privileges : Rev 0.4c 2010-11-03 - tiny but critical bugfix +: Rev 0.5 2010-11-04 - adjustments to work also as exe, compiled with QuickBatchFileCompiler +: - removed (again!) copy-with-progress (does not work when compiled) -SETLOCAL ENABLEDELAYEDEXPANSION +SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION CLS COLOR 1F ECHO. ECHO %~nx0 ECHO. - +IF "%MYFILES%" == "" ( + SET FILELOC=%~dp0 + SET COMPILED=n +) ELSE ( + SET FILELOC=%MYFILES%\ + SET COMPILED=y +) REM check for presence of drive specification IF "%1"=="" GOTO :help -SET DRIVE=%1 +SET DRIVE=%~1 REM check for presence of colon IF "%DRIVE:~1,1%" NEQ ":" SET FATALERR=y&ECHO You must specify a drive as parameter e.g. F:>&2 REM check that it is only a drive that has been specified, not a file @@ -43,26 +71,26 @@ IF /I "%DRIVE%"=="c:" SET FATALERR=y&ECHO You cannot install to drive C:>&2 REM originating drive not allowed IF /I "%DRIVE%"=="%~d0" SET FATALERR=y&ECHO You cannot install to the drive you are running from ^(%DRIVE%^)>&2 - REM check for presence of required files IF "%2" NEQ "" ( SET ZIPEXE=%2\7z.exe ) ELSE ( SET ZIPEXE=C:\PROGRA~1\7-Zip\7z.exe - IF NOT EXIST "!ZIPEXE!" ( - SET ZIPEXE=C:\PROGRA~2\7-Zip\7z.exe - IF NOT EXIST "!ZIPEXE!" ( - ECHO Can't locate 7z.exe, please obtain and install 7-Zip from http://www.7-zip.org>&2 - ECHO or, if already installed, provide path to 7z.exe as parameter>&2 - GOTO :erredexit - ) - ) ) -IF NOT EXIST "%~dp0fart.exe" SET FATALERR=y & ECHO Can't locate fart.exe, obtain this from SourceForge>&2 -IF NOT EXIST "%~dp0syslinux.exe" SET FATALERR=y & ECHO Can't locate syslinux.exe, obtain this by extracting from the latest syslinux release at kernel.org>&2 +IF NOT EXIST "%ZIPEXE%" SET ZIPEXE=C:\PROGRA~2\7-Zip\7z.exe +IF NOT EXIST "%ZIPEXE%" ( + ECHO Can't locate 7z.exe, please obtain and install 7-Zip from http://www.7-zip.org>&2 + ECHO or, if already installed, provide path to 7z.exe as 2nd parameter>&2 + GOTO :erredexit +) +IF NOT EXIST "%FILELOC%fart.exe" SET FATALERR=y & ECHO Can't locate fart.exe, obtain this from SourceForge>&2 +IF NOT EXIST "%FILELOC%syslinux.exe" SET FATALERR=y & ECHO Can't locate syslinux.exe, obtain this by extracting from the latest syslinux release at kernel.org>&2 IF NOT EXIST "%~dp0bootcd.iso" SET FATALERR=y & ECHO Can't locate bootcd.iso>&2 REM end if there was a fatal error -IF "%FATALERR%" NEQ "" ECHO Aborting, for help run without parameters>&2&GOTO :erredexit +IF NOT "%FATALERR%" == "" ( + ECHO Aborting, for help run without parameters>&2 + GOTO :erredexit +) REM check that we have administrator privileges, this is a kludge but it works... IF EXIST "%windir%\system32\%~nx0-test\nul" RMDIR "%windir%\system32\%~nx0-test" MKDIR "%windir%\system32\%~nx0-test" 2>nul @@ -71,7 +99,6 @@ REM start with a clean %TEMP%\boot directory RMDIR /S /Q "%TEMP%\boot\" 2>nul MKDIR "%TEMP%\boot\" 2>nul - REM extract 3 small files immediately - we need them later anyway, REM getting them now allows us to extract DL version "%ZIPEXE%" e "%~dp0bootcd.iso" -o"%TEMP%\boot" DEVIL-LINUX LICENSE isolinux.cfg>nul @@ -79,7 +106,6 @@ REN "%TEMP%\boot\isolinux.cfg" syslinux.cfg IF ERRORLEVEL 1 GOTO :erred SET /P DLVER=""<"%TEMP%\boot\DEVIL-LINUX" - ECHO This will make %DRIVE% into Devil-Linux %DLVER% boot disk ECHO Please choose configuration: ECHO [1] Clean installation @@ -122,10 +148,10 @@ IF ERRORLEVEL 1 ECHO Error extracting shadow>&2&&GOTO :erred PUSHD "%TEMP%\boot\config" REM switch on sshd -"%~dp0fart.exe" -q -- "etc-mods\sysconfig\config" "START_SSHD=no" "START_SSHD=yes" +"%FILELOC%fart.exe" -q -- "etc-mods\sysconfig\config" "START_SSHD=no" "START_SSHD=yes" IF "%ERRORLEVEL%" NEQ "1" ECHO Unable to set SSHD to operate at start-up>&2&&GOTO :erred REM set 'devil' password -"%~dp0fart.exe" -q -- "etc-mods\shadow" "$1$JHH/CiJE$nDKJJh2hEmE8x2VePkyVP/" "$1$Jrgbm29u$TzBgorXoLccnRS23WWvq10" +"%FILELOC%fart.exe" -q -- "etc-mods\shadow" "$1$JHH/CiJE$nDKJJh2hEmE8x2VePkyVP/" "$1$Jrgbm29u$TzBgorXoLccnRS23WWvq10" IF "%ERRORLEVEL%" NEQ "1" ECHO Unable to set root password>&2&&GOTO :erred REM create autoselect eth0 dhcp network MKDIR "etc-mods\sysconfig\nic\">nul @@ -138,7 +164,7 @@ ECHO BROADCAST=>>etc-mods\sysconfig\nic\ifcfg-eth0 ECHO ROUTE=>>etc-mods\sysconfig\nic\ifcfg-eth0 REM remove CRs from files -"%~dp0fart.exe" -q -C --remove -- "etc-mods\shadow","etc-mods\sysconfig\nic\ifcfg-eth0" "\r" +"%FILELOC%fart.exe" -q -C --remove -- "etc-mods\shadow","etc-mods\sysconfig\nic\ifcfg-eth0" "\r" IF %ERRORLEVEL% EQU 0 GOTO :erred REM add/update files in etc-mods.tar "%ZIPEXE%" u etc-mods.tar etc-mods\sysconfig\config etc-mods\sysconfig\nic\ifcfg-eth0 etc-mods\shadow>nul @@ -153,7 +179,7 @@ :skip_mod_config ECHO Configuring files -"%~dp0fart.exe" --remove -q -- "%TEMP%\boot\syslinux.cfg","%TEMP%\boot\message" "/boot/" +"%FILELOC%fart.exe" --remove -q -- "%TEMP%\boot\syslinux.cfg","%TEMP%\boot\message" "/boot/" REM fart.exe uses ERRORLEVEL to report number of changes: at time of writing there are 21 file changes, but allow some latitude IF %ERRORLEVEL% LSS 12 (SET ERRORLEVEL=1&&GOTO :erred) ELSE IF %ERRORLEVEL% GEQ 30 SET ERRORLEVEL=1&&GOTO :erred @@ -174,35 +200,32 @@ IF ERRORLEVEL 1 CHKDSK %DRIVE%&GOTO :erredexit SET /P "dummyvar=Installing Syslinux MBR and BootSector on %DRIVE%... "<nul -"%~dp0syslinux" -ma %DRIVE% +"%FILELOC%syslinux" -ma %DRIVE% IF ERRORLEVEL 1 GOTO :erred ECHO done -SET /P "dummyvar=Copying files to %DRIVE%, may take a few minutes"<nul +SET /P "dummyvar=Copying files to %DRIVE%"<nul REM xcopy does not work to USB drive under Vista, and we don't need the subdirectories anyway COPY "%TEMP%\boot" %DRIVE%\>nul IF ERRORLEVEL 1 GOTO :erred SET /P "dummyvar=."<nul - REM for ease of maintenance put usb-install files on USB too COPY "%~dp0*usb*" %DRIVE%\>nul IF ERRORLEVEL 1 GOTO :erred SET /P "dummyvar=."<nul COPY "%~dp0*.exe" %DRIVE%\>nul IF ERRORLEVEL 1 GOTO :erred -SET /P "dummyvar=."<nul - +ECHO . done REM put bootcd.iso file on drive, CopyWithProgress provides progress indicator -Call :CopyWithProgress "%~dp0bootcd.iso" %DRIVE% -IF ERRORLEVEL 1 ( +REM Call :CopyWithProgress "%~dp0bootcd.iso" %DRIVE% +REM IF ERRORLEVEL 1 ( REM if CopyWithProgress failed then try with an ordinary COPY - ECHO. - ECHO Copying large file: bootcd.iso, PLEASE BE PATIENT... + SET /P "dummyvar=Copying large file bootcd.iso to %DRIVE%, please be patient..."<nul copy "%~dp0bootcd.iso" %DRIVE% - IF ERRORLEVEL 1 GOTO :erred -) ELSE ( - ECHO . done -) +REM IF ERRORLEVEL 1 GOTO :erred +REM ) ELSE ( + ECHO done +REM ) SET /P "dummyvar=Deleting temporary files.."<nul RMDIR /S /Q "%TEMP%\boot" 2>nul @@ -216,27 +239,26 @@ IF %ERRORLEVEL% NEQ 0 GOTO :erred ECHO. -ECHO Success! %DRIVE% contains bootable Devil-Linux %DLVER% with %CONFIG%. +ECHO Success^! %DRIVE% contains bootable Devil-Linux %DLVER% with %CONFIG%. GOTO :end -:CopyWithProgress -:: Copy, displaying progress dots -SETLOCAL ENABLEDELAYEDEXPANSION -SET Flagfile=%TEMP%\%RANDOM%.tmp -IF EXIST %Flagfile% DEL %Flagfile% -START /MIN COPY %* ^& ECHO.^>%Flagfile% ^& EXIT -SET LOOP=0 -:Pcopy -IF EXIST %Flagfile% Goto :EOF -::Show a period -REM SET /P dummyvar=!LOOP!<NUL -SET /P dummyvar=.<NUL -::Wait c.3 secs -ping -n 6 localhost > NUL -::Loop counter should not exceed 100 i.e. c.5 minutes -SET /A LOOP=!LOOP!+1 -IF %LOOP% GTR 100 EXIT /B 1 -GOTO Pcopy +REM :CopyWithProgress +REM :: Copy, displaying progress dots +REM SETLOCAL ENABLEDELAYEDEXPANSION +REM SET Flagfile=%TEMP%\%RANDOM%.tmp +REM IF EXIST %Flagfile% DEL %Flagfile% +REM START /MIN COPY %* ^& ECHO.^>%Flagfile% ^& EXIT +REM SET LOOP=0 +REM :Pcopy +REM IF EXIST %Flagfile% Goto :EOF +REM ::Show a period +REM SET /P dummyvar=.<NUL +REM ::Wait c.3 secs +REM ping -n 6 localhost > NUL +REM ::Loop counter should not exceed 100 i.e. c.5 minutes +REM SET /A LOOP=!LOOP!+1 +REM IF %LOOP% GTR 100 EXIT /B 1 +REM GOTO Pcopy :erred ECHO.>&2 @@ -250,20 +272,25 @@ EXIT /B 1 :help -ECHO This formats and provisions a USB drive as a Devil-Linux boot disk. +ECHO This formats and provisions USB drive as Devil-Linux boot disk. ECHO. -ECHO Usage : %~nx0 DRIVE:[\] [7z.exe-location] -ECHO Dependencies: 7-Zip, syslinux.exe (32bit), fart.exe +ECHO Usage (1) : drag'n'drop USB drive onto %~nx0 +ECHO (2) : %~nx0 DRIVE:[\] [7z.exe-location] +ECHO. +IF "%COMPILED%" == "y" ( + ECHO Dependencies: 7-Zip, bootcd.iso +) ELSE ( + ECHO Dependencies: 7-Zip, syslinux.exe ^(32bit^), fart.exe, bootcd.iso +) ECHO Tested on : Windows XP / Vista / 7 32/64-bit ECHO. -ECHO Notes : Easy start - drag'n'drop USB drive onto %~nx0. -ECHO Must be run as administrator / with admin privleges +ECHO Notes : Must be run as administrator / with admin privileges. +ECHO bootcd.iso must be in same location as %~nx0. ECHO You are prompted before changes are committed to USB drive. -ECHO The USB drive cannot be drive C: ECHO 1st or only partition of USB drive is (re)formatted, but any -ECHO existing 2nd partition on USB drive (e.g. holding existing DL -ECHO configuration) is not changed. +ECHO existing 2nd partition on USB drive (e.g. holding existing +ECHO Devil-Linux configuration) is not changed. ECHO 7z.exe-location does not normally need to be specified. ECHO. :end -PAUSE \ No newline at end of file +PAUSE |