Browse Source

Fix bugs!

Douglas William Thrift 14 years ago
parent
commit
4748ce5b44
1 changed files with 6 additions and 3 deletions
  1. 6 3
      apt-p2p-clean

+ 6 - 3
apt-p2p-clean

@@ -45,7 +45,7 @@ function version()
 }
 
 program=`basename $0`
-version='1.0.2'
+version='1.0.3'
 apt_p2p_cache='/var/cache/apt-p2p/cache'
 _apt_p2p_cache="$apt_p2p_cache"
 apt_archive='/var/cache/apt/archives'
@@ -113,10 +113,13 @@ find "$apt_p2p_cache" -name '*.deb' | (
 		_deb="${_deb//%7e/~}"
 
 		if [[ ! -f "$apt_archive/$_deb" ]]; then
-			_deb=`dpkg-deb -W --showformat='${Package}_${Version}_${Architecture}.deb' $deb`
+			if dpkg-deb -W $deb >/dev/null 2>&1; then
+				_deb=`dpkg-deb -W --showformat='${Package}_${Version}_${Architecture}.deb' $deb`
+			fi
 
 			if [[ ! -f "$apt_archive/${_deb//:/%3a}" ]]; then
-				((freed += `du -B 1 $deb | cut -f 1`))
+				# XXX: '|| true' because bash believes ((freed += 0)) is bad
+				((freed += `du -B 1 $deb | cut -f 1`)) || true
 
 				echo " $_deb"