aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-04-22 18:57:51 +0000
committerrhatto <rhatto@370017ae-e619-0410-ac65-c121f96126d4>2008-04-22 18:57:51 +0000
commit78f752a2c2d7f37ec98ecf89f94c25b7dc18cbb8 (patch)
treedb4bb6ddd545f1d8ccd613f48857a41b7656163c /app
parent98b56075023d58bde09514b68d028251295b101f (diff)
downloadslackbuilds-78f752a2c2d7f37ec98ecf89f94c25b7dc18cbb8.tar.gz
slackbuilds-78f752a2c2d7f37ec98ecf89f94c25b7dc18cbb8.tar.bz2
rssh: handling default config file
git-svn-id: svn+slack://slack.fluxo.info/var/svn/slackbuilds@1717 370017ae-e619-0410-ac65-c121f96126d4
Diffstat (limited to 'app')
-rwxr-xr-xapp/shells/rssh/rssh.SlackBuild44
1 files changed, 44 insertions, 0 deletions
diff --git a/app/shells/rssh/rssh.SlackBuild b/app/shells/rssh/rssh.SlackBuild
index 2b48672c..356ac115 100755
--- a/app/shells/rssh/rssh.SlackBuild
+++ b/app/shells/rssh/rssh.SlackBuild
@@ -188,6 +188,50 @@ rssh:
rssh:
EODESC
+# Move config files to .new to avoid overwriting any system config
+for config_file in etc/rssh.conf; do
+ mv $PKG/$config_file $PKG/$config_file.new
+done
+
+# Add a post-installation script (doinst.sh)
+cat << EOSCRIPT > "$PKG/install/doinst.sh"
+config() {
+ NEW="\$1"
+ OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
+ # 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/rssh.conf.new
+EOSCRIPT
+
# Build the package
cd "$PKG"
makepkg -l y -c n "$REPOS/$PKG_NAME-$PKG_VERSION-$ARCH-$BUILD.tgz" || exit $ERROR_MKPKG