Commit 7cdde317 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm pack.d/common.sh: add is_url() and add url support to install_file

parent a7c1bb33
......@@ -47,6 +47,10 @@ is_abs_path()
echo "$1" | grep -q "^/"
}
is_url()
{
echo "$1" | grep -q "^[filehtps]*:/"
}
is_dir_empty()
{
......@@ -111,9 +115,13 @@ install_file()
if is_abs_path "$dest" ; then
dest=".$dest"
fi
mkdir -p "$(dirname "$dest")" || return
cp "$src" "$dest" || return
if is_url "$src" ; then
epm tool eget -O "$dest" "$src" || fatal "Can't download $src to install to $dest"
else
cp "$src" "$dest" || return
fi
chmod 0644 "$dest"
}
......
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