>From 99267a5f66b77bcd85ebbe21a021ac2c9afc13a5 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Fri, 25 Nov 2011 13:45:03 +0200 Subject: [PATCH] initinstall.d/90-pkg.sh: fallback to remote repo It is possible to build an image with propagator and install2 but without accompanying package base; refactored detection so that a fallback to remote repos is performed if no local repository root is at hand. We should actually consider fixing this up so updates repo can be used right for the installation if online (or LAN) access is available BUT the network is currently only available for http/ftp methods... --- alterator-pkg/initinstall.d/90-pkg.sh | 40 ++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 15 deletions(-) diff --git a/alterator-pkg/initinstall.d/90-pkg.sh b/alterator-pkg/initinstall.d/90-pkg.sh index 00f54ef..d826fca 100755 --- a/alterator-pkg/initinstall.d/90-pkg.sh +++ b/alterator-pkg/initinstall.d/90-pkg.sh @@ -43,23 +43,33 @@ get_comps() return $ret } +local_comps() +{ + url="file:$image_dir" + comps="$(find "$image_dir"/ALTLinux \ + -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' | + sed -e 's/^RPMS\.//' | + tr '\n' ' ')" + [ -d "$image_dir"/ALTLinux ] +} + +remote_comps() +{ + url="$image_url" + if get_comps "$url/ALTLinux/base/release" ; then + comps="$(cat "$release_file" | + sed -n -e '/\/release\./p' | + sed -e 's/.*\.//' | + tr '\n' ' ')" + else + comps="main" + fi +} + # create sources.list case "$METHOD" in - cdrom|disk|nfs) - url="file:$image_dir" - comps="$(find "$image_dir"/ALTLinux \ - -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' | - sed -e 's/^RPMS\.//' | - tr '\n' ' ')" - ;; - http|ftp) - url="$image_url" - if get_comps "$url/ALTLinux/base/release" ; then - comps="$(cat "$release_file" | sed -n -e '/\/release\./p' | sed -e 's/.*\.//' | tr '\n' ' ')" - else - comps="main" - fi - ;; + cdrom|disk|nfs) local_comps || remote_comps;; + http|ftp) remote_comps;; esac printf 'rpm %s ALTLinux %s\n' "$url" "${comps% }" >/etc/apt/sources.list -- 1.7.7.3