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