From 8c91a53a7e86894cb21c15267d3a1836ccee27c8 Mon Sep 17 00:00:00 2001 From: Steven Penny Date: Wed, 18 Jun 2014 01:34:05 -0500 Subject: [PATCH] Write to and read from setup.rc "last-cache" and "last-mirror" will now be written to and read from setup.rc, instead of the non-standard /etc/setup/last-{cache,mirror}. --- apt-cyg | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/apt-cyg b/apt-cyg index adc7e23..0649c7b 100755 --- a/apt-cyg +++ b/apt-cyg @@ -72,19 +72,21 @@ Copyright (c) 2005-9 Stephen Jungels find-workspace () { # default working directory and mirror - mirror=http://mirrors.kernel.org/sourceware/cygwin - cache=/var/cache # work wherever setup worked last, if possible - if [ -e /etc/setup/last-cache ] - then - cache=$(cygpath -f /etc/setup/last-cache) - fi + cache=$(awk ' + /last-cache/ { + getline + print $1 + } + ' /etc/setup/setup.rc | cygpath -f-) - if [ -e /etc/setup/last-mirror ] - then - mirror=$(sed 's./$..' /etc/setup/last-mirror) - fi + mirror=$(awk ' + /last-mirror/ { + getline + print $1 + } + ' /etc/setup/setup.rc) mirrordir=$(sed ' s / %2f g s : %3a g @@ -473,12 +475,25 @@ do case "$1" in --mirror | -m) - echo "$2" > /etc/setup/last-mirror + awk -i inplace ' + 1 + /last-mirror/ { + getline + print "\t" rpc + } + ' rpc="$2" /etc/setup/setup.rc shift 2 ;; --cache | -c) - cygpath -aw "$2" > /etc/setup/last-cache + rpc=$(cygpath -aw "$2" | sed 's \\ \\\\ g') + awk -i inplace ' + 1 + /last-cache/ { + getline + print "\t" rpc + } + ' rpc="$rpc" /etc/setup/setup.rc shift 2 ;;