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() ...@@ -99,6 +99,7 @@ epm_checkpkg()
# TODO: reinvent # TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files [ -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" #fatal "Broken package $pkg"
return $RETVAL return $RETVAL
......
...@@ -21,8 +21,10 @@ __use_url_install() ...@@ -21,8 +21,10 @@ __use_url_install()
{ {
case $DISTRNAME in case $DISTRNAME in
"ALTLinux") "ALTLinux")
# not for https # do not support https yet
echo "$pkg_urls" | grep -q "https://" && return 1 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" pkg_names="$pkg_names $pkg_urls"
return 0 return 0
;; ;;
...@@ -60,16 +62,21 @@ __download_pkg_urls() ...@@ -60,16 +62,21 @@ __download_pkg_urls()
local url local url
[ -z "$pkg_urls" ] && return [ -z "$pkg_urls" ] && return
for url in $pkg_urls ; do for url in $pkg_urls ; do
# TODO: use some individual tmp dir local tmppkg=$(mktemp -d) || fatal "failed mktemp -d"
local new_file=/tmp/$(basename "$url") cd $tmppkg || fatal
if docmd eget -O $new_file $url && [ -s "$new_file" ] ; then if docmd eget "$url" ; then
pkg_files="$pkg_files $new_file" local i
to_remove_pkg_files="$to_remove_pkg_files $new_file" 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 else
warning "Failed to download $url, ignoring" warning "Failed to download $url, ignoring"
fi fi
cd - >/dev/null
done done
# restore # reconstruct
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
} }
......
...@@ -150,6 +150,7 @@ local RETVAL=$? ...@@ -150,6 +150,7 @@ local RETVAL=$?
# TODO: reinvent # TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files [ -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 return $RETVAL
} }
...@@ -623,6 +623,7 @@ epm_install() ...@@ -623,6 +623,7 @@ epm_install()
# TODO: reinvent # TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files [ -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 return $RETVAL
} }
...@@ -42,7 +42,7 @@ fi ...@@ -42,7 +42,7 @@ fi
# If ftp protocol or have no asterisk, just download # If ftp protocol or have no asterisk, just download
# TODO: use has() # 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" $WGET $WGET_OPTION_TARGET "$1"
exit exit
fi fi
...@@ -73,6 +73,7 @@ create_fake_files() ...@@ -73,6 +73,7 @@ create_fake_files()
print_files | while read -r line ; do print_files | while read -r line ; do
touch $DIRALLFILES/$(basename "$line") touch $DIRALLFILES/$(basename "$line")
done done
rm -f $INDEX
} }
download_files() download_files()
...@@ -84,7 +85,7 @@ download_files() ...@@ -84,7 +85,7 @@ download_files()
return $ERROR return $ERROR
} }
get_index || exit get_index || { rm -rf "$MYTMPDIR" ; exit ; }
create_fake_files create_fake_files
download_files || echo "There was some download errors" >&2 download_files || echo "There was some download errors" >&2
rm -rf "$MYTMPDIR" 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