diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-12-10 17:08:37 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2006-12-10 17:08:37 +0000 |
commit | 8b4a99525139377d9334ff200cef331e16416617 (patch) | |
tree | 94efce2942040138ad3a885e017a8c07632d11af /lib | |
parent | 10adc76fb9d27ec744dd40c4ae069ebf5de16dce (diff) | |
download | simplepkg-8b4a99525139377d9334ff200cef331e16416617.tar.gz simplepkg-8b4a99525139377d9334ff200cef331e16416617.tar.bz2 |
common.sh: install_packages now looks first to the PATCHES_DIR folder
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@61 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common.sh | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/common.sh b/lib/common.sh index 9eb5753..fdcd5a0 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -33,6 +33,7 @@ JAIL_LIST="$BASE_CONF/jailist" # pkgtool stuff function package_name { + STRING=`basename $1 .tgz` # Check for old style package name with one segment: if [ "`echo $STRING | cut -f 1 -d -`" = "`echo $STRING | cut -f 2 -d -`" ]; then @@ -53,6 +54,7 @@ function package_name { echo $NAME fi fi + } function package_version { @@ -90,26 +92,44 @@ function package_build { function install_packages { + # check if is time to clean the local repository if [[ "$SIMPLARET_CLEAN" == "1" ]]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge elif [[ ! -z "$SIMPLARET_PURGE_WEEKS" ]] && [[ "$SIMPLARET_PURGE_WEEKS" != "0" ]]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge -w $SIMPLARET_PURGE_WEEKS fi + # now tries to install each package listed in the template for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1`; do + package_downloaded="0" if [ "$SIMPLARET" == "simplaret" ]; then extrafolder="$ARCH/$VERSION/" else unset extrafolder fi - for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do + + # first search the package in the patches folder + for file in `find $PATCHES_DIR/$extrafolder -name $pack*tgz`; do if [[ "`package_name $file`" == "$pack" ]]; then package_downloaded="1" package_file="$file" break fi done + + # then search the package in the standard packages folder + if [[ "$package_downloaded" != "1" ]]; then + for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do + if [[ "`package_name $file`" == "$pack" ]]; then + package_downloaded="1" + package_file="$file" + break + fi + done + fi + + # if the package wasnt found, try to donwload it if [[ "$package_downloaded" != "1" ]]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --get $pack -a for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do @@ -119,6 +139,8 @@ function install_packages { fi done fi + + # now tries to install the package, if available if [ -z "$package_file" ]; then echo error: could not install package $pack else @@ -146,20 +168,28 @@ function install_packages { fi fi fi + unset package_file + done + + # purge packages, if needed if [[ "$SIMPLARET_DELETE_DOWN" == "1" ]]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge fi + } function remove_packages { + for pack in `cat $TEMPLATE | grep -v -e "^#" | cut -d : -f 1`; do ROOT=/$JAIL_ROOT/$server removepkg $pack done + } function eval_config { + if [ -f "$CONF" ]; then source $CONF else @@ -220,5 +250,6 @@ function eval_config { # package is apllied; if in doubt, just say no or leave blank. CONSIDER_ALL_PACKAGES_AS_PATCHES="0" fi + } |