aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2005-11-29 10:10:08 +0000
committerintrigeri <intrigeri@boum.org>2005-11-29 10:10:08 +0000
commit9208b449da1a1df50c2759946c9931f456af1e87 (patch)
tree4758ed8c827dad3015c738513f6c2e70c1322347 /handlers
parent13893e6d255a0b3ff1ac2ffb74cff0652d2b61f4 (diff)
downloadbackupninja-9208b449da1a1df50c2759946c9931f456af1e87.tar.gz
backupninja-9208b449da1a1df50c2759946c9931f456af1e87.tar.bz2
r3562@krups: intrigeri | 2005-11-16 20:20:16 +0100
Moved more code to lib/ (conffile-related functions, parseini. Added dup helper, using new modular vservers-related functions shared for all helpers.
Diffstat (limited to 'handlers')
-rw-r--r--handlers/Makefile.am6
-rw-r--r--handlers/Makefile.in5
-rw-r--r--handlers/dup.helper2
-rw-r--r--handlers/parseini130
4 files changed, 5 insertions, 138 deletions
diff --git a/handlers/Makefile.am b/handlers/Makefile.am
index dbe453d..6ba0925 100644
--- a/handlers/Makefile.am
+++ b/handlers/Makefile.am
@@ -1,10 +1,8 @@
-HANDLERS = dup dup.helper maildir mysql.helper rdiff sys \
- makecd makecd.helper \
- parseini rdiff.helper sys.helper ldap pgsql sh trac \
+HANDLERS = dup dup.helper maildir mysql.helper rdiff sys makecd makecd.helper \
+ rdiff.helper sys.helper ldap pgsql sh trac \
ldap.helper mysql pgsql.helper svn
-
EXTRA_DIST = Makefile.am $(HANDLERS)
dist_pkgdata_DATA = $(HANDLERS)
diff --git a/handlers/Makefile.in b/handlers/Makefile.in
index df6dd3e..18e02ef 100644
--- a/handlers/Makefile.in
+++ b/handlers/Makefile.in
@@ -112,9 +112,8 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
HANDLERS = dup dup.helper maildir mysql.helper rdiff sys \
- makecd makecd.helper \
- parseini rdiff.helper sys.helper ldap pgsql sh trac \
- ldap.helper mysql pgsql.helper svn
+ makecd makecd.helper rdiff.helper sys.helper \
+ ldap pgsql sh trac ldap.helper mysql pgsql.helper svn
EXTRA_DIST = Makefile.am $(HANDLERS)
dist_pkgdata_DATA = $(HANDLERS)
diff --git a/handlers/dup.helper b/handlers/dup.helper
index 7c172f0..89f458d 100644
--- a/handlers/dup.helper
+++ b/handlers/dup.helper
@@ -61,7 +61,7 @@ do_dup_excludes() {
}
do_dup_src() {
- host_or_vservers_chooser
+ host_or_vservers_chooser "$dup_title"
[ $? = 0 ] || return 1
case $host_or_vservers in
'host')
diff --git a/handlers/parseini b/handlers/parseini
deleted file mode 100644
index 6f56d42..0000000
--- a/handlers/parseini
+++ /dev/null
@@ -1,130 +0,0 @@
-#
-# parseini --- parses 'ini' style configuration files.
-#
-# Usage:
-# awk -f parseini S=<section> P=<param> <ini file>
-#
-# if section is an empty string, then we use the default section
-#
-# example ini file:
-#
-# fruit = apple
-# fruit = pear
-# multiline = this is a multiline \
-# parameter
-#
-# # this is a comment
-#
-# [colors]
-# red = yes
-# green = no
-# blue = maybe
-#
-# [ocean]
-# fish = red
-# fish = blue
-#
-# example usage:
-# > awk -f parseini S=ocean P=fish testfile.ini
-# would return:
-# red
-# blue
-#
-
-BEGIN {
- readlines = 1
- implied = 1
-}
-
-# remove lines starting with #, but not #!
-/^#[^!]/ {next}
-
-# skip blank
-/^[ \r\t]*$/ {next}
-
-# we want to read the lines of the matched section
-# and disable for other sections
-/^\[.+\][ \r\t]*$/ {
- continueline = 0
- if (S && implied) {
- nline = 0
- implied = 0
- }
- if (S && match($0, "^\\[" S "\\][ \n]*")) {
- # we found the section, so start reading.
- readlines = 1
- }
- else {
- # no section, so stop reading lines
- if (readlines) readlines = 0
- }
- next
-}
-
-# when reading, store lines.
-
-{
- if (!readlines) next
- line[nline++] = $0
- if ($0 ~ /\\[ \r\t]*$/)
- continueline = 1
- else
- continueline = 0
-}
-
-# process the read lines lines, matching parameters
-
-END {
- # if section is set but implied is still true
- # then we never found the section, so use everything
- if (S && implied) {
- nline = 0
- }
-
- # if have P then find P in read lines and get values
- if (P) {
- MATCH = "^[ \r\t]*" P "[ \r\t]*="
- continueline = 0
- for (x = 0; x < nline; ++x) {
- v = line[x]
- if (continueline) {
- sub(/[ \r\t]+$/, "", v)
- if (v ~ /\\$/) {
- v = substr(v, 1, length(v)-1)
- sub(/[ \r\t]+$/, "", v)
- }
- if (v) value[nvalue++] = v
- }
- else if (v ~ MATCH) {
- sub(MATCH, "", v)
- sub(/^[ \r\t]+/, "", v)
- sub(/[ \r\t]+$/, "", v)
- if (v ~ /\\$/) {
- continueline = 1
- v = substr(v, 1, length(v)-1)
- sub(/[ \r\t]+$/, "", v)
- }
- if (v) value[nvalue++] = v
- }
- }
- # copy parameter definition to output array
- nline = nvalue
- for (x = 0; x < nvalue; ++x)
- line[x] = value[x]
- }
-
- # trim all leading & trailing whitespace;
- # except for leading whitespace in continuation lines,
-
- for (x = 0; x < nline; ++x) {
- sub(/^[ \r\t]+/, "", line[x])
- sub(/[ \r\t]+$/, "", line[x])
- }
-
- # output the final result
- for (x = 0; x < nline; ++x)
- print line[x]
-
- if (nline) exit 0
- else exit 1
-}