Commit 74bc2477 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm repo add: add support for various dir

parent 6022a8f6
...@@ -88,11 +88,39 @@ __epm_addrepo_altlinux_dir() ...@@ -88,11 +88,39 @@ __epm_addrepo_altlinux_dir()
{ {
local dir="$1" local dir="$1"
local arch local arch
local base
local url
# path to path/RPMS.addon
base="$(basename "$dir")"
if echo "$base" | grep -q "^RPMS\." ; then
REPO_NAME="$(echo $base | sed -e 's|.*\.||')"
dir="$(dirname "$dir")"
arch="$(basename $dir)"
url="file:$(dirname $dir)"
docmd epm repo add "rpm $url $arch $REPO_NAME"
return
fi
# path to a path where RPMS.addon is exists
local baseurl="$(echo $dir/RPMS.*)"
base="$(basename "$baseurl")"
if echo "$base" | grep -q "^RPMS\." ; then
REPO_NAME="$(echo $base | sed -e 's|.*\.||')"
arch="$(basename $dir)"
url="file:$(dirname $dir)"
docmd epm repo add "rpm $url $arch $REPO_NAME"
return
fi
# path to {i586,x86_64,noarch}/RPMS.addon
for arch in $(get_archlist) ; do for arch in $(get_archlist) ; do
local rd="$(echo $dir/$arch/RPMS.*)" local rd="$(echo $dir/$arch/RPMS.*)"
[ -d "$rd" ] || continue [ -d "$rd" ] || continue
local REPO_NAME="$(echo "$rd" | sed -e 's|.*\.||')" local REPO_NAME="$(echo "$rd" | sed -e 's|.*\.||')"
docmd epm repo add "rpm file:$dir $arch $REPO_NAME" url="file:$dir"
docmd epm repo add "rpm file:$url $arch $REPO_NAME"
done done
} }
...@@ -160,6 +188,12 @@ __epm_addrepo_altlinux() ...@@ -160,6 +188,12 @@ __epm_addrepo_altlinux()
return return
fi fi
if echo "$1" | grep -q "^file:/" ; then
local dir="$(echo "$1" | sed -e 's|file://*|/|')"
__epm_addrepo_altlinux_dir "$dir"
return
fi
if is_url "$1" ; then if is_url "$1" ; then
__epm_addrepo_altlinux_url "$1" __epm_addrepo_altlinux_url "$1"
return return
......
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