diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-23 18:28:57 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-23 18:28:57 +0000 |
commit | f8b19ca2920fba5020cccaa93f29c35fc6b76e44 (patch) | |
tree | 81695a42211698c918920430db16c60538b3c828 | |
parent | 7ab3b0a5a38d54b451c22dbff54163abf42d1450 (diff) | |
download | simplepkg-f8b19ca2920fba5020cccaa93f29c35fc6b76e44.tar.gz simplepkg-f8b19ca2920fba5020cccaa93f29c35fc6b76e44.tar.bz2 |
mkjail: now install_packages uses simplaret --install
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@116 04377dda-e619-0410-9926-eae83683ac58
-rw-r--r-- | conf/simplepkg.conf.new | 4 | ||||
-rw-r--r-- | doc/CHANGELOG | 2 | ||||
-rw-r--r-- | lib/common.sh | 105 | ||||
-rwxr-xr-x | src/simplaret | 4 |
4 files changed, 26 insertions, 89 deletions
diff --git a/conf/simplepkg.conf.new b/conf/simplepkg.conf.new index 028e4d3..e1b989d 100644 --- a/conf/simplepkg.conf.new +++ b/conf/simplepkg.conf.new @@ -13,10 +13,6 @@ # where jails are placed JAIL_ROOT="/vservers" -# package grabber program (can be swaret if you have it installed) -# just change to swaret if you know what you're doing -SIMPLARET="simplaret" - # whether mkjail should clean the package cache before installation # to enable it, set to "1" or "yes" SIMPLARET_CLEAN="1" diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 97648cc..62355f0 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -5,7 +5,9 @@ simplepkg changelog - speedup - ncftpget support - timeout support + - sets the correct architecture deleted jail-upgrade + removed swaret support 0.4.9pre8: createpkg: bugfix common.sh: diff --git a/lib/common.sh b/lib/common.sh index aea8ba2..4c337e2 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -30,6 +30,7 @@ BASE_CONF="/etc/simplepkg" CONF="$BASE_CONF/simplepkg.conf" JAIL_LIST="$BASE_CONF/jailist" +SIMPLARET="simplaret" # pkgtool stuff function package_name { @@ -92,108 +93,47 @@ function package_build { function install_packages { + local check installed unable_to_install + # check if is time to clean the local repository - if [[ "$SIMPLARET_CLEAN" == "1" ]]; then + if [ "$SIMPLARET_CLEAN" == "1" ]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge - elif [[ ! -z "$SIMPLARET_PURGE_WEEKS" ]] && [[ "$SIMPLARET_PURGE_WEEKS" != "0" ]]; then + 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" + # try to install the package + ROOT=/$JAIL_ROOT ARCH=$ARCH VERSION=$VERSION $SIMPLARET --install $pack $extraoptions - if [ "$SIMPLARET" == "simplaret" ]; then - extrafolder="$ARCH/$VERSION/" - extraoptions="" - else - unset extrafolder - extraoptions="-a" - fi + # check if the package was installed + installed=`eval "ls /$JAIL_ROOT/var/log/packages/ | egrep '^$pack-[^-]+-[^-]+-[^-]+$'"` + check=$? - # 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 + if [ ! -z "$installed" ] && [ "$check" == "0" ]; then + # the package is installed + if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then + SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge 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 $extraoptions - - # it can be stored at the patches folder - for file in `find $PATCHES_DIR/$extrafolder -name $pack*tgz`; do - if [[ "`package_name $file`" == "$pack" ]]; then - package_file="$file" - break - fi - done - - # or it can be stored at the standard packages folder - if [ -z "$package_file" ]; then - for file in `find $STORAGE/$extrafolder -name $pack*tgz`; do - if [[ "`package_name $file`" == "$pack" ]]; then - package_file="$file" - break - fi - done - fi - - fi - - # now tries to install the package, if available - if [ -z "$package_file" ]; then - echo error: could not install package $pack else - installed_packs="`ls /$JAIL_ROOT/$server/var/log/packages/$pack* 2> /dev/null`" - if [ ! -z "$installed_packs" ]; then - for installed in $installed_packs; do - if [[ "$pack" == "`package_name $installed.tgz`" ]]; then - echo "package $pack already installed in $JAIL_ROOT/$server ($installed)" - package_installed="1" - break - fi - if [[ "$package_installed" != "1" ]]; then - installpkg -root /$JAIL_ROOT/$server $package_file - unset package_installed - if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then - SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge - fi - break - fi - done - else - installpkg -root /$JAIL_ROOT/$server $package_file - if [ ! -z "$SIMPLARET_DELETE_DURING" ] && [ "$SIMPLARET_DELETE_DURING" != "0" ]; then - SILENT=1 ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge - fi - fi + echo error: could not install package $pack + unable_to_install="$unable_to_install\n\t$pack" fi - unset package_file - done # purge packages, if needed - if [[ "$SIMPLARET_DELETE_DOWN" == "1" ]]; then + if [ "$SIMPLARET_DELETE_DOWN" == "1" ]; then ARCH=$ARCH VERSION=$VERSION $SIMPLARET --purge fi + if [ ! -z "$unable_to_install" ]; then + echo "mkjail was unable to install the following packages on $JAIL_ROOT:" + echo -e "$unable_to_install" + fi + } function remove_packages { @@ -246,7 +186,6 @@ function eval_config { if [ -f "$CONF" ]; then - SIMPLARET="`eval_parameter SIMPLARET simplaret`" STORAGE="`eval_parameter STORAGE /var/simplaret/packages`" JAIL_ROOT="`eval_parameter JAIL_ROOT /vservers`" PATCHES_DIR="`eval_parameter PATCHES_DIR /var/simplaret/patches`" diff --git a/src/simplaret b/src/simplaret index 7b68b60..7d9ebff 100755 --- a/src/simplaret +++ b/src/simplaret @@ -377,8 +377,8 @@ function simplaret_purge { done if [ -z "$SILENT" ]; then - echo done purging simplaret cache - echo please run simplaret --update to retrieve new package listings on this arch and version + echo $BASENAME: done purging simplaret cache + echo $BASENAME: please run $BASENAME --update to retrieve new package listings on this arch and version fi } |