commit aff1990a6bebc8aadf53010260eb4235b357d0c0 Author: Steffen Pohle Date: Mon Feb 28 20:59:36 2022 +0100 first commit diff --git a/Readme b/Readme new file mode 100644 index 0000000..e69de29 diff --git a/apt-offline2bat.sh b/apt-offline2bat.sh new file mode 100644 index 0000000..21f3c62 --- /dev/null +++ b/apt-offline2bat.sh @@ -0,0 +1,54 @@ +#!/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 -f $fsrc2 -o $fdest1 >> $OUTFILE + echo curl -f $fsurl/Release -o $fdurl\_Release >> $OUTFILE + echo curl -f $fsurl/Release.gpg -o $fdurl\_Release.gpg >> $OUTFILE + elif [ "$fdend" = "$fsend" ] + then + echo curl -f $fsrc2 -o $fdest1 >> $OUTFILE + else + echo curl -f $fsrc2 -o $fdest1.$fsend >> $OUTFILE + echo curl -f $fss.bz2 -o $fdest1.bz2 >> $OUTFILE + echo curl -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 +