diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-11-14 00:09:25 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-11-14 00:09:25 +0000 |
commit | 1b34a6af463c0f2fa8119ab6e4a5e7d36a8b5a17 (patch) | |
tree | 625c1e03ad205aae11e5c7a99701691b057f335a | |
parent | 22bdf059ebfc9ec380e11a2b1128e666ceec602d (diff) | |
download | simplepkg-1b34a6af463c0f2fa8119ab6e4a5e7d36a8b5a17.tar.gz simplepkg-1b34a6af463c0f2fa8119ab6e4a5e7d36a8b5a17.tar.bz2 |
jail-upgrade: now everything using function check_for_upgrade
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@28 04377dda-e619-0410-9926-eae83683ac58
-rwxr-xr-x | src/jail-upgrade | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/src/jail-upgrade b/src/jail-upgrade index a5803d0..578745e 100755 --- a/src/jail-upgrade +++ b/src/jail-upgrade @@ -24,20 +24,35 @@ function swaret_jail_upgrade { if [ ! -d "$PATCHES_DIR" ]; then for file in `find $PATCHES_DIR -name *tgz`; do - pack=`package_name $file` - for installed in `ls $1/var/log/packages/$pack* 2> /dev/null`; do - if [[ $pack == `package_name $installed.tgz` ]]; then - if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then - - ROOT=$1 upgradepkg $file - upgraded $pack + if check_for_upgrade $file $1; then + ROOT=$1 upgradepkg $file + upgraded $pack + fi + done + fi + if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "YES" ] || + [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then + # this option does the following: + # search all packages in the repositories and apply a patch if: + # - the package is installed + # - it hasnt already applied + # - has a different version from the current installed + # - has a different build number from the current installed + if [ -d "$STORAGE" ]; then + for file in `find $STORAGE -name *tgz`; do + pack=`package_name $file` + if check_for_upgrade $file $1; then + # the package is installed + if ! echo $UPGRADED | grep -q $pack; then + # it hasnt already applied + ROOT=$1 upgradepkg $file + upgraded $pack + fi fi - fi - done - - done + done + fi fi # clear the upgraded package list @@ -58,19 +73,11 @@ function simplaret_jail_upgrade { if [ -d "$PATCHES_DIR/$ARCH/$VERSION" ]; then for file in `find $PATCHES_DIR/$ARCH/$VERSION -name *tgz`; do - pack=`package_name $file` - for installed in `ls $1/var/log/packages/$pack* 2> /dev/null`; do - if [[ "$pack" == "`package_name $installed.tgz`" ]]; then - if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then - - ROOT=$1 upgradepkg $file - upgraded $pack - - fi - fi - done - + if check_for_upgrade $file $1; then + ROOT=$1 upgradepkg $file + upgraded $pack + fi done else echo error: cant upgrade for arch $ARCH and version $VERSION on $1: no such patch dir $PATCHES_DIR/$ARCH/$VERSION @@ -78,39 +85,25 @@ function simplaret_jail_upgrade { if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "YES" ] || [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then - # TODO: search all packages in the repositories - # apply a patch if: + # this option does the following: + # search all packages in the repositories and apply a patch if: # - the package is installed # - it hasnt already applied # - has a different version from the current installed # - has a different build number from the current installed if [ -d "$STORAGE/$ARCH/$VERSION" ]; then for file in `find $STORAGE/$ARCH/$VERSION -name *tgz`; do - pack=`package_name $file` - for installed in `ls $1/var/log/packages/$pack* 2> /dev/null`; do - if [[ "$pack" == "`package_name $installed.tgz`" ]]; then - if [[ "`basename $installed`" != "`basename $file .tgz`" ]]; then - - # the package is installed - if ! echo $UPGRADED | grep -q $pack; then - # the package isnt already applied - if [ "`package_version $file`" != "`package_version $installed.tgz`" ] || - [ "`package_build $file`" != "`package_build $installed.tgz`" ]; then - # the stored package has a different version or build number - # from the installed one; then we upgrade it - ROOT=$1 upgradepkg $file - upgraded $pack - fi - fi - - fi + if check_for_upgrade $file $1; then + # the package is installed + if ! echo $UPGRADED | grep -q $pack; then + # it hasnt already applied + ROOT=$1 upgradepkg $file + upgraded $pack fi - done - + fi done fi - true fi # clear the upgraded package list |