Minor cleanup

- test commands directly instead of using temporary variable
- test command directly instead of exit variable
This commit is contained in:
Steven Penny 2014-05-14 21:20:39 -05:00
parent f4d57c9f25
commit c38e0303cd
1 changed files with 4 additions and 8 deletions

12
apt-cyg
View File

@ -322,8 +322,7 @@ case "$command" in
for pkg in $packages for pkg in $packages
do do
already=$(grep -c "^$pkg " /etc/setup/installed.db) if grep -q "^$pkg " /etc/setup/installed.db
if (( already ))
then then
echo Package $pkg is already installed, skipping echo Package $pkg is already installed, skipping
continue continue
@ -412,14 +411,12 @@ case "$command" in
echo $requires echo $requires
for package in $requires for package in $requires
do do
already=`grep -c "^$package " /etc/setup/installed.db` if grep -q "^$package " /etc/setup/installed.db
if (( already ))
then then
echo Package $package is already installed, skipping echo Package $package is already installed, skipping
continue continue
fi fi
apt-cyg install $package apt-cyg install $package || (( warn++ ))
(( $? && warn++ ))
done done
fi fi
if (( warn )) if (( warn ))
@ -445,8 +442,7 @@ case "$command" in
for pkg in $packages for pkg in $packages
do do
already=$(grep -c "^$pkg " /etc/setup/installed.db) if ! grep -q "^$pkg " /etc/setup/installed.db
if (( ! already ))
then then
echo Package $pkg is not installed, skipping echo Package $pkg is not installed, skipping
continue continue