aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/simplaret
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-08-26 15:14:55 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-08-26 15:14:55 +0000
commit5dc3e56994dbc3d9ec72ca849987bb0d10cd7f3b (patch)
tree2f7a252522e9b3b4a39bd6241dfec0cf15cb19ce /trunk/src/simplaret
parent08f52489bae787c8cf33e08bc24a058d76fa0091 (diff)
downloadsimplepkg-5dc3e56994dbc3d9ec72ca849987bb0d10cd7f3b.tar.gz
simplepkg-5dc3e56994dbc3d9ec72ca849987bb0d10cd7f3b.tar.bz2
simplaret: enhanced search_and_process_patch
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@427 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src/simplaret')
-rwxr-xr-xtrunk/src/simplaret74
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"