diff options
Diffstat (limited to 'trunk/src/simplaret')
-rwxr-xr-x | trunk/src/simplaret | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/trunk/src/simplaret b/trunk/src/simplaret index c8cc2f7..483bba8 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -688,7 +688,7 @@ function simplaret_get { function simplaret_search_and_process_patch { - local package_version package_build installed_version + local package_version package_build installed_version pack local installed_build repos_type get is_patch package_match # get the repository type @@ -718,48 +718,41 @@ function simplaret_search_and_process_patch { fi # search if its installed in the jail - installed_packs="`ls /$root/var/log/packages/$sugested* 2> /dev/null`" - if [ ! -z "$installed_packs" ]; then - - for installed in $installed_packs; do - if [[ "$sugested" == "`package_name $installed.tgz`" ]]; then - package_installed="1" - installed_version="`package_version $installed.tgz`" - installed_build="`package_build $installed.tgz`" - break - fi - done + if grep -e "^$sugested$" $PACKAGES_TMP; then + + pack="`echo $sugested | sed -e 's/\+/\\\+/'`" + installed=`eval "ls $root/var/log/packages/ | egrep -E '^$pack-[^-]+-[^-]+-[^-]+$'"` + installed_version="`package_version $installed.tgz`" + installed_build="`package_build $installed.tgz`" get="no" - # if the package is installed, download the patch - if [ "$package_installed" == "1" ]; then - if [ "$repos_type" == "patches" ]; then + # if needed, download the patch + if [ "$repos_type" == "patches" ]; then - if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then - get="yes" - package_match="no" - elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then - get="yes" - fi + if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then + get="yes" + package_match="no" + elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then + get="yes" + fi - elif [ "$repos_type" == "root" ] && [ "$is_patch" == "yes" ]; then + elif [ "$repos_type" == "root" ] && [ "$is_patch" == "yes" ]; then - if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then - get="yes" - package_match="no" - elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then - get="yes" - fi + if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then + get="yes" + package_match="no" + elif [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then + get="yes" + fi - else - # here, we're dealing with repositories other than ROOT and REPOS, - # so we need to check if either version or build number are different, - # otherwise all installed packages would be downloaded - if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then - get="yes" - package_match="no" - fi + else + # here, we're dealing with repositories other than ROOT and REPOS, + # so we need to check if either version or build number are different, + # otherwise all installed packages would be downloaded + if [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then + get="yes" + package_match="no" fi fi @@ -781,7 +774,7 @@ function simplaret_search_and_process_patch { fi - unset package_installed get + unset get } @@ -817,6 +810,11 @@ function simplaret_get_jail_patches { echo "" fi + # installed packages at $root + PACKAGES_TMP=/tmp/simplaret_"$root"_packages.$RANDOM + rm -f $PACKAGES_TMP ; touch $PACKAGES_TMP ; chmod 600 $PACKAGES_TMP + ls -1 $root/var/log/packages/ | sed -e 's/-[^-]*-[^-]*-[^-]*$//' > $PACKAGES_TMP + echo Fetching patches for arch $ARCH and version $VERSION for jail $root # list all available patches from PATCHES and ROOT repositories @@ -837,6 +835,8 @@ function simplaret_get_jail_patches { fi + rm $PACKAGES_TMP + # restore arch and version ARCH="$oldarch" VERSION="$oldversion" |