diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-18 01:54:06 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2007-01-18 01:54:06 +0000 |
commit | 9ed605710d1acdb16a12b47a2c83474cebd5c819 (patch) | |
tree | ab2d2593d16642d1e7aa8c9579e298c889356a86 /src | |
parent | 46410c89229ba465a86b51fb57b2a0986f2f1732 (diff) | |
download | simplepkg-9ed605710d1acdb16a12b47a2c83474cebd5c819.tar.gz simplepkg-9ed605710d1acdb16a12b47a2c83474cebd5c819.tar.bz2 |
lots of changes
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@108 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src')
-rwxr-xr-x | src/mkjail | 16 | ||||
-rwxr-xr-x | src/simplaret | 91 |
2 files changed, 24 insertions, 83 deletions
@@ -16,22 +16,6 @@ # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place - Suite 330, Boston, MA 02111-1307, USA # -# Under the config file, adjust this to where your things live, for example: -# -# JAIL_ROOT="/vservers" # default folder where jails lives -# STORAGE="/var/simplaret" # place where simplaret host its packages -# SIMPLARET_CLEAN="1" # delete downloaded packages before installation -# SIMPLARET_DELETE_DOWN="1" # delete donwloaded packages after installation -# SIMPLARET_DELETE_DURING="1" # delete each package rigth after its installation -# SIMPLARET_UPDATE="0" # simplaret --update before get the packages -# SIMPLARET_PURGE_WEEKS="N" # purge cached packages older than N weeks -# PATCHES_DIR=/var/simplaret/patches" # where your patches lives -# -# todo: - list of packages that could not be installed -# - use swaret just for network mirrors -# - installation order -# - optionally execute chroot-upgrade after installation -# COMMON="/usr/libexec/simplepkg/common.sh" diff --git a/src/simplaret b/src/simplaret index c47e093..fd5a8b3 100755 --- a/src/simplaret +++ b/src/simplaret @@ -16,10 +16,16 @@ # Place - Suite 330, Boston, MA 02111-1307, USA # -SIMPLARET_CONF="/etc/simplepkg/simplepkg.conf" REPOS_CONF="/etc/simplepkg/repos.conf" COMMON="/usr/libexec/simplepkg/common.sh" +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your `basename $0` installation" + exit 1 +fi + function simplaret_usage { echo "usage: [ARCH=otherarch] [VERSION=otherversion] `basename $0` <OPTION> package-name" @@ -28,44 +34,6 @@ function simplaret_usage { } -function simplaret_eval_parameter { - - # usage: eval $1 parameter from $SIMPLARET_CONF - # return the evaluated parameter if available or $2 $3 ... $n - - if grep -qe "^$1=" $SIMPLARET_CONF; then - grep -e "^$1=" $SIMPLARET_CONF | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | awk '{ print $1 }' - else - shift - echo $* - fi - -} - -function simplaret_eval_config { - - # simplaret config file evaluation - - DEFAULT_ARCH="`simplaret_eval_parameter DEFAULT_ARCH $(default_arch)`" - DEFAULT_VERSION="`simplaret_eval_parameter DEFAULT_VERSION $(default_version)`" - STORAGE="`simplaret_eval_parameter STORAGE /var/simplaret/packages`" - PATCHES_DIR="`simplaret_eval_parameter PATCHES_DIR /var/simplaret/patches`" - PASSIVE_FTP="`simplaret_eval_parameter PASSIVE_FTP 0`" - WARNING="`simplaret_eval_parameter WARNING 0`" - ROOT_PRIORITY="`simplaret_eval_parameter ROOT_PRIORITY patches slackware extra testing pasture`" - SIMPLARET_PURGE_WEEKS="`simplaret_eval_parameter SIMPLARET_PURGE_WEEKS 0`" - CONSIDER_ALL_PACKAGES_AS_PATCHES="`simplaret_eval_parameter CONSIDER_ALL_PACKAGES_AS_PATCHES 0`" - DOWNLOAD_EVEN_APPLIED_PATCHES="`simplaret_eval_parameter DOWNLOAD_EVEN_APPLIED_PATCHES 0`" - - # now we place "patches" on the top of ROOT_PRIORITY - ROOT_PRIORITY="patches `echo $ROOT_PRIORITY | sed -e 's/patches//'`" - - # force case insensitiveness - CONSIDER_ALL_PACKAGES_AS_PATCHES="`echo $CONSIDER_ALL_PACKAGES_AS_PATCHES | tr '[:upper:]' '[:lower:]'`" - DOWNLOAD_EVEN_APPLIED_PATCHES="`echo $DOWNLOAD_EVEN_APPLIED_PATCHES | tr '[:upper:]' '[:lower:]'`" - -} - function simplaret_get_index { for file in `simplaret_metafiles`; do @@ -345,7 +313,10 @@ function simplaret_search { function simplaret_purge { - local mtime mtime_message + # purge simplaret package cache + # usage: simplaret_purge [-w N] + + local mtime mtime_message which and_patches if [ "$2" == "-w" ] && [ ! -z "$3" ]; then mtime="-mtime +`echo "$3*7" | bc -l`" @@ -358,13 +329,21 @@ function simplaret_purge { mtime_mesage="" fi + which="root repos noarch" + and_patches="" + + if [ "$SIMPLARET_PURGE_PATCHES" == "1" ]; then + which="patches $which" + and_patches="including patches" + fi + if [ -z "$SILENT" ]; then echo purging all packages $mtime_message for: - echo - arch $ARCH and version $VERSION, including patches + echo - arch $ARCH and version $VERSION $and_patches echo - noarch folder fi - for repos_type in patches root repos noarch; do + for repos_type in $which; do simplaret_set_storage_folder @@ -529,7 +508,7 @@ function simplaret_search_and_download_patch { if [ "$package_installed" == "1" ]; then if [ "$repos_type" == "patches" ]; then - if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ] || [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "yes" ]; then + if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then get="yes" elif [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then get="yes" @@ -537,7 +516,7 @@ function simplaret_search_and_download_patch { elif [ "$repos_type" == "root" ] && [ "$is_patch" == "yes" ]; then - if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ] || [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "yes" ]; then + if [ "$DOWNLOAD_EVEN_APPLIED_PATCHES" == "1" ]; then get="yes" elif [ "$package_version" != "$installed_version" ] || [ "$package_build" != "$installed_build" ]; then get="yes" @@ -607,7 +586,7 @@ function simplaret_get_jail_patches { done # grab patches from every other places - if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ] || [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "yes" ]; then + if [ "$CONSIDER_ALL_PACKAGES_AS_PATCHES" == "1" ]; then # old behaviour was just one loop: # for sugested in `simplaret_search --formatted | grep -v patches`; do @@ -680,8 +659,6 @@ function simplaret_checksum { function simplaret_install { # download and install a package - # TODO: dependency checking - # TODO: also check if repository arch version matches target jail arch and version local package root @@ -732,31 +709,11 @@ function simplaret_distro_folder { } -if [ -f "$COMMON" ]; then - source $COMMON -else - echo "error: file $COMMON found, check your `basename $0` installation" - exit 1 -fi - if [ -z "$1" ]; then simplaret_usage exit 1 else eval_config `basename $0` - simplaret_eval_config -fi - -if [ ! -d "$STORAGE" ]; then - mkdir -p $STORAGE -fi - -if [ -z "$ARCH" ]; then - ARCH="$DEFAULT_ARCH" -fi - -if [ -z "$VERSION" ]; then - VERSION="$DEFAULT_VERSION" fi case $1 in |