STORAGE="/var/simplaret/packages"
PASSIVE_FTP="1"
+# Enabling this option, jail-upgrade will look at your
+# standard repositories for new packages; if it find a package
+# with different version of your current installed package and
+# also this package isnt in the packages folder, then the new
+# package is apllied; if in doubt, just say no or leave blank.
+# Otherwise set it either to "yes" or "1"
+CONSIDER_ALL_PACKAGES_AS_PATCHES="0"
+
echo "$SIMPLARET not found, please install it before run $0"
fi
- if [ -z "PATCHES_DIR" ]; then
+ if [ -z "$PATCHES_DIR" ]; then
echo error: please adjust a value for PATCHES_DIR at $CONF
fi
+
+ CONSIDER_ALL_PACKAGES_AS_PATCHES="`echo $CONSIDER_ALL_PACKAGES_AS_PATCHES | tr '[:lower:]' '[:upper:]'`"
+ if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" != "YES" ] && \
+ [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" != "1" ]; then
+ # Enabling this option, jail-upgrade will look at your
+ # standard repositories for new packages; if it find a package
+ # with different version of your current installed package and
+ # also this package isnt in the packages folder, then the new
+ # package is apllied; if in doubt, just say no or leave blank.
+ CONSIDER_ALL_PACKAGES_AS_PATCHES="0"
+ fi
}
echo upgrading jail $1...
if [ ! -d "$PATCHES_DIR" ]; then
- # cd $PATCHES_DIR
- # for file in `ls *tgz`; do
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="$UPGRADED $pack"
fi
fi
done
done
fi
+
}
function simplaret_jail_upgrade {
fi
if [ -d "$PATCHES_DIR/$ARCH/$VERSION" ]; then
- # cd $PATCHES_DIR/$ARCH/$VERSION
- # for file in `ls *tgz`; do
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="$UPGRADED $pack"
fi
fi
done
echo error: cant upgrade for arch $ARCH and version $VERSION on $1: no such patch dir $PATCHES_DIR/$ARCH/$VERSION
fi
+ 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:
+ # - it hasnt already applied
+ # - has a different version from the current installed
+ # - has a different build number from the current installed
+ true
+ fi
+
}
if [ -f "$COMMON" ]; then
exit 1
fi
+UPGRADED=""
+
if [ -z "$1" ]; then
if [ -d "/var/log/packages" ]; then
$upgrade_method /