aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/repos.conf.new2
-rw-r--r--conf/simplepkg.conf.new7
-rw-r--r--lib/common.sh4
-rwxr-xr-xsrc/simplaret36
4 files changed, 39 insertions, 10 deletions
diff --git a/conf/repos.conf.new b/conf/repos.conf.new
index 26d4eb3..930ff80 100644
--- a/conf/repos.conf.new
+++ b/conf/repos.conf.new
@@ -16,7 +16,7 @@ NOARCH="sarava%http://slack.sarava.org/packages/noarch"
# i386 10.2
REPOS-i386-10.2="sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/"
-PATCHES-i386-10.2="sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/pacthes/"
+PATCHES-i386-10.2="sarava%http://slack.sarava.org/packages/slackware/slackware-10.2/patches/"
# x86_64 10.2
REPOS-x86_64-10.2="sarava%http://slack.sarava.org/packages/slamd64/slamd64-10.2/"
diff --git a/conf/simplepkg.conf.new b/conf/simplepkg.conf.new
index 53c4d5a..028e4d3 100644
--- a/conf/simplepkg.conf.new
+++ b/conf/simplepkg.conf.new
@@ -50,6 +50,13 @@ STORAGE="/var/simplaret/packages"
# to enable it, set to "1" or "yes"
PASSIVE_FTP="1"
+# ftp retrieval tool
+# available parameters are "wget" or "ncftpget"
+FTP_TOOL="wget"
+
+# set connection timeout in seconds
+CONNECT_TIMEOUT="20"
+
# ROOT repository package priority
ROOT_PRIORITY="patches slackware extra testing pasture"
diff --git a/lib/common.sh b/lib/common.sh
index ad02f20..aea8ba2 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -252,6 +252,8 @@ function eval_config {
PATCHES_DIR="`eval_parameter PATCHES_DIR /var/simplaret/patches`"
ROOT_PRIORITY="`eval_parameter ROOT_PRIORITY patches slackware extra testing pasture`"
SIMPLARET_PURGE_WEEKS="`eval_parameter SIMPLARET_PURGE_WEEKS 0`"
+ FTP_TOOL="`eval_parameter FTP_TOOL wget`"
+ CONNECT_TIMEOUT="`eval_parameter CONNECT_TIMEOUT 0`"
SIMPLARET_CLEAN="`eval_boolean_parameter SIMPLARET_CLEAN 1`"
SIMPLARET_DELETE_DOWN="`eval_boolean_parameter SIMPLARET_DELETE_DOWN 1`"
@@ -262,7 +264,7 @@ function eval_config {
DOWNLOAD_EVEN_APPLIED_PATCHES="`eval_boolean_parameter DOWNLOAD_EVEN_APPLIED_PATCHES 0`"
PASSIVE_FTP="`eval_boolean_parameter PASSIVE_FTP 0`"
WARNING="`eval_boolean_parameter WARNING 0`"
-
+
DEFAULT_ARCH="`eval_parameter DEFAULT_ARCH $(default_arch)`"
DEFAULT_VERSION="`eval_parameter DEFAULT_VERSION $(default_version)`"
diff --git a/src/simplaret b/src/simplaret
index 97627d6..b77322e 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -16,19 +16,20 @@
# Place - Suite 330, Boston, MA 02111-1307, USA
#
+BASERNAME="`basename $0`"
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"
+ echo "error: file $COMMON found, check your $BASENAME installation"
exit 1
fi
function simplaret_usage {
- echo "usage: [ARCH=otherarch] [VERSION=otherversion] `basename $0` <OPTION> package-name"
+ echo "usage: [ARCH=otherarch] [VERSION=otherversion] $BASENAME <OPTION> package-name"
echo -e "\t OPTIONS: --update, --upgrade, --search, --get, --get-patches, --purge, --remove"
exit 1
@@ -70,19 +71,37 @@ function simplaret_download {
# download a file from a repo to a folder
# usage: simplaret <repository_url> <package> <destination-folder>
+ local protocol
+ local wget_timeout wget_passive_ftp
+ local ncftpget_timeout ncftpget_passive_ftp
+
protocol="`echo $1 | cut -d : -f 1`"
if [ ! -d "$3" ]; then
mkdir -p $3
fi
+ if [ ! -z "$CONNECT_TIMEOUT" ] || [ "$CONNECT_TIMEOUT" != "0" ]; then
+ wget_timeout="--timeout $CONNECT_TIMEOUT"
+ ncftpget_timeout="-t $CONNECT_TIMEOUT"
+ fi
+
if [ "$protocol" == "http" ]; then
- (cd $3 && wget $1/$2)
+ (cd $3 && wget $wget_timeout $1/$2)
elif [ "$protocol" == "ftp" ]; then
if [ "$PASSIVE_FTP" == "1" ]; then
- passive_ftp="--passive-ftp"
+ wget_passive_ftp="--passive-ftp"
+ ncftpget_passive_ftp="-F"
fi
- (cd $3 && wget $passive_ftp $1/$2)
+ if [ "$FTP_TOOL" == "ncftpget" ]; then
+ (cd $3 && ncftpget $ncftpget_timeout $ncftpget_passive_ftp $1/$2)
+ elif [ "$FTP_TOOL" == "wget" ]; then
+ (cd $3 && wget $wget_timeout $wget_passive_ftp $1/$2)
+ else
+ echo $BASENAME: error: invalid value for config variable FTP_TOOL: $FTP_TOOL
+ echo $BASENAME: please check your config file $CONF
+ exit 1
+ fi
elif [ "$protocol" == "file" ]; then
url="`echo $1 | sed -e 's/file:\/\///'`"
cp $url/$2 $3 2> /dev/null
@@ -348,7 +367,7 @@ function simplaret_purge {
simplaret_set_storage_folder
for file in `find $storage/ $mtime 2> /dev/null`; do
- for extension in tgz asc meta; do
+ for extension in tgz asc meta txt; do
if echo $file | grep -qe ".$extension$"; then
rm $file
fi
@@ -486,6 +505,7 @@ function simplaret_search_and_download_patch {
# check if the patch was already downloaded
if echo "$DOWNLOADED_PATCHES" | grep -q " $ARCH:$VERSION:$sugested "; then
+ echo "jail $root needs package $sugested, but it's already downloaded, skipping donwload"
return
fi
@@ -681,7 +701,7 @@ function simplaret_install {
function simplaret_distro_folder {
- # sets the distro folder
+ # set the distro folder
if [ "$ARCH" == "i386" ]; then
DISTRO="slackware"
@@ -713,7 +733,7 @@ if [ -z "$1" ]; then
simplaret_usage
exit 1
else
- eval_config `basename $0`
+ eval_config $BASENAME
fi
case $1 in