pkg_install - bpm - changes to work with minix ftp client by Gautam Tirumala.

This commit is contained in:
Ben Gras 2010-07-26 14:02:05 +00:00
parent cf975bbc22
commit eb057107c5

View file

@ -81,13 +81,34 @@ tmpcategories=/tmp/categories.$$
tmppackages=/tmp/packages.$$ tmppackages=/tmp/packages.$$
# some base parameters # some base parameters
base=ftp://ftp.NetBSD.org/pub/pkgsrc/packages site=ftp.minix3.org
base=pub/minix/packages
release=`${unameprog} -r | ${sedprog} -e 's/_STABLE//'` release=`${unameprog} -r | ${sedprog} -e 's/_STABLE//'`
machine=`${unameprog} -m` machine=`${unameprog} -p`
sleepsecs=1 read_ftp_dir()
{
ftp_base=$1
ftp_dir=$2
${ftpprog} <<EOF
open $ftp_base
user
anonymous
cd $ftp_dir
ls
EOF
}
get_dir_entries()
{
start='150 Here comes the directory listing.'
end='226 Directory send OK.'
sed -n "/$start/,/$end/{ /$start/! {/$end/!p;}; }"
}
doit="" doit=""
sleepsecs=0
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case $1 in case $1 in
@ -111,10 +132,9 @@ while true; do
case "$category" in case "$category" in
"") # get possible categories "") # get possible categories
if [ ! -f $tmpcategories ]; then if [ ! -f $tmpcategories ]; then
${echoprog} "Downloading package categories from ${base}..." ${echoprog} "Downloading package categories from ftp://${site}/${base}..."
${echoprog} "** QUIT" > $tmpcategories ${echoprog} "** QUIT" > $tmpcategories
${echoprog} ls | ${ftpprog} ${base}/${release}/${machine}/ 2>/dev/null | \ read_ftp_dir $site $base/${release}/${machine} | get_dir_entries >> $tmpcategories
${awkprog} 'NF == 9 { if ($9 != "All") print $9 }' >> $tmpcategories
fi fi
# check for bad release numbering # check for bad release numbering
@ -143,11 +163,10 @@ while true; do
# get possible packages # get possible packages
${echoprog} "" ${echoprog} ""
${echoprog} "Downloading package names from ${base}/${category}..." ${echoprog} "Downloading package names from ftp://${site}/${base}/${category}..."
${echoprog} "** QUIT" > $tmppackages ${echoprog} "** QUIT" > $tmppackages
${echoprog} "** Change category" >> $tmppackages ${echoprog} "** Change category" >> $tmppackages
${echoprog} ls | ${ftpprog} ${base}/${release}/${machine}/${category}/ 2>/dev/null \ read_ftp_dir $site $base/${release}/${machine}/${category} | get_dir_entries >> $tmppackages
| ${awkprog} 'NF == 11 { print $9 }' >> $tmppackages
;; ;;
esac esac
@ -185,9 +204,9 @@ while true; do
# Tell people what we're doing # Tell people what we're doing
${echoprog} "" ${echoprog} ""
${echoprog} "Adding package ${base}/${release}/${machine}/${category}/${package}" ${echoprog} "Adding package ftp://${site}/${base}/${release}/${machine}/${category}/${package}"
cmd="env PKG_PATH=${base}/${release}/${machine}/All ${pkg_addprog} ${package}" cmd="${pkg_addprog} ftp://${site}/${base}/${release}/${machine}/All/${package}"
# check if we need to become root for this # check if we need to become root for this
if [ `${idprog} -u` != 0 ]; then if [ `${idprog} -u` != 0 ]; then