[1] | 1 | #! /bin/sh
|
---|
| 2 |
|
---|
[27] | 3 | #
|
---|
| 4 | # Copyright Rainer Wichmann (2005)
|
---|
| 5 | #
|
---|
| 6 | # License Information:
|
---|
| 7 | # This program is free software; you can redistribute it and/or modify
|
---|
| 8 | # it under the terms of the GNU General Public License as published by
|
---|
| 9 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 10 | # (at your option) any later version.
|
---|
| 11 | #
|
---|
| 12 | # This program is distributed in the hope that it will be useful,
|
---|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | # GNU General Public License for more details.
|
---|
| 16 | #
|
---|
| 17 | # You should have received a copy of the GNU General Public License
|
---|
| 18 | # along with this program; if not, write to the Free Software
|
---|
| 19 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 20 | #
|
---|
| 21 |
|
---|
[1] | 22 | name=`./samhain-install.sh --print-config name`
|
---|
| 23 | sbin=`./samhain-install.sh --print-config sbin_dir`
|
---|
| 24 | rcfi=`./samhain-install.sh --print-config config_file`
|
---|
| 25 | passwd=$1
|
---|
| 26 |
|
---|
| 27 | setpwd="./${name}_setpwd"
|
---|
| 28 |
|
---|
| 29 | # Install the prepared configuration file.
|
---|
| 30 | #
|
---|
| 31 | test -f ./prepared_samhainrc || exit 1
|
---|
| 32 | ./samhain-install.sh --install-sh -m 600 ./prepared_samhainrc "$rcfi" || exit 1
|
---|
| 33 |
|
---|
| 34 | # Gentoo noise
|
---|
| 35 | #
|
---|
| 36 | rm -f /etc/init.d/._cfg????_${name}
|
---|
| 37 | rm -f /etc/._cfg????_${name}rc
|
---|
| 38 |
|
---|
| 39 | # Set the password within the executable.
|
---|
| 40 | #
|
---|
| 41 | if test "x${passwd}" = "xDUMMY"
|
---|
| 42 | then
|
---|
| 43 | rm -f "$sbin/${name}_setpwd"
|
---|
| 44 | else
|
---|
| 45 | current=`pwd`
|
---|
| 46 | cd "$sbin" || exit 1
|
---|
| 47 | eval "$setpwd" "$name" new "$passwd" || exit 1
|
---|
| 48 | if test -f "${name}.new"
|
---|
| 49 | then
|
---|
| 50 | rm "$name" || exit 1
|
---|
| 51 | mv "${name}.new" "$name" || exit 1
|
---|
| 52 | rm -f "./${name}_setpwd"
|
---|
| 53 | fi
|
---|
| 54 | cd "$current"
|
---|
| 55 | fi
|
---|
| 56 |
|
---|
| 57 | exit 0
|
---|
| 58 |
|
---|