Allow remove wget

wget is not included with base Cygwin, so I see no reason why it cannot be
removed. Worst case it can be reinstalled using setup-x86_64.exe

Also

- removed some quotes where they were not needed
- replaced a statement piping to Bash with more appropriate xargs statement
This commit is contained in:
Steven Penny 2014-05-13 23:10:36 -05:00
parent 2e6305c262
commit c585c8e893
1 changed files with 17 additions and 18 deletions

35
apt-cyg
View File

@ -345,7 +345,7 @@ case "$command" in
# look for package and save desc file # look for package and save desc file
mkdir -p "release/$pkg" mkdir -p release/"$pkg"
awk ' awk '
$1 == package { $1 == package {
desc = $0 desc = $0
@ -355,12 +355,12 @@ case "$command" in
if (px == 1 && desc) print desc if (px == 1 && desc) print desc
else print "Package not found" else print "Package not found"
} }
' RS='\n\n@ ' FS='\n' package="$pkg" setup.ini > "release/$pkg/desc" ' RS='\n\n@ ' FS='\n' package="$pkg" setup.ini > release/"$pkg"/desc
desc=$(<"release/$pkg/desc") desc=$(<release/"$pkg"/desc)
if [[ $desc = 'Package not found' ]] if [[ $desc = 'Package not found' ]]
then then
echo Package $pkg not found or ambiguous name, exiting echo Package $pkg not found or ambiguous name, exiting
rm -r "release/$pkg" rm -r release/"$pkg"
exit 1 exit 1
fi fi
echo Found package $pkg echo Found package $pkg
@ -368,7 +368,7 @@ case "$command" in
# download and unpack the bz2 or xz file # download and unpack the bz2 or xz file
# pick the latest version, which comes first # pick the latest version, which comes first
install=$(awk '/^install: / {print $2; exit}' "release/$pkg/desc") install=$(awk '/^install: / {print $2; exit}' release/"$pkg"/desc)
if (( ! ${#install} )) if (( ! ${#install} ))
then then
@ -377,7 +377,7 @@ case "$command" in
fi fi
file=`basename $install` file=`basename $install`
cd "release/$pkg" cd release/"$pkg"
wget -nc $mirror/$install wget -nc $mirror/$install
# check the md5 # check the md5
@ -389,9 +389,9 @@ case "$command" in
exit 1 exit 1
fi fi
echo "Unpacking..." echo Unpacking...
tar xvf $file -C / > "/etc/setup/$pkg.lst" tar xvf $file -C / > /etc/setup/"$pkg".lst
gzip -f "/etc/setup/$pkg.lst" gzip -f /etc/setup/"$pkg".lst
cd ../.. cd ../..
# update the package database # update the package database
@ -416,7 +416,7 @@ case "$command" in
sub(rq, "") sub(rq, "")
print print
} }
' rq='^requires: ' "release/$pkg/desc") ' rq='^requires: ' release/"$pkg"/desc)
warn=0 warn=0
if (( ${#requires} )) if (( ${#requires} ))
then then
@ -467,7 +467,7 @@ case "$command" in
echo Package $pkg is not installed, skipping echo Package $pkg is not installed, skipping
continue continue
fi fi
for req in cygwin coreutils gawk bzip2 tar wget bash for req in cygwin coreutils gawk bzip2 tar bash
do do
if [[ $pkg = $req ]] if [[ $pkg = $req ]]
then then
@ -475,7 +475,7 @@ case "$command" in
exit 1 exit 1
fi fi
done done
if [ ! -e "/etc/setup/$pkg.lst.gz" ] if [ ! -e /etc/setup/"$pkg".lst.gz ]
then then
echo Package manifest missing, cannot remove $pkg. Exiting echo Package manifest missing, cannot remove $pkg. Exiting
exit 1 exit 1
@ -484,14 +484,13 @@ case "$command" in
# run preremove scripts # run preremove scripts
if [ -e "/etc/preremove/$pkg.sh" ] if [ -e /etc/preremove/"$pkg".sh ]
then then
"/etc/preremove/$pkg.sh" /etc/preremove/"$pkg".sh
rm "/etc/preremove/$pkg.sh" rm /etc/preremove/"$pkg".sh
fi fi
gzip -cd "/etc/setup/$pkg.lst.gz" | gzip -cd /etc/setup/"$pkg".lst.gz | sed '\./$.d;s.^./.' | xargs rm -f
awk '/[^\/]$/ {print "rm -f \"/" $0 "\""}' | sh rm /etc/setup/"$pkg".lst.gz
rm "/etc/setup/$pkg.lst.gz"
rm -f /etc/postinstall/$pkg.sh.done rm -f /etc/postinstall/$pkg.sh.done
awk '$1 != pkg' pkg="$pkg" /etc/setup/installed.db > /tmp/awk.$$ awk '$1 != pkg' pkg="$pkg" /etc/setup/installed.db > /tmp/awk.$$
mv /etc/setup/installed.db /etc/setup/installed.db-save mv /etc/setup/installed.db /etc/setup/installed.db-save