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`"
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)`"
# 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
# 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
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
# 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
function simplaret_distro_folder {
- # sets the distro folder
+ # set the distro folder
if [ "$ARCH" == "i386" ]; then
DISTRO="slackware"
simplaret_usage
exit 1
else
- eval_config `basename $0`
+ eval_config $BASENAME
fi
case $1 in