Commit 4087fb81 authored by Vitaly Lipatov's avatar Vitaly Lipatov

fix and text install via url with wildcard

parent b51f3079
......@@ -99,6 +99,7 @@ epm_checkpkg()
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
#fatal "Broken package $pkg"
return $RETVAL
......
......@@ -21,8 +21,10 @@ __use_url_install()
{
case $DISTRNAME in
"ALTLinux")
# not for https
# do not support https yet
echo "$pkg_urls" | grep -q "https://" && return 1
# force download if wildcard is used
echo "$pkg_urls" | grep -q "[?*]" && return 1
pkg_names="$pkg_names $pkg_urls"
return 0
;;
......@@ -60,16 +62,21 @@ __download_pkg_urls()
local url
[ -z "$pkg_urls" ] && return
for url in $pkg_urls ; do
# TODO: use some individual tmp dir
local new_file=/tmp/$(basename "$url")
if docmd eget -O $new_file $url && [ -s "$new_file" ] ; then
pkg_files="$pkg_files $new_file"
to_remove_pkg_files="$to_remove_pkg_files $new_file"
local tmppkg=$(mktemp -d) || fatal "failed mktemp -d"
cd $tmppkg || fatal
if docmd eget "$url" ; then
local i
for i in $(basename $url) ; do
[ -s "$tmppkg/$i" ] || continue
pkg_files="$pkg_files $tmppkg/$i"
to_remove_pkg_files="$to_remove_pkg_files $tmppkg/$i"
done
else
warning "Failed to download $url, ignoring"
fi
cd - >/dev/null
done
# restore
# reconstruct
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
}
......
......@@ -150,6 +150,7 @@ local RETVAL=$?
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
return $RETVAL
}
......@@ -623,6 +623,7 @@ epm_install()
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
return $RETVAL
}
......@@ -42,7 +42,7 @@ fi
# If ftp protocol or have no asterisk, just download
# TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]\)" ; then
if echo "$1" | grep -q "^ftp://" || echo "$1" | grep -qv "[*?]" ; then
$WGET $WGET_OPTION_TARGET "$1"
exit
fi
......@@ -73,6 +73,7 @@ create_fake_files()
print_files | while read -r line ; do
touch $DIRALLFILES/$(basename "$line")
done
rm -f $INDEX
}
download_files()
......@@ -84,7 +85,7 @@ download_files()
return $ERROR
}
get_index || exit
get_index || { rm -rf "$MYTMPDIR" ; exit ; }
create_fake_files
download_files || echo "There was some download errors" >&2
rm -rf "$MYTMPDIR"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment