- fix in swaret upgrade method
- act recursively on patches' folder
+ simplaret:
+ - for --get, check if an already existing package
+ in the local repository has the same version and
+ build number, otherwise erase the old and download
+ the new one.
+
0.4.9pre6: createpkg:
- fixes
- now with slackbuild error handling
fi
}
+function package_version {
+
+ # get VERSION from a package name
+ local file pack version
+ file="`basename $1`"
+ pack="`package_name $1`"
+ version="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 1`"
+ echo $version
+
+}
+
+function package_arch {
+
+ # get ARCH from a package name
+ local file pack arch
+ file="`basename $1`"
+ pack="`package_name $1`"
+ arch="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 2`"
+ echo $arch
+
+}
+
+function package_build {
+
+ # get BUILD from a package name
+ local file pack build
+ file="`basename $1`"
+ pack="`package_name $1`"
+ build="`echo $file | sed -e "s/^$pack//" | cut -d "-" -f 3`"
+ echo $build
+
+}
+
function install_packages {
if [[ "$SIMPLARET_CLEAN" == "1" ]]; then
else
echo error: jail $JAIL_ROOT/$1 dont looks like a slackware system
fi
-# elif [ -f "$1" ]; then
-# basename="`basename $1 tgz`"
-# if [ "`basename $1 | sed -e "s/^$basename//"`" == "tgz" ]; then
-# # TODO:
-# # - descobrir a arquitetura do pacote
-# # - atualizar nas jaulas de mesma arquitetura
-# true
-# fi
+ elif [ -f "$1" ]; then
+ basename="`basename $1 tgz`"
+ if [ "`basename $1 | sed -e "s/^$basename//"`" == "tgz" ]; then
+ arch="`package_arch $1`"
+ # TODO
+ # - atualizar nas jaulas de mesma arquitetura
+ true
+ fi
else
echo "error: jail $0 does not exist"
exit 1
#!/bin/bash
#
-# simplaret v0.1.1: simplepkg's package grabber
+# simplaret v0.1.1: simplepkg's retrieval tool
# feedback: rhatto at riseup.net | gpl
#
# Simplaret is free software; you can redistribute it and/or modify it under the
#
# config file repos.conf:
#
-# ROOT-i386="http://slack.sarava.org/packages/slackware"
+# ROOT-i386="http://slack.sarava.org/packages/slackware/"
# REPOS-i386-10.2="slack.sarava.org%http://slack.sarava.org/packages/slackware/slackware-10.2/"
-# ROOT-x86_64="http://darkstar.ist.utl.pt/pub/slamd64/"
+# ROOT-x86_64="http://mirror1.slackadelic.com/slamd64/"
# REPOS-x86_64-10.2="slack.sarava.org%http://slack.sarava.org/packages/slamd64/slamd64-10.2/"
#
# usage:
function simplaret_get {
+ # TODO: with no parameters, update the existing packages at the local repo?
+ # support to --get package-version-arch-build.tgz or just half the name
+
# search for an already downloaded package
for file in `find $STORAGE/$ARCH/$VERSION/ -name $1*tgz 2> /dev/null`; do
candidate="`basename $file`"
if [ "`package_name $candidate`" == "$1" ]; then
- echo package $candidate already downloaded and stored at `dirname $file`
- exit 0
+ # check if has the same version and build number, otherwise erase the old one
+ for result in `simplaret_search `basename $file tgz` --silent`; do
+ if [ "`package_name $candidate`" == "`package_name $result`" ] && \
+ [ "`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
+ else
+ rm $file
+ fi
+ done
fi
done