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}.
This commit is contained in:
parent
12f39475ab
commit
8c91a53a7e
39
apt-cyg
39
apt-cyg
|
@ -72,19 +72,21 @@ Copyright (c) 2005-9 Stephen Jungels
|
||||||
|
|
||||||
find-workspace () {
|
find-workspace () {
|
||||||
# default working directory and mirror
|
# default working directory and mirror
|
||||||
mirror=http://mirrors.kernel.org/sourceware/cygwin
|
|
||||||
cache=/var/cache
|
|
||||||
|
|
||||||
# work wherever setup worked last, if possible
|
# work wherever setup worked last, if possible
|
||||||
if [ -e /etc/setup/last-cache ]
|
cache=$(awk '
|
||||||
then
|
/last-cache/ {
|
||||||
cache=$(cygpath -f /etc/setup/last-cache)
|
getline
|
||||||
fi
|
print $1
|
||||||
|
}
|
||||||
|
' /etc/setup/setup.rc | cygpath -f-)
|
||||||
|
|
||||||
if [ -e /etc/setup/last-mirror ]
|
mirror=$(awk '
|
||||||
then
|
/last-mirror/ {
|
||||||
mirror=$(sed 's./$..' /etc/setup/last-mirror)
|
getline
|
||||||
fi
|
print $1
|
||||||
|
}
|
||||||
|
' /etc/setup/setup.rc)
|
||||||
mirrordir=$(sed '
|
mirrordir=$(sed '
|
||||||
s / %2f g
|
s / %2f g
|
||||||
s : %3a g
|
s : %3a g
|
||||||
|
@ -473,12 +475,25 @@ do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
|
||||||
--mirror | -m)
|
--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
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
--cache | -c)
|
--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
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue