aboutsummaryrefslogtreecommitdiff
path: root/src/simplaret
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-01-18 01:54:06 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2007-01-18 01:54:06 +0000
commit9ed605710d1acdb16a12b47a2c83474cebd5c819 (patch)
treeab2d2593d16642d1e7aa8c9579e298c889356a86 /src/simplaret
parent46410c89229ba465a86b51fb57b2a0986f2f1732 (diff)
downloadsimplepkg-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/simplaret')
-rwxr-xr-xsrc/simplaret91
1 files changed, 24 insertions, 67 deletions
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