[Fixed patch]Patch: Cache setup.ini for a day before redownloading

37 views
Skip to first unread message

eddieparker

unread,
Mar 8, 2011, 9:50:00 PM3/8/11
to apt-cyg-discuss
I've been regretting uploading the original patch for a while now, as
the code itself is sound but I didn't test the diff and it doesn't
patch properly. ;)

I've now rebuild it and tested the patch - it works as advertised, and
patches properly.

To install:

1) Copy and paste this patch into a file, "test.patch".
2) In the directory, in a cygwin shell, type "patch < test.patch"
2a) If this doesn't work, likely you don't have patch installed.
apt-cyg install patch. :)
3) Profit.

This is done off the svn checkout, in case it makes a difference.

Ideally this can be integrated into apt-cyg's mainline codebase, but I
don't think this mailing list is monitored any more...?

Anyhow, hopefully this helps someone else besides me. :)

Patch to follow:


Index: apt-cyg
===================================================================
--- apt-cyg (revision 18)
+++ apt-cyg (working copy)
@@ -1,4 +1,3 @@
-
#!/bin/bash

# apt-cyg: install tool for cygwin similar to debian apt-get
@@ -89,29 +88,29 @@
}


-function getsetup()
+function getsetup()
{
- if test "$noscripts" == "0" -a "$noupdate" == "0"
- then
- touch setup.ini
- mv setup.ini setup.ini-save
- wget -N $mirror/setup.bz2
- if test -e setup.bz2 && test $? -eq 0
- then
- bunzip2 setup.bz2
- mv setup setup.ini
- echo Updated setup.ini
- else
- wget -N $mirror/setup.ini
- if test -e setup.ini && test $? -eq 0
- then
- echo Updated setup.ini
- else
- mv setup.ini-save setup.ini
- echo Error updating setup.ini, reverting
- fi
- fi
- fi
+ if [ ! -f setup.ini -o $(( $(date +%s -r setup.ini) + 86400 )) -lt $
(date +%s) ]; then
+ if test "$noscripts" == "0" -a "$noupdate" == "0" then
+ touch setup.ini
+ mv setup.ini setup.ini-save
+ wget -N $mirror/setup.bz2
+
+ if test -e setup.bz2 && test $? -eq 0 then
+ bunzip2 setup.bz2
+ mv setup setup.ini
+ echo Updated setup.ini
+ else
+ wget -N $mirror/setup.ini
+ if test -e setup.ini && test $? -eq 0 then
+ echo Updated setup.ini
+ else
+ mv setup.ini-save setup.ini
+ echo Error updating setup.ini, reverting
+ fi
+ fi
+ fi
+ fi
}


Reply all
Reply to author
Forward
0 new messages