aboutsummaryrefslogtreecommitdiff
path: root/app/backup/backupninja/backupninja.SlackBuild
diff options
context:
space:
mode:
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-09-13 15:24:58 +0000
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-09-13 15:24:58 +0000
commit05c55607030a65ef066886c11ebfbc95a69c0eae (patch)
treeabf9b6a8fb2a8e70fd17f8e4bc0a5f297c5a85dd /app/backup/backupninja/backupninja.SlackBuild
parent9c6c4d694f5c57395be44f7af112010cce4e33b9 (diff)
downloadslackbuilds-05c55607030a65ef066886c11ebfbc95a69c0eae.tar.gz
slackbuilds-05c55607030a65ef066886c11ebfbc95a69c0eae.tar.bz2
backupninja: rebuilt from mkbuild
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1911 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'app/backup/backupninja/backupninja.SlackBuild')
-rwxr-xr-xapp/backup/backupninja/backupninja.SlackBuild42
1 files changed, 42 insertions, 0 deletions
diff --git a/app/backup/backupninja/backupninja.SlackBuild b/app/backup/backupninja/backupninja.SlackBuild
index 5c3b9506..a57002ea 100755
--- a/app/backup/backupninja/backupninja.SlackBuild
+++ b/app/backup/backupninja/backupninja.SlackBuild
@@ -188,6 +188,48 @@ backupninja:
backupninja:
EODESC
+# Add a post-installation script (doinst.sh)
+cat << EOSCRIPT > "$PKG/install/doinst.sh"
+config() {
+ NEW="\$1"
+ OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
+ OLD="\$(dirname \$NEW)/\$(basename \$OLD .sample)"
+ OLD="\$(dirname \$NEW)/\$(basename \$OLD .dist)"
+
+ # If there's no config file by that name, mv it over:
+ if [ ! -r \$OLD ]; then
+ mv \$NEW \$OLD
+ elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm \$NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+mkgroup() {
+ GROUP="\$1"
+ if ! grep -qe "^\$GROUP:" etc/group; then
+ echo Creating group \$GROUP...
+ chroot . /usr/sbin/groupadd \$GROUP
+ fi
+}
+
+mkuser() {
+ USER="\$1"
+ if [ ! -z "\$2" ]; then
+ GROUP="\$2"
+ else
+ GROUP="\$USER"
+ fi
+ if ! grep -qe "^\$USER:" etc/passwd; then
+ echo Creating user \$USER...
+ chroot . /usr/sbin/useradd \$USER -g \$GROUP
+ fi
+}
+
+config /etc/backupninja.conf.new
+EOSCRIPT
+
# Build the package
cd "$PKG"
makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG