aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/lib/common.sh')
-rw-r--r--trunk/lib/common.sh56
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