summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-02-16 12:29:01 +0100
committerPaul Buetow (mars.fritz.box) <paul@buetow.org>2014-02-16 12:29:01 +0100
commitac808ecf232e1985d1fb2121691f23f94c5f2ecf (patch)
treef5ba4667bc2dff0fe1c5ad3731294a1e88c99b4b
parenta0f45c9e97570bea83001c8106b5847723e8a863 (diff)
add optional custom rcfile path
-rw-r--r--Makefile2
-rw-r--r--docs/photoalbum.18
-rw-r--r--docs/photoalbum.pod6
-rw-r--r--docs/photoalbum.txt5
-rwxr-xr-xsrc/photoalbum.sh12
5 files changed, 25 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index dfcd5b2..71e0e11 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ install:
test ! -d $(DESTDIR)/usr/bin && mkdir -p $(DESTDIR)/usr/bin || exit 0
cp ./bin/* $(DESTDIR)/usr/bin
test ! -d $(DESTDIR)/usr/share/photoalbum/templates && mkdir -p $(DESTDIR)/usr/share/photoalbum/templates || exit 0
- cp ./share/templates/* $(DESTDIR)/usr/share/photoalbum/templates
+ cp -R ./share/templates $(DESTDIR)/usr/share/photoalbum/
test ! -d $(DESTDIR)/etc/default && mkdir -p $(DESTDIR)/etc/default || exit 0
cp ./src/photoalbum.default.conf $(DESTDIR)/etc/default/photoalbum
deinstall:
diff --git a/docs/photoalbum.1 b/docs/photoalbum.1
index 3673404..cddbf32 100644
--- a/docs/photoalbum.1
+++ b/docs/photoalbum.1
@@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "PHOTOALBUM 1"
-.TH PHOTOALBUM 1 "2013-12-29" "photoalbum 0.2.3" "User Commands"
+.TH PHOTOALBUM 1 "2014-02-16" "photoalbum 0.2.3" "User Commands"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -133,7 +133,7 @@
photoalbum \- photoalbum is a minimal bash script for linux to generate static web photo albums.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
-photoalbum [clean|init|version|generate|all]
+photoalbum clean|init|version|generate|all [rcfile]
.IP "clean" 4
.IX Item "clean"
Cleans up the working space
@@ -149,6 +149,8 @@ Generates the static photoalbum
.IP "all" 4
.IX Item "all"
This just runs 'clean init generate' right after another.
+.SS "\s-1RCFILE\s0"
+.IX Subsection "RCFILE"
.SS "\s-1TUTORIAL\s0"
.IX Subsection "TUTORIAL"
* See if /etc/default/photoalbum fits your needs. If not, copy /etc/default/photoalbum to ~/.photoalbumrc in order to customize it.
@@ -163,6 +165,8 @@ This just runs 'clean init generate' right after another.
.PP
* Clean the mess up with 'photoalbum clean'
.PP
+It is possible to specify a custom rcfile path too.
+.PP
\fI\s-1HTML\s0 \s-1TEMPLATES\s0\fR
.IX Subsection "HTML TEMPLATES"
.PP
diff --git a/docs/photoalbum.pod b/docs/photoalbum.pod
index a56fe3b..791de48 100644
--- a/docs/photoalbum.pod
+++ b/docs/photoalbum.pod
@@ -4,7 +4,7 @@ photoalbum - photoalbum is a minimal bash script for linux to generate static we
=head1 SYNOPSIS
-photoalbum [clean|init|version|generate|all]
+photoalbum clean|init|version|generate|all [rcfile]
=over
@@ -30,6 +30,8 @@ This just runs 'clean init generate' right after another.
=back
+=head2 RCFILE
+
=head2 TUTORIAL
* See if /etc/default/photoalbum fits your needs. If not, copy /etc/default/photoalbum to ~/.photoalbumrc in order to customize it.
@@ -44,6 +46,8 @@ This just runs 'clean init generate' right after another.
* Clean the mess up with 'photoalbum clean'
+It is possible to specify a custom rcfile path too.
+
=head3 HTML TEMPLATES
Go to the templates directory and edit them as wished.
diff --git a/docs/photoalbum.txt b/docs/photoalbum.txt
index 315b86b..fbb2d32 100644
--- a/docs/photoalbum.txt
+++ b/docs/photoalbum.txt
@@ -3,7 +3,7 @@ NAME
static web photo albums.
SYNOPSIS
- photoalbum [clean|init|version|generate|all]
+ photoalbum clean|init|version|generate|all [rcfile]
clean
Cleans up the working space
@@ -19,6 +19,7 @@ SYNOPSIS
all This just runs 'clean init generate' right after another.
+ RCFILE
TUTORIAL
* See if /etc/default/photoalbum fits your needs. If not, copy
/etc/default/photoalbum to ~/.photoalbumrc in order to customize it.
@@ -33,6 +34,8 @@ SYNOPSIS
* Clean the mess up with 'photoalbum clean'
+ It is possible to specify a custom rcfile path too.
+
HTML TEMPLATES
Go to the templates directory and edit them as wished.
diff --git a/src/photoalbum.sh b/src/photoalbum.sh
index 38117a0..174fe8c 100755
--- a/src/photoalbum.sh
+++ b/src/photoalbum.sh
@@ -3,14 +3,20 @@
# photoalbum (c) 2011 - 2014 by Paul Buetow
# http://photoalbum.buetow.org
-declare -r ARG1="${1}" ; shift
+declare -r ARG1="${1}"; shift
+declare RC="${1}" ; shift
+
declare -r VERSION='PHOTOALBUMVERSION'
declare -r DEFAULTRC=/etc/default/photoalbum
+if [ -z "${RC}" ]; then
+ RCFILE="${DEFAULTRC}"
+fi
+
usage() {
cat - <<USAGE >&2
Usage:
- $0 [clean|init|version|generate|all]
+ $0 clean|init|version|generate|all [rcfile]
USAGE
}
@@ -165,7 +171,7 @@ makedist() {
done
}
-source "${DEFAULTRC}"
+source "${RC}"
if [ -f ~/.photoalbumrc ]; then
source ~/.photoalbumrc