On 7/11/2011 7:30 AM, Marco Atzeri wrote:
I will look on it.
Thank you.
Btw, I have two cygwin-specific extfs, one for the setup.ini files and
one for the /etc/setup/*.lst.gz ones.
szgyg
shell/.lst.gz
Open=%cd %p#cygpack
shell/setup.ini
Open=%cd %p#cygini
BEGIN{ __skip = 1; }
/@/{
if("name" in __package) process(__package);
__skip = 0;
__empty = "";
__prefix = "";
split("", __package); // deleting array
__package["name"] = $2;
next;
}
__skip { next; }
/^\[prev\]$/{
__prefix = "prev-";
next;
}
/^[a-zA-Z]*:/{
__empty = "";
__last = __prefix substr($1,1,length($1)-1);
$1 = "";
__package[__last] = substr($0, 2);
next;
}
/^$/{
__empty = "\n";
next;
}
{
__package[__last] = __package[__last] "\n" __empty $0;
__empty = "";
}
END{ if("name" in __package) process(__package); }
#! /bin/bash
set -e
case $1 in
list)
zcat "$2" | while read i; do
case /$i in
/etc/postinstall/*.sh)
ls -l -d "/$i.done" 2>/dev/null ||
ls -l -d "/$i"
;;
*)
ls -l -d "/$i"
;;
esac
done
;;
copyout)
cp "/$3" "$4"
;;
*)
exit 1
;;
esac
#! /bin/bash
set -e
A='
BEGIN{
symlink= "lr-xr-xr-x 1 1 1 1 01-01-1970 00:00 ";
file = "-r--r--r-- 1 1 1 10000 01-01-1970 00:00 ";
dir = "dr-xr-xr-x 1 1 1 1 01-01-1970 00:00 ";
}
function basename(file, a,x) {
x = split(file,a,"/");
return a[x];
}
function process(package, a,b,i,name) {
name = package["name"];
print(dir "ALL/" name);
print(file "ALL/" name "/META");
split(package["requires"],a);
for(i in a) {
print(symlink "ALL/" name "/requires/" a[i] " -> /ALL/"
a[i]);
}
split("install source prev-install prev-source",a);
for(i in a) {
if(a[i] in package) {
split(package[a[i]],b);
print("-r--r--r-- 1 1 1 " b[2] \
" 01-01-1970 00:00 ALL/" name "/"
basename(b[1]));
}
}
split(package["category"],a);
for(i in a) {
print("lr-xr-xr-x 1 1 1 1 01-01-1970 00:00 " a[i] "/"
name " -> /ALL/" name);
}
}
'
C="$(cat $(dirname $0)/cygwin.awk)"
case $1 in
list)
awk "$A $C" "$2"
;;
copyout)
case "$3" in
*/META)
q="${3%/*}"
package=${q##*/}
sed -n "/^@ $package\$/,/^@/p" "$2" |
head -n -1 > "$4"
;;
*)
q="${3%/*}"
package=${q##*/}
file="${3##*/}"
sed -n "/^@ $package\$/,/^@/p" "$2" |
head -n -1 |
sed -n "/$file/p" |
cut -d ' ' -f 2 |
sed "s,^,$(dirname $2)/," |
xargs -I XX cp XX "$4"
;;
esac
;;
*)
exit 1
;;
esac