summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaronmgriffin@gmail.com>2008-09-02 07:01:03 +0200
committerAaron Griffin <aaronmgriffin@gmail.com>2008-09-02 07:01:03 +0200
commit29095faf6fa2d01e65fbfebe4702ae240d1688b6 (patch)
treed64c33fbdae3d0b688d38f2706e7e9f20f9919d4
parent766727fa10cbc2715baba93437fbb30b798f08c9 (diff)
downloaddbscripts-29095faf6fa2d01e65fbfebe4702ae240d1688b6.tar.gz
dbscripts-29095faf6fa2d01e65fbfebe4702ae240d1688b6.tar.xz
Forgot the db-functions file. Whoops
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
-rw-r--r--db-functions48
1 files changed, 48 insertions, 0 deletions
diff --git a/db-functions b/db-functions
new file mode 100644
index 0000000..bcc25bb
--- /dev/null
+++ b/db-functions
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# Random integrity things
+[ "$UID" = "" ] && UID=$(uid)
+
+# Useful functions
+source_makepkg () {
+ if [ -f "/etc/makepkg.conf" ]; then
+ #Get some config info
+ . /etc/makepkg.conf
+ else
+ echo "/etc/makepkg.conf does not exist!"
+ exit 1
+ fi
+}
+
+repo_lock () { #repo_lock repo-name arch
+ LOCKFILE="/tmp/.repolck.$1.$2"
+ if [ -f "$LOCKFILE" ]; then
+ owner="$(/usr/bin/stat -c %U $LOCKFILE)"
+ echo "error: db generation is already in progress (started by $owner)"
+ exit 1
+ else
+ /bin/touch "$LOCKFILE"
+ fi
+}
+
+repo_unlock () { #repo_unlock repo-name arch
+ LOCKFILE="/tmp/.repolck.$1.$2"
+ if [ ! -f "$LOCKFILE" ]; then
+ echo "error: repo lock doesn't exist... something went terribly wrong!"
+ else
+ rm -f "$LOCKFILE"
+ fi
+}
+
+# Get the package name from the filename
+# hackish, but should work for now
+getpkgname() {
+ local tmp
+
+ tmp=${1##*/}
+ tmp=${tmp%$PKGEXT}
+ tmp=${tmp%-$CARCH}
+ echo ${tmp%-*-*}
+}
+
+# vim: set ts=4 sw=4 noet ft=sh: