aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/simplepkg.conf.new8
-rw-r--r--doc/CHANGELOG6
-rw-r--r--lib/common.sh2
-rwxr-xr-xsimplepkg.SlackBuild2
-rwxr-xr-xsrc/simplaret112
5 files changed, 119 insertions, 11 deletions
diff --git a/conf/simplepkg.conf.new b/conf/simplepkg.conf.new
index 51187ef..29be9fa 100644
--- a/conf/simplepkg.conf.new
+++ b/conf/simplepkg.conf.new
@@ -60,6 +60,14 @@ CONNECT_TIMEOUT="20"
# ROOT repository package priority
ROOT_PRIORITY="patches slackware extra testing pasture"
+# whether to check package signatures (you should have the repository
+# maintainer key on your keyring)
+SIGNATURE_CHECKING="0"
+
+# whether simplaret will try to solve dependencies by looking
+# for packages' slack-required
+DEPENDENCY_CHECKING="1"
+
# Enabling this option (i.e, setting to "1" or "yes"), simplaret will
# donwload even # already applied patches, a good option when you plan
# to keep local copies of all needed patches for your system
diff --git a/doc/CHANGELOG b/doc/CHANGELOG
index 5c7cc98..f4cbce3 100644
--- a/doc/CHANGELOG
+++ b/doc/CHANGELOG
@@ -2,7 +2,11 @@ simplepkg changelog
-------------------
0.4.9pre24: simplaret:
- - new config variable STORE_ROOT_PATCHES_ON_PATCHES_DIR
+ - new config variables:
+ - STORE_ROOT_PATCHES_ON_PATCHES_DIR
+ - SIGNATURE_CHECKING
+ - signature checking
+ - dependency checking through slack-required
0.4.9pre18-23: simplaret:
- enhanced http retrieval: curl support
diff --git a/lib/common.sh b/lib/common.sh
index 8292cb8..2b78c10 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -206,6 +206,8 @@ function eval_config {
SIMPLARET_PURGE_PATCHES="`eval_boolean_parameter SIMPLARET_PURGE_PATCHES 0`"
PASSIVE_FTP="`eval_boolean_parameter PASSIVE_FTP 0`"
WARNING="`eval_boolean_parameter WARNING 0`"
+ SIGNATURE_CHECKING="`eval_boolean_parameter SIGNATURE_CHECKING 0`"
+ DEPENDENCY_CHECKING="`eval_boolean_parameter DEPENDENCY_CHECKING 1`"
# Enabling this option (i.e, setting to "1" or "yes"), simplaret will
# donwload even # already applied patches, a good option when you plan
diff --git a/simplepkg.SlackBuild b/simplepkg.SlackBuild
index d0295fd..c3a392b 100755
--- a/simplepkg.SlackBuild
+++ b/simplepkg.SlackBuild
@@ -6,7 +6,7 @@
PACKAGE="simplepkg"
PACK_DIR="package-$PACKAGE"
BUILD=${BUILD:=1rha}
-VERSION="0.4.9pre23"
+VERSION="0.4.9pre24"
ARCH="noarch"
LIBEXEC="/usr/libexec/$PACKAGE"
BINDIR="/usr/bin"
diff --git a/src/simplaret b/src/simplaret
index cb676f9..3a1508e 100755
--- a/src/simplaret
+++ b/src/simplaret
@@ -439,7 +439,7 @@ function simplaret_search_and_delete {
if [ "`package_name $candidate`" == "`package_name $result`" ]; then
if [ "`package_version $candidate`" == "`package_version $result`" ] && \
[ "`package_build $candidate`" == "`package_build $result`" ]; then
- LAST_DONWLOADED_PACKAGE="$file"
+ LAST_DOWNLOADED_PACKAGE="$file"
if [ "$3" != "--silent" ]; then
echo Package $candidate already downloaded
# echo Package $candidate stored at `dirname $file`
@@ -495,7 +495,8 @@ function simplaret_get {
if [ "`package_name $candidate`" == "$1" ]; then
simplaret_repository_url
- # if repos_type == root and the package is a patch,
+ # if repos_type == root, the package is a patch and
+ # STORE_ROOT_PATCHES_ON_PATCHES_DIR config parameter is enabled
# save it on $PATCHES_DIR/root-$repository_name, so all patches
# are placed in the same tree
if [ "$repos_type" == "root" ] && \
@@ -505,16 +506,35 @@ function simplaret_get {
folder="$storage/$repository_name"
fi
+ # download the package
simplaret_download $repository_url $file $folder
+ if [ -f "$folder/$candidate.asc" ]; then
+ rm $folder/$candidate.asc
+ fi
+
+ if [ -f "$folder/$1.slack-required" ]; then
+ rm $folder/$1.slack-required
+ fi
+
+ # download the signature, if exist
+ if simplaret_check_url $repository_url/$file.asc; then
+ simplaret_download $repository_url $file.asc $folder
+ fi
+
+ # download slack-required, if exist
+ if simplaret_check_url $repository_url/`dirname $file`/$1.slack-required; then
+ simplaret_download $repository_url `dirname $file`/$1.slack-required $folder
+ fi
+
if [ ! -f "$folder/$candidate" ]; then
- LAST_DONWLOADED_PACKAGE="0"
+ LAST_DOWNLOADED_PACKAGE="0"
if [ "$2" != "--silent" ]; then
echo Error downloading $candidate from $repos_type repository $repository_url, please check your settings
fi
return 1
else
- LAST_DONWLOADED_PACKAGE="$folder/$candidate"
+ LAST_DOWNLOADED_PACKAGE="$folder/$candidate"
if [ "$2" != "--silent" ]; then
silent=""
echo Package $candidate stored at $folder
@@ -522,6 +542,9 @@ function simplaret_get {
# echo $folder/$candidate
silent="--silent"
fi
+ if [ -f "$folder/$candidate.asc" ] || [ "$SIGNATURE_CHECKING" == "1" ]; then
+ gpg --verify $folder/$candidate.asc $folder/$candidate
+ fi
simplaret_checksum $storage/$repository_name/CHECKSUMS.md5 $folder/$candidate $silent
return $?
fi
@@ -752,7 +775,7 @@ function simplaret_install {
# download and install a package
# usage: simplaret_install <package-name> [--skip-checks]
- local package root jail_arch jail_version
+ local package root jail_arch jail_version slack_required dep dependency
root="/$ROOT"
mkdir -p $root/var/log/setup/tmp
@@ -775,20 +798,35 @@ function simplaret_install {
# package="`simplaret_get $1 --silent`"
simplaret_get $1 --silent
- package="$LAST_DONWLOADED_PACKAGE"
+ package="$LAST_DOWNLOADED_PACKAGE"
if [ "$package" != "0" ] && [ ! -z "$package" ]; then
+ slack_required="`dirname $package`/$1.slack-required"
if [ -f "$package" ]; then
+
+ if [ -f "$slack_required" ] || [ "$DEPENDENCY_CHECKING" == "1" ]; then
+ # this routine checks for dependencies in package's slack-required
+ # procedure adapted from createpkg script
+ ( cat $slack_required | while read dep; do
+ if [ ! -z "$dep" ]; then
+ dependency="`echo $dep | awk '{ print $1 }'`"
+ simplaret_solve_dep $1 $dependency $root
+ fi
+ true
+ done )
+ fi
+
ROOT=$root upgradepkg --install-new $package
- LAST_DONWLOADED_PACKAGE="0"
+ LAST_DOWNLOADED_PACKAGE="0"
+
else
echo "error: could not install package $1: file not found"
- LAST_DONWLOADED_PACKAGE="0"
+ LAST_DOWNLOADED_PACKAGE="0"
return 1
fi
else
echo "error: could not install package $1"
- LAST_DONWLOADED_PACKAGE="0"
+ LAST_DOWNLOADED_PACKAGE="0"
return 1
fi
@@ -871,6 +909,53 @@ function simplaret_set_arch {
}
+function simplaret_check_url {
+
+ # check if a given url exist, use just with small files
+ # usage: simplaret_check_url <url>
+
+ if [ -z "$1" ]; then
+ return 1
+ fi
+
+ if [ ! -z "$CONNECT_TIMEOUT" ] || [ "$CONNECT_TIMEOUT" != "0" ]; then
+ curl_timeout="--connect-timeout $CONNECT_TIMEOUT"
+ fi
+
+ if [ "`curl $curl_timeout -I $1 2> /dev/null | head -n 1 | awk '{ print $2 }'`" == "200" ]; then
+ # server gave a 200 response, so the url exist
+ return 0
+ else
+ # the url is missing
+ return 1
+ fi
+
+}
+
+function simplaret_solve_dep {
+
+ # solve dependency for a package
+ # this function was adapted from createpkg script
+ # usage: simplaret_solve_dep <package-name> <package-depencency-name> [root-folder]
+
+ local installed check exit_code
+
+ local package="$1"
+ local pack="$2"
+ local root="/$3"
+
+ installed=`eval "ls $root/var/log/packages/ | egrep '^$pack-[^-]+-[^-]+-[^-]+$'"`
+ check=$?
+
+ if [ -z "$installed" ]; then
+ if [ $check -ne 0 ]; then
+ echo "$BASENAME: processing $1 dependency $pack"
+ SIMPLARET_CHILD=$SIMPLARET_CHILD simplaret --install $PACK
+ fi
+ fi
+
+}
+
if [ -z "$1" ]; then
simplaret_usage
exit 1
@@ -878,6 +963,15 @@ else
eval_config $BASENAME
fi
+# This is used to show how many children process we have
+if [ -z "$SIMPLARET_CHILD" ]; then
+ SIMPLARET_CHILD="1"
+else
+ let SIMPLARET_CHILD++
+fi
+
+BASENAME="`basename $0`[$SIMPLARET_CHILD]"
+
case $1 in
"--update" | "update") simplaret_update ;;
"--search" | "search") shift ; simplaret_search $* ;;