#!/bin/bash INFILE=$1 OUTFILE=$2 if [ $# -ne 2 ] then echo "apt-offline2bat.sh INPUTFILE OUTPUTFILE" echo " This helper script creates a windows batch file out of the apt-offline sig file." echo " It is mandatory that you have a CURL installed on windows. On most updates windows" echo " systems it is intalled by default." echo " INPUTFILE is the file you created with apt-offline" echo " OUTPUTFILE is the BAT outputfile you want to run later on windows." exit 1 fi echo "@echo off" > $OUTFILE echo "mkdir bundle" >> $OUTFILE echo "cd bundle" >> $OUTFILE while IFS=' ' read -r fsrc fdest f3 do fsrc1=$(echo $fsrc | sed s/\'//g) fsrc2=$(echo $fsrc1 | sed s/%/%%/g) fdest1=$(echo $fdest | sed s/%/%%/g) fss=$(echo ${fsrc2%.*}) fsend=$(echo ${fsrc2##*.}) fdend=$(echo ${fdest1##*.}) fsfile=$(echo ${fsrc2##*/}) fsurl=$(echo ${fsrc2%/*}) fdurl=$(echo ${fdest1%_*}) if [ "$fsfile" = "InRelease" ] then echo curl %CURL_PARAM% -f $fsrc2 -o $fdest1 >> $OUTFILE echo curl %CURL_PARAM% -f $fsurl/Release -o $fdurl\_Release >> $OUTFILE echo curl %CURL_PARAM% -f $fsurl/Release.gpg -o $fdurl\_Release.gpg >> $OUTFILE elif [ "$fdend" = "$fsend" ] then echo curl %CURL_PARAM% -f $fsrc2 -o $fdest1 >> $OUTFILE else echo curl %CURL_PARAM% -f $fsrc2 -o $fdest1.$fsend >> $OUTFILE echo curl %CURL_PARAM% -f $fss.bz2 -o $fdest1.bz2 >> $OUTFILE echo curl %CURL_PARAM% -f $fss.xz -o $fdest1.xz >> $OUTFILE fi done < "$INFILE" echo "zip ..\\bundle.zip *" >> $OUTFILE echo "cd .." >> $OUTFILE echo "del bundle\\*.* /Q" >> $OUTFILE echo "rmdir bundle" >> $OUTFILE