Enter package names in packman

This commit is contained in:
Erik van der Kouwe 2010-06-05 13:25:41 +00:00
parent 354d88f883
commit e7e6508854

View File

@ -153,7 +153,7 @@ do cd $TMPDIR
) >$TMPF ) >$TMPF
highest="`wc -l $TMPF | awk '{ print $1 - 1 }'`" highest="`wc -l $TMPF | awk '{ print $1 - 1 }'`"
awk -F'|' <$TMPF '{ printf "%3s %-15s %s\n", $1, $2, $3 }' | $PAGER awk -F'|' <$TMPF '{ printf "%3s %-15s %s\n", $1, $2, $3 }' | $PAGER
echo "Format examples: '3', '3,6', '3-9', '3-9,11-15', 'all'" echo "Format examples: '3', '3,6', '3-9', '3-9,11-15', 'all', 'gzip-1.2.4'"
echo -n "Package(s) to install (RETURN or q to exit)? " echo -n "Package(s) to install (RETURN or q to exit)? "
packnolist=`myread` packnolist=`myread`
if [ "$packnolist" = "" -o "$packnolist" = "q" ] if [ "$packnolist" = "" -o "$packnolist" = "q" ]
@ -169,6 +169,9 @@ do cd $TMPDIR
for packrange in $packnolist for packrange in $packnolist
do do
# Get a-b range. # Get a-b range.
if [ "$packrange" : '^ *[0-9]' ]
then
# If it starts with a digit, it is a range of package numbers
IFS='-' IFS='-'
set $packrange set $packrange
start=$1 start=$1
@ -177,14 +180,24 @@ do cd $TMPDIR
else end=$1 else end=$1
fi fi
IFS=' ' IFS=' '
packlist="`awk </dev/null "BEGIN { for(i=$start; i<=$end; i++) { printf \\\"%d \\\", i } }"`"
packlistno=1
else
# Otherwise it is a package name
packlist=$packrange
packlistno=0
fi
# use awk to make the range list # use awk to make the range list
for packno in `awk </dev/null "BEGIN { for(i=$start; i<=$end; i++) { printf \"%d \", i } }"` for packno in $packlist
do do
ok=y ok=y
pat="^$packno|" if [ $packlistno -eq 0 ]
then pat="^[0-9]\+|$packno|"
else pat="^$packno|"
fi
if [ "`grep -c $pat $TMPF`" -ne 1 ] if [ "`grep -c $pat $TMPF`" -ne 1 ]
then if [ "$packno" ] then if [ "$packno" ]
then echo "$packno: Wrong package number." then echo "$packno: Wrong package."
fi fi
ok=n ok=n
fi fi