summaryrefslogtreecommitdiff
path: root/functions/stagefile.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-09-23 10:04:46 +0200
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:14:51 +0100
commitfe6eb1c593e2df135c8807bf94df614984b4d6ec (patch)
tree693b803dcc6473a8699f0c605c92b10c24755e28 /functions/stagefile.sh
parent470cf1764bf56b32addff591cfe3fd69af0e5760 (diff)
downloadlive-build-fe6eb1c593e2df135c8807bf94df614984b4d6ec.zip
live-build-fe6eb1c593e2df135c8807bf94df614984b4d6ec.tar.gz
Adding live-helper 1.0~a1-1.
Diffstat (limited to 'functions/stagefile.sh')
-rwxr-xr-xfunctions/stagefile.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/functions/stagefile.sh b/functions/stagefile.sh
new file mode 100755
index 0000000..23c3a34
--- /dev/null
+++ b/functions/stagefile.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# stagefile.sh - handle stage files
+
+set -e
+
+Check_stagefile ()
+{
+ STAGEFILE="${1}"
+ STAGENAME="`basename ${1}`"
+
+ # Checking stage file
+ if [ -f "${STAGEFILE}" ]
+ then
+ echo "W: skipping ${STAGENAME}"
+ exit 0
+ fi
+}
+
+Create_stagefile ()
+{
+ STAGEFILE="${1}"
+ STAGEDIRECTORY="`dirname ${1}`"
+
+ # Creating stage directory
+ if [ ! -d "${STAGEDIRECTORY}" ]
+ then
+ mkdir -p "${STAGEDIRECTORY}"
+ fi
+
+ # Creating stage file
+ touch "${STAGEFILE}"
+}
+
+Require_stagefile ()
+{
+ STAGEFILE="${1}"
+ STAGENAME="`basename ${1}`"
+
+ # Checking stage file
+ if [ ! -f "${STAGEFILE}" ]
+ then
+ echo "E: ${STAGENAME} missing"
+ exit 1
+ fi
+}