diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2008-12-20 17:47:07 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2008-12-20 17:47:07 +0000 |
commit | 9215fde72daf22e6f1098e914571ac79017c91e5 (patch) | |
tree | 369566c8b4cc844ffe8e249b6b89833c8be8d692 /trunk/lib | |
parent | 410130aedd6a73b9cc1f021dcd336bd5c6cb16d4 (diff) | |
download | simplepkg-9215fde72daf22e6f1098e914571ac79017c91e5.tar.gz simplepkg-9215fde72daf22e6f1098e914571ac79017c91e5.tar.bz2 |
adding initial support for Manifest files
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@691 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/lib')
-rw-r--r-- | trunk/lib/common.sh | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index a6f82bc..58cffb2 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -1186,6 +1186,7 @@ function error_codes { ERROR_PATCH=40 # patch error ERROR_VCS=41 # cvs error ERROR_MKDIR=42 # make directory error + ERROR_MANIFEST=43 # manifest error # Slackbuilds error codes ** not change ** # Commum error codes @@ -1256,6 +1257,8 @@ function handle_error { eecho $error "$BASENAME: error downloading $2 source from version control system" ;; $ERROR_MKDIR) eecho $error "$BASENAME: make directory $2 error, aborting" ;; + $ERROR_MANIFEST) + eecho $error "$BASENAME: problem with Manifest file, aborting" ;; # # General errors @@ -1413,7 +1416,7 @@ function is_the_same { function check_gnupg { - # check if there's a keyring + # setup gnupg keyring if needed # usage: check_gnupg [username] local user="$1" home @@ -1433,6 +1436,57 @@ function check_gnupg { } +function rmd160sum { + + # computes RIPEMD-160 message digest + # usage: rmd160sum <file> + + local sum file="$1" + + if [ ! -e "$file" ]; then + return 1 + fi + + sum="`openssl rmd160 $file | awk '{ print $2 }'`" + echo "$sum $file" + +} + +function gethash { + + # get a file's hash + # usage: gethash <algorithm> <file> + + if [ ! -e "$2" ]; then + return 1 + fi + + $1sum $file | awk '{ print $1 }' + +} + +function file_size { + + # get file size + # usage: filesize <file> + + if [ ! -e "$1" ]; then + return 1 + fi + + wc -c $file | awk '{ print $1 }' + +} + +function file_extension { + + # output file extension + # usage: filesize <filename> + + echo $1 | sed -e 's/.*\.\(.*\)$/\1/' + +} + function check_installed { # checks if a package is installed |