[Fli4l_dev] Download-Batch für Tarballs

Matthias Prager linux at matthiasprager.de
Fr Jul 18 19:15:31 CEST 2014


Hallo Mark,

vielen Dank dafür, werde ich beim nächsten Update ausprobieren!

Gruß
Matthias

Am 18.07.2014 19:07, schrieb Mark Gerber:
> Hallo Viel-Ausprobierer!
> 
> Seitdem die Tarballs (testing, FFL-506) nicht mehr auf ftp-Servern
> liegen, funktioniert das bisherige Download-Batch nicht mehr. Irgendwo
> habe ich zwar mal zwischen den Zeilen gelesen, dass da ein Ersatz in
> Arbeit sei. Jedoch bin ich ungeduldig (manuelles Herunterladen und
> entpacken - ih!) und bastele außerdem selber gerne Batches, um mir die
> Arbeit zu erleichtern.
> 
> Deswegen ist nun eine Windows-Batchdatei entstanden, die die gewünschten
> fli4l-Pakete der definierten Geschmacksrichtung (testing/FFL-506,
> x86/x86_64) von tarball.fli4l.de herunterlädt und entpackt. Verwendet
> werden dafür wget und 7-Zip (Befehlszeilenversion). Was man so braucht
> und was definiert werden muss, steht am Anfang der Batchdatei. Und dann:
> Einfach ausführen. :)
> 
> Leider weiß ich keinen besseren Weg, als die Zeilen hier im Text zu
> posten (NGs mögen keine Anhänge). Also...
> 
> 
> --- ANFANG (GetLatestDevTarball.cmd) ---
> 
> @echo off
> setlocal enabledelayedexpansion
> 
> rem ~~~ INFO ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> rem fli4l Development Tarball Downloader V1.0.0 (2014-07-15)
> rem by Mark Gerber (mark.gerber at web.de)
> 
> rem Needed additional files in local directory:
> rem - mypackages.txt
> rem   Contains the names of the additional packages
> rem   besides the fli4l base and doc packages:
> rem     * one per line
> rem     * no file name extensions (omit .tar.gz)
> rem     * possible subdirectories as prefix
> rem     * Example lines:
> rem         chrony
> rem         dhcp_client
> rem         non_gpl/kernel_3_15_nonfree
> rem         opt_db/cpmvrmlog
> rem   For available package names, see the tarball download pages on:
> rem   http://www.fli4l.de
> rem - wget.exe (wget download tool)
> rem   Links to binaries for Windows:
> rem   http://wget.addictivecode.org/FrequentlyAskedQuestions#download
> rem - 7za.exe (7-Zip command line version)
> rem   or
> rem   7z.exe + 7z.dll (command line files from 7-Zip installation)
> rem   http://www.7-zip.org
> rem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> rem ~~~ USER SETTINGS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> rem Adjust the following two settings if needed.
> rem Regard uppercase and lowercase letters.
> 
> rem Development branch: testing or FFL-506
> set Branch=testing
> 
> rem Processor architecture: x86 or x86_64
> set Archi=x86
> 
> rem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> rem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> rem Some initializations and checks
> rem ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> title fli4l Downloader
> cls
> cd /d %~dp0
> if exist TarTemp rmdir /s /q TarTemp
> 
> if not exist wget.exe goto :NoWget
> if not exist mypackages.txt goto :NoMyPack
> set SevZip=7za.exe
> if not exist %SevZip% (
>   set SevZip=7z.exe
>   for %%z in (!SevZip!,7z.dll) do if not exist %%z goto :No7z
> )
> 
> set Host=tarball.fli4l.de
> echo Checking connection to host %Host%...
> ping -n 1 %Host% | find "TTL=" > nul
> if errorlevel 1 goto :NoConnection
> echo OK
> echo.
> 
> if %Branch%==testing (
>   set RemotePath=testing
> ) else (
>   if %Branch%==FFL-506 set RemotePath=ffl506
> )
> if "%RemotePath%"=="" goto :BranchError
> if not %Archi%==x86 (
>   if not %Archi%==x86_64 goto :ArchiError
> )
> set RemotePath=%RemotePath%-%Archi%
> set WgetLine=wget.exe --quiet --timestamping %Host%/%RemotePath%
> 
> %WgetLine%/filelist.txt
> for /f "tokens=3 delims=-" %%r in (filelist.txt) do set Rev=%%r
> for /f %%f in (mypackages.txt) do (
>   set CurrPackFound=no
>   for /f %%g in (filelist.txt) do (
>     if "%%f.tar.gz"=="%%g" set CurrPackFound=yes
>   )
>   if not "!CurrPackFound!"=="yes" (
>     set FaultyPackDef=%%f
>     goto :MyPackError
>   )
> )
> del filelist.txt
> 
> echo Used branch:       %Branch%
> echo Used architecture: %Archi%
> echo Found revision:    %Rev%
> 
> 
> rem ~~~~~~~~
> rem Download
> rem ~~~~~~~~
> 
> echo.
> echo Downloading packages...
> ping -n 2 127.0.0.1 > nul
> 
> set ReposDir=Packages_%Rev%-%Branch%-%Archi%
> if exist %ReposDir% (
>   echo NOTE: The local packages repository for %Rev%-%Branch%-%Archi%
> already exists.
>   echo Going through mypackages list and downloading only new packages...
>   ping -n 6 127.0.0.1 > nul
> ) else (
>   md %ReposDir%
> )
> cd %ReposDir%
> 
> echo - fli4l-3.9.0-%Rev%-%Branch%
> ..\%WgetLine%/fli4l-3.9.0-%Rev%-%Branch%.tar.gz
> if errorlevel 1 goto :DownloadError
> echo - fli4l-3.9.0-%Rev%-%Branch%-doc
> ..\%WgetLine%/fli4l-3.9.0-%Rev%-%Branch%-doc.tar.gz
> if errorlevel 1 goto :DownloadError
> for /f %%p in (..\mypackages.txt) do (
>   echo - %%p
>   ..\%WgetLine%/%%p.tar.gz
>   if errorlevel 1 goto :DownloadError
> )
> cd ..
> 
> 
> rem ~~~~~~
> rem Unpack
> rem ~~~~~~
> 
> echo.
> echo Unpacking...
> 
> if exist fli4l-3.9.0-%Rev%-%Branch% (
>   echo NOTE: The working files of fli4l-3.9.0-%Rev%-%Branch% already exist.
>   choice /c os /n /m "[S]kip unpacking or [O]verwrite files (while
> backing up config directory)?"
>   if errorlevel 2 goto :TheEnd
>   echo Renaming current config directory to config.bak...
>   ren fli4l-3.9.0-%Rev%-%Branch%\config config.bak
> )
> 
> echo * 1st stage (all gzip packages at once)...
> %SevZip% x -oTarTemp %ReposDir%\*.tar.gz > nul
> echo * 2nd stage (each tar package)...
> echo - fli4l-3.9.0-%Rev%-%Branch%
> %SevZip% x -aoa TarTemp\fli4l-3.9.0-%Rev%-%Branch%.tar > nul
> for /r TarTemp\ %%p in (*.tar) do (
>   if not "%%~np%%~xp"=="fli4l-3.9.0-%Rev%-%Branch%.tar" (
>     echo - %%~np
>     %SevZip% x -aoa -ofli4l-3.9.0-%Rev%-%Branch%\ %%p > nul
>   )
> )
> rmdir /s /q TarTemp
> 
> echo.
> echo Finished^^!
> goto :TheEnd
> 
> 
> rem ~~~~~~~~~~~~~~
> rem Error messages
> rem ~~~~~~~~~~~~~~
> 
> :NoWget
> echo The wget tool for downloading (wget.exe) is missing.
> echo Procedure aborted.
> goto :TheEnd
> 
> :NoMyPack
> echo The list of packages to be downloaded (mypackages.txt) is missing.
> echo Procedure aborted.
> goto :TheEnd
> 
> :No7z
> echo The 7-zip tool for unpacking (7za.exe or 7z.exe + 7z.dll) is missing.
> echo Procedure aborted.
> goto :TheEnd
> 
> :NoConnection
> echo Connection could not be established.
> echo Procedure aborted.
> goto :TheEnd
> 
> :BranchError
> echo An unknown fli4l branch (%Branch%) is set in the batch file.
> echo Procedure aborted.
> goto :TheEnd
> 
> :ArchiError
> echo An unknown processor architecture (%Archi%) is set in the batch file.
> echo Procedure aborted.
> goto :TheEnd
> 
> :MyPackError
> echo An unknown package is indicated in the mypackages.txt file:
> echo %FaultyPackDef%
> echo Procedure aborted.
> goto :TheEnd
> 
> :DownloadError
> echo The last indicated package could not be downloaded.
> echo Procedure aborted.
> goto :TheEnd
> 
> 
> rem ~~~~~~~
> rem The End
> rem ~~~~~~~
> 
> :TheEnd
> echo.
> echo Press a key to close the window...
> pause > nul
> exit
> 
> --- ENDE (GetLatestDevTarball.cmd) ---
> 
> 
> Viel Erfolg und Spaß - mit der Batchdatei und mit den Tarballs.
> 
> Mark



Mehr Informationen über die Mailingliste Fli4l_dev