diff --git a/apt-cyg b/apt-cyg index 3cc1a9d..48d7539 100644 --- a/apt-cyg +++ b/apt-cyg @@ -133,7 +133,7 @@ function find-workspace { # default working directory and mirror # work wherever setup worked last, if possible - cache=$(awk ' + cache=$(gawk ' BEGIN { RS = "\n\\<" FS = "\n\t" @@ -145,7 +145,7 @@ function find-workspace { if [[ "$(uname -m)" == "x86_64" ]] then - mirror=$(awk ' + mirror=$(gawk ' /last-mirror/ { getline print $1 @@ -212,7 +212,7 @@ function apt-category { find-workspace for pkg in "${pks[@]}" do - awk ' + gawk ' $1 == "@" { pck = $2 } @@ -228,10 +228,10 @@ function apt-list { for pkg in "${pks[@]}" do let sbq++ && echo - awk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db + gawk 'NR>1 && $1~pkg && $0=$1' pkg="$pkg" /etc/setup/installed.db done let sbq && return - awk 'NR>1 && $0=$1' /etc/setup/installed.db + gawk 'NR>1 && $0=$1' /etc/setup/installed.db } function apt-listall { @@ -241,7 +241,7 @@ function apt-listall { for pkg in "${pks[@]}" do let sbq++ && echo - awk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini + gawk '$1~pkg && $0=$1' RS='\n\n@ ' FS='\n' pkg="$pkg" setup.ini done } @@ -266,7 +266,7 @@ function apt-show { for pkg in "${pks[@]}" do (( notfirst++ )) && echo - awk ' + gawk ' $1 == query { print fd++ @@ -284,7 +284,7 @@ function apt-depends { check-packages for pkg in "${pks[@]}" do - awk ' + gawk ' @include "join" $1 == "@" { apg = $2 @@ -318,7 +318,7 @@ function apt-rdepends { find-workspace for pkg in "${pks[@]}" do - awk ' + gawk ' @include "join" $1 == "@" { apg = $2 @@ -364,7 +364,7 @@ function download { pkg=$1 # look for package and save desc file - awk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > desc + gawk '$1 == pc' RS='\n\n@ ' FS='\n' pc=$pkg setup.ini > desc if [ ! -s desc ] then echo Unable to locate package $pkg @@ -374,7 +374,7 @@ function download { # download and unpack the bz2 or xz file # pick the latest version, which comes first - set -- $(awk '$1 == "install:"' desc) + set -- $(gawk '$1 == "install:"' desc) if (( ! $# )) then echo 'Could not find "install" in package description: obsolete package?' @@ -438,7 +438,7 @@ function apt-searchall { do printf -v qs 'text=1&arch=%s&grep=%s' $arch "$pkg" wget -O matches cygwin.com/cgi-bin2/package-grep.cgi?"$qs" - awk ' + gawk ' NR == 1 {next} mc[$1]++ {next} /-debuginfo-/ {next} @@ -471,7 +471,7 @@ function apt-install { tar -x -C / -f $bn # update the package database - awk ' + gawk ' ins != 1 && pkg < $1 { print pkg, bz, 0 ins = 1 @@ -480,14 +480,14 @@ function apt-install { END { if (ins != 1) print pkg, bz, 0 } - ' pkg="$pkg" bz=$bn /etc/setup/installed.db > /tmp/awk.$$ + ' pkg="$pkg" bz=$bn /etc/setup/installed.db > /tmp/gawk.$$ mv /etc/setup/installed.db /etc/setup/installed.db-save - mv /tmp/awk.$$ /etc/setup/installed.db + mv /tmp/gawk.$$ /etc/setup/installed.db [ -v nodeps ] && continue # recursively install required packages - requires=$(awk '$1=="requires", $0=$2' FS=': ' desc) + requires=$(gawk '$1=="requires", $0=$2' FS=': ' desc) cd ~- wr=0 if [[ $requires ]] @@ -526,7 +526,7 @@ function apt-install { function apt-remove { check-packages cd /etc - cygcheck awk bash bunzip2 grep gzip mv sed tar xz > setup/essential.lst + cygcheck gawk bash bunzip2 grep gzip mv sed tar xz > setup/essential.lst for pkg in "${pks[@]}" do @@ -542,7 +542,7 @@ function apt-remove { exit 1 fi gzip -dk setup/"$pkg".lst.gz - awk ' + gawk ' NR == FNR { if ($NF) ess[$NF] next @@ -570,7 +570,7 @@ function apt-remove { [ -d /$each ] && rmdir --i /$each done rm -f setup/"$pkg".lst.gz postinstall/"$pkg".sh.done - awk -i inplace '$1 != ENVIRON["pkg"]' setup/installed.db + gawk -i inplace '$1 != ENVIRON["pkg"]' setup/installed.db echo Package $pkg removed fi rm setup/"$pkg".lst @@ -586,7 +586,7 @@ function apt-remove { function apt-mirror { if [ "$pks" ] then - awk -i inplace ' + gawk -i inplace ' 1 /last-mirror/ { getline @@ -595,7 +595,7 @@ function apt-mirror { ' pks="$pks" /etc/setup/setup.rc echo Mirror set to "$pks". else - awk ' + gawk ' /last-mirror/ { getline print $1 @@ -608,7 +608,7 @@ function apt-cache { if [ "$pks" ] then vas=$(cygpath -aw "$pks") - awk -i inplace ' + gawk -i inplace ' 1 /last-cache/ { getline @@ -617,7 +617,7 @@ function apt-cache { ' vas="${vas//\\/\\\\}" /etc/setup/setup.rc echo Cache set to "$vas". else - awk ' + gawk ' /last-cache/ { getline print $1