aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-12-08 17:56:46 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2006-12-08 17:56:46 +0000
commita13a9b7f7cbf2dfa23483caf61cb4d236d88d1ea (patch)
tree23247a692fd697d026c9787121240660277a2ec9 /src
parent38d4532edef2b23efb43a2b1cadabf820e6b1a06 (diff)
downloadsimplepkg-a13a9b7f7cbf2dfa23483caf61cb4d236d88d1ea.tar.gz
simplepkg-a13a9b7f7cbf2dfa23483caf61cb4d236d88d1ea.tar.bz2
simplaret: cleaned the code a bit
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@43 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'src')
-rwxr-xr-xsrc/simplaret39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/simplaret b/src/simplaret
index 88f5978..50eb5a7 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -177,6 +177,17 @@ function simplaret_repository_url {
}
+function simplaret_set_storage_folder {
+
+ storage="$STORAGE/$ARCH/$VERSION/$repos_type"
+ if [ "$repos_type" == "noarch" ]; then
+ storage="$STORAGE/noarch"
+ elif [ "$repos_type" == "patches" ]; then
+ storage="$PATCHES_DIR/$ARCH/$VERSION"
+ fi
+
+}
+
function simplaret_update {
local storage
@@ -188,13 +199,9 @@ function simplaret_update {
simplaret_repository_name
simplaret_repository_url
+ simplaret_set_storage_folder
- storage="$STORAGE/$ARCH/$VERSION/$repos_type"
- if [ "$repos_type" == "noarch" ]; then
- storage="$STORAGE/noarch"
- elif [ "$repos_type" == "patches" ]; then
- storage="$PATCHES_DIR/$ARCH/$VERSION"
- elif [ "$repost_type" == "root" ]; then
+ if [ "$repost_type" == "root" ]; then
repository_url="$repository_url/$DISTRO_FOLDER/$EXTRA_FOLDER"
fi
@@ -253,13 +260,7 @@ function simplaret_search {
for repos_type in patches root repos noarch; do
name="`echo $repos_type | tr '[:lower:]' '[:upper:]'`"
-
- storage="$STORAGE/$ARCH/$VERSION/$repos_type"
- if [ "$repos_type" == "noarch" ]; then
- storage="$STORAGE/noarch"
- elif [ "$repos_type" == "patches" ]; then
- storage="$PATCHES_DIR/$ARCH/$VERSION"
- fi
+ simplaret_set_storage_folder
for repository in `simplaret_repository $repos_type`; do
@@ -312,12 +313,7 @@ function simplaret_purge {
for repos_type in patches root repos noarch; do
- storage="$STORAGE/$ARCH/$VERSION/$repos_type"
- if [ "$repos_type" == "noarch" ]; then
- storage="$STORAGE/noarch"
- elif [ "$repos_type" == "patches" ]; then
- storage="$PATCHES_DIR/$ARCH/$VERSION"
- fi
+ simplaret_set_storage_folder
for file in `find $storage/ $mtime 2> /dev/null`; do
for extension in tgz asc meta; do
@@ -338,7 +334,8 @@ function simplaret_purge {
function simplaret_get {
- # TODO: with no parameters, update the existing packages at the local repo?
+ # TODO: new repository format
+ # with no parameters, update the existing packages at the local repo?
# support to --get package-version-arch-build.tgz or just half the name
# precedence: patches slackware repos noarch
# ROOT_PRIORITY
@@ -354,7 +351,7 @@ function simplaret_get {
[ "`package_version $candidate`" == "`package_version $result`" ] && \
[ "`package_build $candidate`" == "`package_build $result`" ]; then
echo package $candidate already downloaded and stored at `dirname $file`
- exit 0
+ return 0
else
rm $file
fi