source: trunk/samhain-install.sh.in@ 9

Last change on this file since 9 was 1, checked in by katerina, 19 years ago

Initial import

File size: 38.1 KB
RevLine 
[1]1#! /bin/sh
2
3purge=
4verbose=
5express=
6force=
7act=
8
9prefix=@prefix@
10exec_prefix=@exec_prefix@
11sbindir=@sbindir@
12samhain=@install_name@
13mandir=@mandir@
14
15sysconfdir=@sysconfdir@
16configfile=@myconffile@
17
18pid_file=@mylockfile@
19pid_dir=@mylockdir@
20
21data_root=@mydataroot@
22mydatafile=@mydatafile@
23
24mylogfile=@mylogfile@
25mylogdir=@mylogdir@
26
27myhtmlfile=@myhtmlfile@
28
29INSTALL_SHELL="$0 --install-sh -m 700"
30INSTALL_DATA="$0 --install-sh -m 600"
31
32mkinstalldirs="$0 --mkinstalldirs"
33
34
35DESTDIR=
36user=
37
38#
39# Only call rmdir with an absolute path
40#
41SH_RMDIR=echo
42SPATH="/bin:/usr/bin:/sbin:/usr/sbin"
43OLD_IFS=${IFS}
44IFS=':'; export IFS
45for ff in ${SPATH}; do
46 if test -x $ff/rmdir; then
47 SH_RMDIR=`eval echo ${ff}/rmdir`
48 fi
49done
50IFS=${OLD_IFS}; export IFS
51
52case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
53 *c*,-n*) ECHO_N= ECHO_C='
54' ECHO_T=' ' ;;
55 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
56 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
57esac
58
59
60if [ x"$1" = x ]
61then
62 echo 'samhain-install.sh [--destdir=DESTDIR][--verbose][--express][--force] action'
63 echo 'action = install-boot|install-data|install-user'
64 echo ' uninstall|purge|uninstall-boot'
65 echo ' uninstall-data|uninstall-man|uninstall-program|uninstall-lkm'
66 echo 'samhain-install.sh --print-config <item>'
67 echo 'item = name | basekey | prefix | exec_prefix | sbin_dir | man_dir'
68 echo ' config_dir | config_file | pid_dir | log_dir | log_file'
69 echo ' data_dir | data_file'
70 exit 1
71fi
72
73while [ x"$1" != x ]; do
74 case $1 in
75 -v|--verbose) verbose=yes
76 shift
77 continue;;
78
79 -e|--express) express=yes
80 shift
81 continue;;
82
83 -f|--force) force=yes
84 shift
85 continue;;
86
87 -d) shift
88 DESTDIR="$1"
89 if test "x${DESTDIR}" = "x/"; then
90 DESTDIR=
91 fi
92 shift
93 continue;;
94
95 --destdir=*) DESTDIR=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'`
96 if test "x${DESTDIR}" = "x/"; then
97 DESTDIR=
98 fi
99 shift
100 continue;;
101
102 --install-sh)
103 shift
104# install - install a program, script, or datafile
105# This comes from X11R5 (mit/util/scripts/install.sh).
106#
107# Copyright 1991 by the Massachusetts Institute of Technology
108#
109# Permission to use, copy, modify, distribute, and sell this software and its
110# documentation for any purpose is hereby granted without fee, provided that
111# the above copyright notice appear in all copies and that both that
112# copyright notice and this permission notice appear in supporting
113# documentation, and that the name of M.I.T. not be used in advertising or
114# publicity pertaining to distribution of the software without specific,
115# written prior permission. M.I.T. makes no representations about the
116# suitability of this software for any purpose. It is provided "as is"
117# without express or implied warranty.
118#
119# Calling this script install-sh is preferred over install.sh, to prevent
120# `make' implicit rules from creating a file called install from it
121# when there is no Makefile.
122#
123# This script is compatible with the BSD install script, but was written
124# from scratch. It can only install one file at a time, a restriction
125# shared with many OS's install programs.
126
127
128# set DOITPROG to echo to test this script
129
130# Don't use :- since 4.3BSD and earlier shells don't like it.
131doit="${DOITPROG-}"
132
133
134# put in absolute paths if you don't have them in your path; or use env. vars.
135
136mvprog="${MVPROG-mv}"
137cpprog="${CPPROG-cp}"
138chmodprog="${CHMODPROG-chmod}"
139chownprog="${CHOWNPROG-chown}"
140chgrpprog="${CHGRPPROG-chgrp}"
141stripprog="${STRIPPROG-strip}"
142rmprog="${RMPROG-rm}"
143mkdirprog="${MKDIRPROG-mkdir}"
144
145transformbasename=""
146transform_arg=""
147instcmd="$mvprog"
148chmodcmd="$chmodprog 0755"
149chowncmd=""
150chgrpcmd=""
151stripcmd=""
152rmcmd="$rmprog -f"
153mvcmd="$mvprog"
154src=""
155dst=""
156dir_arg=""
157
158while [ x"$1" != x ]; do
159 case $1 in
160 -c) instcmd="$cpprog"
161 shift
162 continue;;
163
164 -d) dir_arg=true
165 shift
166 continue;;
167
168 -m) chmodcmd="$chmodprog $2"
169 shift
170 shift
171 continue;;
172
173 -o) chowncmd="$chownprog $2"
174 shift
175 shift
176 continue;;
177
178 -g) chgrpcmd="$chgrpprog $2"
179 shift
180 shift
181 continue;;
182
183 -s) stripcmd="$stripprog"
184 shift
185 continue;;
186
187 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
188 shift
189 continue;;
190
191 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
192 shift
193 continue;;
194
195 *) if [ x"$src" = x ]
196 then
197 src=$1
198 else
199 # this colon is to work around a 386BSD /bin/sh bug
200 :
201 dst=$1
202 fi
203 shift
204 continue;;
205 esac
206done
207
208if [ x"$src" = x ]
209then
210 echo "install: no input file specified"
211 exit 1
212else
213 true
214fi
215
216if [ x"$dir_arg" != x ]; then
217 dst=$src
218 src=""
219
220 if [ -d $dst ]; then
221 instcmd=:
222 else
223 instcmd=mkdir
224 fi
225else
226
227# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
228# might cause directories to be created, which would be especially bad
229# if $src (and thus $dsttmp) contains '*'.
230
231 if [ -f $src -o -d $src ]
232 then
233 true
234 else
235 echo "install: $src does not exist"
236 exit 1
237 fi
238
239 if [ x"$dst" = x ]
240 then
241 echo "install: no destination specified"
242 exit 1
243 else
244 true
245 fi
246
247# If destination is a directory, append the input filename; if your system
248# does not like double slashes in filenames, you may need to add some logic
249
250 if [ -d $dst ]
251 then
252 dst="$dst"/`basename $src`
253 else
254 true
255 fi
256fi
257
258## this sed command emulates the dirname command
259dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
260
261# Make sure that the destination directory exists.
262# this part is taken from Noah Friedman's mkinstalldirs script
263
264# Skip lots of stat calls in the usual case.
265if [ ! -d "$dstdir" ]; then
266defaultIFS='
267'
268IFS="${IFS-${defaultIFS}}"
269
270oIFS="${IFS}"
271# Some sh's can't handle IFS=/ for some reason.
272IFS='%'
273set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
274IFS="${oIFS}"
275
276pathcomp=''
277
278while [ $# -ne 0 ] ; do
279 pathcomp="${pathcomp}${1}"
280 shift
281
282 if [ ! -d "${pathcomp}" ] ;
283 then
284 $mkdirprog "${pathcomp}"
285 else
286 true
287 fi
288
289 pathcomp="${pathcomp}/"
290done
291fi
292
293if [ x"$dir_arg" != x ]
294then
295 $doit $instcmd $dst &&
296
297 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
298 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
299 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
300 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
301else
302
303# If we're going to rename the final executable, determine the name now.
304
305 if [ x"$transformarg" = x ]
306 then
307 dstfile=`basename $dst`
308 else
309 dstfile=`basename $dst $transformbasename |
310 sed $transformarg`$transformbasename
311 fi
312
313# don't allow the sed command to completely eliminate the filename
314
315 if [ x"$dstfile" = x ]
316 then
317 dstfile=`basename $dst`
318 else
319 true
320 fi
321
322# Make a temp file name in the proper directory.
323
324 dsttmp=$dstdir/#inst.$$#
325
326# Move or copy the file name to the temp name
327
328 $doit $instcmd $src $dsttmp &&
329
330 trap "rm -f ${dsttmp}" 0 &&
331
332# and set any options; do chmod last to preserve setuid bits
333
334# If any of these fail, we abort the whole thing. If we want to
335# ignore errors from any of these, just make sure not to ignore
336# errors from the above "$doit $instcmd $src $dsttmp" command.
337
338 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
339 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
340 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
341 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
342
343# Now rename the file to the real destination.
344
345 $doit $rmcmd -f $dstdir/$dstfile &&
346 $doit $mvcmd $dsttmp $dstdir/$dstfile
347
348fi &&
349
350
351exit 0
352 # ----- END OF INSTALL-SH -----
353 ;;
354
355 --mkinstalldirs)
356 shift
357 # mkinstalldirs --- make directory hierarchy
358 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
359 # Created: 1993-05-16
360 # Public domain
361 # $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $
362 errstatus=0
363 for file
364 do
365 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
366 shift
367 pathcomp=
368 for d
369 do
370 pathcomp="$pathcomp$d"
371 case "$pathcomp" in
372 -* ) pathcomp=./$pathcomp ;;
373 esac
374
375 if test ! -d "$pathcomp"; then
376 echo "mkdir $pathcomp" 1>&2
377
378 mkdir "$pathcomp" || lasterr=$?
379
380 if test ! -d "$pathcomp"; then
381 errstatus=$lasterr
382 fi
383 fi
384
385 pathcomp="$pathcomp/"
386 done
387 done
388 exit $errstatus
389 # mkinstalldirs ends here
390 ;;
391
392 install-deploy)
393 if test -f ./samhainrc.USEME
394 then
395 tmpconfigfile=`echo ${configfile} | sed 's%^REQ_FROM_SERVER%%'`
396 if test x"${tmpconfigfile}" = x
397 then
398 echo " No local path for configfile defined."
399 exit 0
400 else
401 cp samhainrc.USEME "${tmpconfigfile}" && chmod 0600 "${tmpconfigfile}"
402 fi
403 fi
404 if test -f postinstall.USEME
405 then
406 /bin/sh ./postinstall.USEME
407 fi
408 exit 0
409 ;;
410
411 print-config|--print-config)
412 shift
413 pwhat=$1
414 if test x"$1" = x
415 then
416 echo "$0: Missing argument to print-config"
417 exit 1
418 fi
419 case $pwhat in
420 basekey)
421 echo "@mykeybase@"
422 ;;
423
424 prefix)
425 echo $prefix
426 ;;
427
428 exec_prefix)
429 echo $exec_prefix
430 ;;
431
432 sbin_dir)
433 echo $sbindir
434 ;;
435
436 name)
437 echo $samhain
438 ;;
439
440 man_dir)
441 echo $mandir
442 ;;
443
444 config_dir)
445 echo $sysconfdir
446 ;;
447
448 config_file)
449 echo $configfile | sed 's%^REQ_FROM_SERVER%%'
450 ;;
451
452 pid_file)
453 echo ${pid_file}
454 ;;
455
456 pid_dir)
457 echo ${pid_dir}
458 ;;
459
460 data_dir)
461 echo @mydataroot@
462 ;;
463
464 data_file)
465 echo @mydatafile@ | sed 's%^REQ_FROM_SERVER%%'
466 ;;
467
468 log_file)
469 echo @mylogfile@
470 ;;
471
472 log_dir)
473 echo @mylogdir@
474 ;;
475
476 *)
477 echo "$0: Unknown item \"$pwhat\""
478 exit 1
479 ;;
480 esac
481 exit 0
482 ;;
483
484 install-user)
485 act=user
486 shift
487 user=$1
488 break;;
489
490 install-boot)
491 act=boot
492 break;;
493
494 uninstall-boot)
495 act=uboot
496 break;;
497
498 install-data)
499 act=data
500 break;;
501
502 uninstall-data)
503 act=udata
504 break;;
505
506 uninstall-man)
507 act=uman
508 break;;
509
510 uninstall-program)
511 act=uprogram
512 break;;
513
514 uninstall-lkm)
515 act=ulkm
516 break;;
517
518 uninstall | remove | purge)
519 opts=
520 test x"$verbose" = "xyes" && opts="$opts --verbose"
521 test x"$express" = "xyes" && opts="$opts --express"
522 test x"$force" = "xyes" && opts="$opts --force"
523 test x"$DESTDIR" = "x" || opts="$opts --destdir=$DESTDIR"
524 test x"$1" = "xpurge" && purge=yes
525 echo "$0 $opts uninstall-lkm"
526 eval $0 $opts uninstall-lkm
527 echo "$0 $opts uninstall-program"
528 eval $0 $opts uninstall-program
529 echo "$0 $opts uninstall-man"
530 eval $0 $opts uninstall-man
531 if test x"$force" = "x"; then
532 test "x$purge" = xyes && opts="$opts --force"
533 fi
534 echo "$0 $opts uninstall-data"
535 eval $0 $opts uninstall-data
536 echo
537 echo " To uninstall the runlevel scripts, use $0 $opts uninstall-boot"
538 echo
539 exit 0
540 ;;
541 *)
542 echo "Unknown option $1"
543 exit 1
544 ;;
545
546 esac
547done
548
549if test x"$act" = xuser
550then
551
552# -- the routines for installing a new user are adapted from
553# the OpenPKG bootstrap installation script, which is distributed
554# under the following license:
555
556## Shell-based package for OpenPKG BINARY bootstrap installation
557## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
558## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
559## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.com>
560##
561## Permission to use, copy, modify, and distribute this software for
562## any purpose with or without fee is hereby granted, provided that
563## the above copyright notice and this permission notice appear in all
564## copies.
565##
566## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
567## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
568## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
569## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
570## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
571## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
572## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
573## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
574## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
575## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
576## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
577## SUCH DAMAGE.
578
579 if test x"$user" = x
580 then
581 echo "**ERROR**: No username specified"
582 exit 1
583 fi
584
585 s=`uname -s 2>/dev/null` || s='Unknown'
586 r=`uname -r 2>/dev/null` || r='0.0'
587 platform="${s}/${r}"
588
589 if test x"$user" = xnobody; then
590 case "$platform" in
591 HP-UX/* )
592 group="nogroup"
593 ;;
594 *)
595 group="nobody"
596 ;;
597 esac
598 else
599 group="$user"
600 fi
601 shell=/bin/false
602 if test -f /etc/shells
603 then
604 grep "^/usr/bin/false" /etc/shells >/dev/null 2>&1 && shell=/usr/bin/false
605 grep "^/bin/nologin" /etc/shells >/dev/null 2>&1 && shell=/bin/nologin
606 grep "^/sbin/nologin" /etc/shells >/dev/null 2>&1 && shell=/sbin/nologin
607 fi
608 home="${data_root}"
609
610 xuid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
611 grep "^${user}:" | awk -F: '{ print $3; }'`
612 if test "x$xuid" = x
613 then
614 # seek for a reasonable uid/gid pair
615 xuid=1000
616 ok=0
617 while test "x$ok" = x0
618 do
619 eval "u_exists=\$u_exists_$xuid"
620 if test "x$u_exists" = x
621 then
622 u_exists=`(cat /etc/passwd; ypcat passwd) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
623 fi
624 eval "g_exists=\$g_exists_$xuid"
625 if test "x$g_exists" = x
626 then
627 g_exists=`(cat /etc/group; ypcat group) 2>/dev/null | grep "^[^:]*:[^:]*:$xuid:"`
628 fi
629 if [ "x$u_exists" = x -a "x$g_exists" = x ]; then
630 ok=1
631 break
632 fi
633 xuid=`expr $xuid + 1`
634 done
635 eval "u_exists_$xuid=yes"
636 eval "g_exists_$xuid=yes"
637 else
638 # user exists
639 xgid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
640 grep "^${user}:" | awk -F: '{ print $4; }'`
641 fi
642
643 if test "x$xgid" = x
644 then
645 xgid=`(cat /etc/group; ypcat group) 2>/dev/null |\
646 grep "^${group}:" | awk -F: '{ print $3; }'`
647 fi
648
649 if test "x$xgid" = x
650 then
651 xgid="$xuid"
652 g_exists=no
653 else
654 g_exists=yes
655 fi
656
657 uid=$xuid
658 gid=$xgid
659
660 if test -f /etc/shells
661 then
662 exists=`cat /etc/shells 2>/dev/null | grep "^$shell"`
663 if test "x$exists" = x; then
664 echo "${shell}" >>/etc/shells
665 test -z "$verbose" || echo " Added ${shell} to /etc/shells"
666 fi
667 fi
668
669 exists=`(cat /etc/passwd; ypcat passwd) 2>/dev/null | grep "^$user:"`
670 if test x"$exists" = x; then
671 # add entry to passwd database
672 realname="$user"
673 case "$platform" in
674 FreeBSD/* | NetBSD/* )
675 file=/etc/master.passwd
676 entry="${user}:*:${uid}:${gid}::0:0:${realname}:${home}:${shell}"
677 update="(PATH=\$PATH:/usr/sbin; pwd_mkdb -p /etc/master.passwd)"
678 break
679 ;;
680 Linux/* )
681 file=/etc/passwd
682 entry="${user}:*:${uid}:${gid}:${realname}:${home}:${shell}"
683 update="(PATH=\$PATH:/usr/sbin; pwconv)"
684 break
685 ;;
686 SunOS/5.* )
687 file=/etc/passwd
688 entry="${user}:*:${uid}:${gid}:${realname}:${home}:${shell}"
689 update="(PATH=\$PATH:/usr/sbin; pwconv)"
690 break
691 ;;
692 OSF1/V5.* )
693 file=/etc/passwd
694 entry="${user}:*:${uid}:${gid}:${realname}:${home}:${shell}"
695 update="(PATH=\$PATH:/usr/sbin; mkpasswd /etc/passwd)"
696 break
697 ;;
698 HP-UX/* )
699 file=/etc/passwd
700 entry="${user}:*:${uid}:${gid}:${realname}:${home}:${shell}"
701 update=":"
702 break
703 ;;
704 IRIX*/* )
705 file=/etc/passwd
706 entry="${user}:*:${uid}:${gid}:${realname}:${home}:${shell}"
707 update=":"
708 break
709 ;;
710 *)
711 echo "install-user: Unsupported system $platform"
712 echo "Please add user $user / group $group manually"
713 echo " and re-run make install-user"
714 exit 1
715 ;;
716 esac
717 cp $file $file.bak && \
718 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
719 rm -f $file.bak >/dev/null 2>&1
720 eval $update
721 test -z "$verbose" || echo " Added user: ${user} uid: ${uid} shell: ${shell}"
722 else
723 test -z "$verbose" || echo " User ${user} exists already"
724 fi
725
726 # check whether group already exists
727 # FIXME
728 exists=`(cat /etc/group; ypcat group) 2>/dev/null | grep "^$group:"`
729 if test x"$exists" = x
730 then
731 #
732 # user has a valid GID
733 #
734 if test g_exists = xyes; then
735 exists=yes
736 fi
737 fi
738 if test x"$exists" = x
739 then
740 # add entry to group database
741 file=/etc/group
742 entry="${group}:*:${gid}:${user}"
743 cp $file $file.bak && \
744 (grep -v '^+:' $file.bak; echo $entry; grep '^+:' $file.bak) >$file
745 rm -f $file.bak >/dev/null 2>&1
746 test -z "$verbose" || echo " Added group: ${group} gid: ${gid} user: ${user}"
747 fi
748
749 exit 0
750fi
751
752if test x"$act" = xboot || test x"$act" = xuboot
753then
754 s=`uname -s 2>/dev/null` || s='Unknown'
755 r=`uname -r 2>/dev/null` || r='0.0'
756 platform="${s}/${r}"
757
758 case "$platform" in
759 IRIX*/*)
760 DVER="IRIX"
761 test -z "$verbose" || echo " IRIX system detected"
762 rc_main=${DESTDIR}/etc/init.d
763 rc_dirz=
764 rc_inst="chmod 755 /etc/init.d/@install_name@; chown root /etc/init.d/@install_name@; chkconfig -f @install_name@ on; (cd /etc; ln -f -s init.d/@install_name@ rc2.d/S99@install_name@; ln -f -s init.d/@install_name@ rc0.d/K10@install_name@; )"
765 rc_uinst="rm -f /etc/init.d/@install_name@; rm -f /etc/rc2.d/S99@install_name@; rm -f /etc/rc0.d/K10@install_name@; chkconfig @install_name@ off"
766 ;;
767
768 AIX/*)
769 DVER="AIX"
770 test -z "$verbose" || echo " AIX system detected"
771 ln -f -s @sbindir@/@install_name@ samhain.startAIX
772 rc_main=@sbindir@
773 rc_dirz=
774 rc_inst="/usr/sbin/mkitab -i '@install_name@:2:wait:@sbindir@/@install_name@ start >/dev/console 2>&1'"
775 rc_uinst="/usr/sbin/rmitab @install_name@"
776 ;;
777
778 HP-UX/*)
779 DVER="HPUX"
780 test -z "$verbose" || echo " HP-UX system detected"
781 rc_main=${DESTDIR}/sbin/init.d
782 rc_dirz=
783 rc_inst="chmod 555 /sbin/init.d/@install_name@; chown bin:bin /sbin/init.d/@install_name@; (cd /sbin && ln -f -s /sbin/init.d/@install_name@ rc2.d/S900@install_name@ && ln -f -s /sbin/init.d/@install_name@ rc1.d/K100@install_name@; )"
784 rc_uinst="rm -f /sbin/init.d/@install_name@; rm -f /sbin/rc2.d/S900@install_name@; rm -f /sbin/rc1.d/K100@install_name@"
785 ;;
786
787 FreeBSD/* )
788 DVER="FreeBSD"
789 test -z "$verbose" || echo " FreeBSD system detected"
790 rc_main=${DESTDIR}/usr/local/etc/rc.d
791 rc_dirz=
792 rc_inst="mv /usr/local/etc/rc.d/@install_name@ /usr/local/etc/rc.d/@install_name@.sh && chmod 755 /usr/local/etc/rc.d/@install_name@.sh"
793 rc_uinst="rm -f /usr/local/etc/rc.d/@install_name@.sh; echo You may want to remove ${rc_main} from local_startup in /etc/rc.conf; echo if it is empty"
794 if test x"$act" = xboot
795 then
796 if [ ! -d ${rc_main} ]; then
797 test x"$act" = xboot && mkdir ${rc_main}
798 fi
799 ( . /etc/defaults/rc.conf
800 . /etc/rc.conf
801 found=0
802 for p in ${local_startup-x}; do
803 if test "x$p" = "x${rc_main}"; then
804 found=1
805 break
806 fi
807 done
808 if test "x$found" = x0; then
809 cp -p /etc/rc.conf /etc/rc.conf.bak
810 (
811 grep -v local_startup /etc/rc.conf.bak
812 echo "local_startup=\"${rc_main} $local_startup\""
813 ) >/etc/rc.conf
814 fi
815 )
816 fi
817 ;;
818 SunOS/5.* )
819 DVER="Solaris"
820 test -z "$verbose" || echo " Solaris system detected"
821 rc_dirz=
822 rc_main=${DESTDIR}/etc/init.d
823 rc_inst="chmod 755 ${DESTDIR}/etc/init.d/@install_name@; chown root:sys ${DESTDIR}/etc/init.d/@install_name@; (cd ${DESTDIR}/etc; ln init.d/@install_name@ rc3.d/S99@install_name@; ln init.d/@install_name@ rc0.d/K10@install_name@; ln init.d/@install_name@ rc1.d/K10@install_name@; )"
824 rc_uinst="rm -f ${DESTDIR}/etc/init.d/@install_name@; rm -f ${DESTDIR}/etc/rc0.d/K10@install_name@; rm -f ${DESTDIR}/etc/rc1.d/K10@install_name@; rm -f ${DESTDIR}/etc/rc3.d/S99@install_name@"
825 ;;
826 Linux/*)
827 rlv="2 3 4 5"
828 linkopt="-f -s"
829 # find rc directories
830 if test -f /usr/lib/lsb/install_initd && test -d /etc/init.d
831 then
832 test -z "$verbose" || echo " Linux Standard Base system detected"
833 DVER=LSB
834 if test x"$DESTDIR" = x
835 then
836 rc_main=/etc/init.d
837 rc_dirz=
838 rc_inst="/usr/lib/lsb/install_initd /etc/init.d/@install_name@"
839 rc_uinst="/usr/lib/lsb/remove_initd /etc/init.d/@install_name@"
840 else
841 rc_inst=
842 rc_uinst=
843 rc_main=${DESTDIR}/etc/init.d
844 rc_dirz=
845 # test -d /etc/init.d/rc2.d && rc_dirz=${DESTDIR}/etc/init.d/rc
846 # test -d /etc/rc.d/rc2.d && rc_dirz=${DESTDIR}/etc/rc.d/rc
847 # test -d /etc/rc2.d && rc_dirz=${DESTDIR}/etc/rc
848 fi
849 elif test -f /etc/SuSE-release
850 then
851 test -z "$verbose" || echo " SuSE system detected"
852 DVER="Linux"
853 rc_inst=
854 rc_uinst=
855 if test -d /sbin/init.d && test -d /sbin/init.d/rc2.d
856 then
857 test -z "$verbose" || echo " SuSE 6.x system detected"
858 rc_main=${DESTDIR}/sbin/init.d
859 rc_dirz=${DESTDIR}/sbin/init.d/rc
860 elif test -d /etc/init.d && test -d /etc/init.d/rc2.d
861 then
862 test -z "$verbose" || echo " SuSE 7.x or newer detected"
863 rc_main=${DESTDIR}/etc/init.d
864 rc_dirz=${DESTDIR}/etc/init.d/rc
865 else
866 echo "${0}: unknown system"
867 exit 1
868 fi
869 elif test -d /sbin/init.d && test -d /sbin/init.d/rc2.d
870 then
871 DVER="Linux"
872 rc_inst=
873 rc_uinst=
874 test -z "$verbose" || echo " SuSE 5.x system detected"
875 rc_main=${DESTDIR}/sbin/init.d
876 rc_dirz=${DESTDIR}/sbin/init.d/rc
877 elif test -f /etc/debian_version
878 then
879 DVER="Linux"
880 test -z "$verbose" || echo " Debian based system detected"
881 if test x"$DESTDIR" = x
882 then
883 rc_main=/etc/init.d
884 rc_dirz=
885 rc_uinst="/usr/sbin/update-rc.d -f @install_name@ remove"
886 rc_inst="/usr/sbin/update-rc.d @install_name@ defaults 99 10"
887 else
888 rc_inst=
889 rc_uinst=
890 rc_main=${DESTDIR}/etc/init.d
891 # rc_dirz=${DESTDIR}/etc/rc
892 rc_dirz=
893 fi
894 elif test -f /etc/redhat-release
895 then
896 DVER="Linux"
897 test -z "$verbose" || echo " Redhat based system detected"
898 rc_uinst=
899 rc_inst=
900 rc_main=${DESTDIR}/etc/rc.d/init.d
901 rc_dirz=${DESTDIR}/etc/rc.d/rc
902 elif test -f /etc/mandrake-release
903 then
904 DVER="Linux"
905 test -z "$verbose" || echo " Mandrake based system detected"
906 rc_uinst=
907 rc_inst=
908 rc_main=${DESTDIR}/etc/rc.d/init.d
909 rc_dirz=${DESTDIR}/etc/rc.d/rc
910 elif test -f /etc/yellowdog-release
911 then
912 DVER="Linux"
913 test -z "$verbose" || echo " Yellow Dog based system detected"
914 rc_uinst=
915 rc_inst=
916 rc_main=${DESTDIR}/etc/rc.d/init.d
917 rc_dirz=${DESTDIR}/etc/rc.d/rc
918 elif test -f /etc/slackware-version && test -f /etc/rc.d/rc.sysvinit
919 then
920 DVER="Linux"
921 test -z "$verbose" || echo " Slackware based system detected"
922 rc_uinst=
923 rc_inst=
924 rc_main=${DESTDIR}/etc/rc.d
925 rc_dirz=${DESTDIR}/etc/rc.d/rc
926 elif test -f /etc/gentoo-release
927 then
928 DVER="Gentoo"
929 test -z "$verbose" || echo " Gentoo based system detected"
930 rc_uinst="/sbin/rc-update del @install_name@"
931 rc_inst="/sbin/rc-update add @install_name@ default"
932 rc_main=${DESTDIR}/etc/init.d
933 rc_dirz=
934 else
935 echo "${0}: unknown Linux distribution"
936 rc_uinst=
937 rc_inst=
938 rc_main=
939 rc_dirz=
940 for ff in /etc/rc.d/init.d /etc/init.d /sbin/init.d; do
941 if test -d $ff; then
942 rc_main="$ff"
943 break
944 fi
945 done
946 for fg in /etc/rc.d/rc2.d /etc/rc2.d /sbin/init.d/rc2.d; do
947 if test -d $fg; then
948 rc_dirz="`echo $fg | sed -e 's,2.*,,'`"
949 break
950 fi
951 done
952 if [ x"${rc_dirz}" = x ]; then
953 echo "${0}: no install directory for runlevel scripts found"
954 exit 1
955 fi
956 if [ x"${rc_main}" = x ]; then
957 echo "${0}: no install directory for runlevel scripts found"
958 exit 1
959 fi
960 DVER="Linux"
961 rc_main="${DESTDIR}${rc_main}"
962 rc_dirz="${DESTDIR}${rc_dirz}"
963 fi
964 ;;
965
966 *)
967 echo "${0}: unsupported platform ${platform}"
968 exit 1
969 ;;
970 esac
971
972 if test x"${rc_main}" = x
973 then
974 echo "${0}: no install directory for runlevel scripts found"
975 exit 1
976 fi
977
978 if test x"${act}" = xboot
979 then
980
981 startscript=NONE
982 if test -f init/samhain.start${DVER}
983 then
984 startscript=`eval echo init/samhain.start${DVER}`
985 elif test -f samhain.start${DVER}
986 then
987 startscript=`eval echo samhain.start${DVER}`
988 else
989 echo "${0}: cannot find samhain.start${DVER} in ./ or ./init"
990 exit 1
991 fi
992
993 if test "x${startscript}" = xNONE; then
994 echo "${0}: cannot find samhain.start${DVER} in ./ or ./init"
995 exit 1
996 else
997 if test -f ${rc_main}/${samhain} && test x"$force" != xyes
998 then
999 echo " ${rc_main}/${samhain} exists ... not overwritten (or use --force)"
1000 else
1001 if test x"$DESTDIR" = x
1002 then
1003 :
1004 else
1005 ${mkinstalldirs} ${rc_main}
1006 #
1007 if test x"$DVER" = xSolaris; then
1008 ${mkinstalldirs} ${DESTDIR}/etc/rc0.d
1009 ${mkinstalldirs} ${DESTDIR}/etc/rc1.d
1010 ${mkinstalldirs} ${DESTDIR}/etc/rc3.d
1011 fi
1012 #
1013 fi
1014 test -z "$verbose" || echo " ${INSTALL_SHELL} ${startscript} ${rc_main}/${samhain}"
1015 if test -f "@INSTALL@"; then
1016 ${INSTALL_SHELL} ${startscript} ${rc_main}/${samhain}
1017 else
1018 cp ${startscript} ${rc_main}/${samhain} && chmod 0700 ${rc_main}/${samhain}
1019 fi
1020 fi
1021 fi
1022
1023
1024 if test x"${rc_dirz}" != x
1025 then
1026 for ff in $rlv
1027 do
1028 if test x"${DESTDIR}" = x
1029 then
1030 rldir="${rc_dirz}${ff}.d/"
1031 test -z "$verbose" || echo " cd ${rldir} && ln ${linkopt} ${rc_main}/${samhain} S99${samhain}"
1032 (cd ${rldir} && ln ${linkopt} ${rc_main}/${samhain} S99${samhain})
1033 test -z "$verbose" || echo " cd ${rldir} && ln ${linkopt} ${rc_main}/${samhain} K10${samhain}"
1034 (cd ${rldir} && ln ${linkopt} ${rc_main}/${samhain} K10${samhain})
1035 else
1036 :
1037 # ${mkinstalldirs} ${rc_dirz}${ff}.d
1038 fi
1039
1040
1041 done
1042 fi
1043
1044 if test x"${rc_inst}" != x
1045 then
1046 if test x"${DESTDIR}" = x
1047 then
1048 test -z "$verbose" || echo " ${rc_inst}"
1049 eval ${rc_inst}
1050 fi
1051 fi
1052 echo "installing init scripts completed"
1053 fi
1054
1055 if test x"${act}" = xuboot
1056 then
1057 if test x"${rc_uinst}" != x
1058 then
1059 test -z "$verbose" || echo " ${rc_uinst}"
1060 echo
1061 eval ${rc_uinst}
1062 fi
1063
1064 if test x"${rc_dirz}" != x
1065 then
1066 for ff in $rlv
1067 do
1068 test -z "$verbose" || echo " rm -f ${rc_dirz}${ff}.d/S99${samhain}"
1069 rm -f ${rc_dirz}${ff}.d/S99${samhain}
1070 test -z "$verbose" || echo " rm -f ${rc_dirz}${ff}.d/S99${samhain}"
1071 rm -f ${rc_dirz}${ff}.d/K10${samhain}
1072 done
1073 fi
1074
1075 test -z "$verbose" || echo " rm -f ${rc_main}/${samhain}"
1076 rm -f ${rc_main}/${samhain}
1077
1078 echo " uninstalling init scripts completed"
1079 fi
1080
1081 # boot_install|boot_uninstall completed
1082 exit 0
1083fi
1084
1085if test x"${act}" = xulkm
1086then
1087 RVER=`uname -r`
1088 if test "x@sh_lkm@" != "x"; then
1089 if test -d /lib/modules/$RVER; then
1090 MODDIR="/lib/modules/$RVER"
1091 elif test -d /lib/modules/misc; then
1092 MODDIR="/lib/modules/misc"
1093 elif test -d /lib/modules; then
1094 MODDIR="/lib/modules/misc"
1095 fi
1096 # -- NEW --
1097 ALLMODS="@sh_lkm@"
1098 for p in $ALLMODS; do
1099 test -z "$verbose" || echo " rm -f ${DESTDIR}${MODDIR}/`echo $p|sed '
1100s%samhain%@install_name@%'`"
1101 rm -f ${DESTDIR}${MODDIR}/`echo $p|sed 's%samhain%@install_name@%'`
1102 done
1103 fi
1104fi
1105
1106if test x"${act}" = xuprogram
1107then
1108 PROGRAMS="@setpwd_prg@ @stegin_prg@ @yulectl_prg@ @sh_main_prg@"
1109 for p in $PROGRAMS; do
1110 test -z "$verbose" || echo " rm -f ${DESTDIR}${sbindir}/`echo $p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`"
1111 rm -f ${DESTDIR}${sbindir}/`echo $p|sed 's%samhain%@install_name@%'|sed 's%yule%@install_name@%'`
1112 done
1113 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${sbindir} ... $ECHO_C"
1114 ${SH_RMDIR} ${DESTDIR}${sbindir} >/dev/null 2>&1
1115 if test x$? = x0; then
1116 test -z "$verbose" || echo "${ECHO_T}done"
1117 else
1118 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1119 fi
1120 exit 0
1121fi
1122
1123if test x"${act}" = xuman
1124then
1125 test -z "$verbose" || echo " rm -f ${DESTDIR}${mandir}/man8/@install_name@.8"
1126 rm -f ${DESTDIR}${mandir}/man8/@install_name@.8
1127 test -z "$verbose" || echo " rm -f ${DESTDIR}${mandir}/man5/@install_name@rc.5"
1128 rm -f ${DESTDIR}${mandir}/man5/@install_name@rc.5
1129
1130 OLD_IFS=${IFS}
1131 IFS=':'; export IFS
1132 for ff in ${MANPATH}; do
1133 if test x"$ff/man8" = x"${DESTDIR}${mandir}/man8"; then
1134 echo " man directory ${DESTDIR}${mandir} is in your MANPATH"
1135 echo " -- will not try to remove"
1136 IFS=${OLD_IFS}; export IFS
1137 exit 0
1138 fi
1139 done
1140 IFS=${OLD_IFS}; export IFS
1141
1142 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${mandir}/man8 ... $ECHO_C"
1143 ${SH_RMDIR} ${DESTDIR}${mandir}/man8 >/dev/null 2>&1
1144 if test x$? = x0; then
1145 test -z "$verbose" || echo "${ECHO_T}done"
1146 else
1147 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1148 fi
1149
1150 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${mandir}/man5 ... $ECHO_C"
1151 ${SH_RMDIR} ${DESTDIR}${mandir}/man5 >/dev/null 2>&1
1152 if test x$? = x0; then
1153 test -z "$verbose" || echo "${ECHO_T}done"
1154 else
1155 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1156 fi
1157
1158 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${mandir} ... $ECHO_C"
1159 ${SH_RMDIR} ${DESTDIR}${mandir} >/dev/null 2>&1
1160 if test x$? = x0; then
1161 test -z "$verbose" || echo "${ECHO_T}done"
1162 else
1163 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1164 fi
1165
1166 exit 0
1167fi
1168
1169if test x"${act}" = xudata
1170then
1171 test -z "$verbose" || echo " rm -f ${DESTDIR}`echo ${mydatafile}|sed s%REQ_FROM_SERVER%%`"
1172 rm -f ${DESTDIR}`echo ${mydatafile}|sed s%REQ_FROM_SERVER%%`
1173 test -z "$verbose" || echo " rm -f ${DESTDIR}${pid_file}"
1174 rm -f ${DESTDIR}${pid_file}
1175 test -z "$verbose" || echo " rm -f ${DESTDIR}${mylogfile}"
1176 rm -f ${DESTDIR}${mylogfile}
1177 test -z "$verbose" || echo " rm -f ${DESTDIR}${myhtmlfile}"
1178 rm -f ${DESTDIR}${myhtmlfile}
1179
1180 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${pid_dir} ... $ECHO_C"
1181 ${SH_RMDIR} ${DESTDIR}${pid_dir} >/dev/null 2>&1
1182 if test x$? = x0; then
1183 test -z "$verbose" || echo "${ECHO_T}done"
1184 else
1185 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1186 fi
1187
1188 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${mylogdir} ... $ECHO_C"
1189 ${SH_RMDIR} ${DESTDIR}${mylogdir} >/dev/null 2>&1
1190 if test x$? = x0; then
1191 test -z "$verbose" || echo "${ECHO_T}done"
1192 else
1193 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1194 fi
1195
1196 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${data_root} ... $ECHO_C"
1197 ${SH_RMDIR} ${DESTDIR}${data_root} >/dev/null 2>&1
1198 if test x$? = x0; then
1199 test -z "$verbose" || echo "${ECHO_T}done"
1200 else
1201 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1202 fi
1203
1204 if test x"$force" = "xyes"
1205 then
1206 test -z "$verbose" || echo " rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`"
1207 rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`
1208 elif test x"$purge" = "xyes"
1209 then
1210 test -z "$verbose" || echo " rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`"
1211 rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`
1212 elif test x"$express" = x; then
1213 echo " Do you want to remove the configuration file [y/n] ?"
1214 while [ "1" = "1" ]; do
1215 read ff
1216 case "$ff" in
1217 Y* | y* )
1218 test -z "$verbose" || echo " rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`"
1219 rm -f ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%`
1220 break
1221 ;;
1222 N* | n* )
1223 test -z "$verbose" || echo " ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%` NOT removed"
1224 break
1225 ;;
1226 *)
1227 echo " Enter y[es] or n[o]"
1228 ;;
1229 esac
1230 done
1231 else
1232 test -z "$verbose" || echo " NOT REMOVED: config file ${DESTDIR}`echo ${configfile}|sed s%REQ_FROM_SERVER%%` (use --force to remove)"
1233 fi
1234
1235 test -z "$verbose" || echo $ECHO_N " ${SH_RMDIR} ${DESTDIR}${sysconfdir} ... $ECHO_C"
1236 ${SH_RMDIR} ${DESTDIR}${sysconfdir} >/dev/null 2>&1
1237 if test x$? = x0; then
1238 test -z "$verbose" || echo "${ECHO_T}done"
1239 else
1240 test -z "$verbose" || echo "${ECHO_T}failed (not empty ?)"
1241 fi
1242
1243 exit 0
1244fi
1245
1246if test x"${act}" = xdata
1247then
1248 STEGIN=@stegin_prg@
1249 CONVERT=
1250
1251 GPGPATH=@mygpg@
1252
1253 NTEST=@mytclient@
1254
1255 if test x"${NTEST}" = "x-DSH_WITH_SERVER"
1256 then
1257 RCFILE=yulerc
1258 if test -f $RCFILE
1259 then
1260 :
1261 else
1262 if test -f yulerc.template
1263 then
1264 cp yulerc.template $RCFILE
1265 fi
1266 fi
1267 else
1268 RCFILE=samhainrc
1269 IN_RCFILE=samhainrc.@selectconfig@
1270
1271 if test -f ${RCFILE}
1272 then
1273 :
1274 else
1275 if test -f ${IN_RCFILE}
1276 then
1277 test -z "$verbose" || echo " cp ${IN_RCFILE} ${RCFILE}"
1278 cp ${IN_RCFILE} ${RCFILE}
1279 fi
1280 fi
1281 fi
1282
1283 if test -f $RCFILE
1284 then
1285 :
1286 else
1287 echo "${0}: cannot find configuration file $RCFILE"
1288 exit 1
1289 fi
1290
1291 if test x"${GPGPATH}" != x
1292 then
1293 echo
1294 echo "You need to sign the config file now"
1295 echo
1296 test -z "$verbose" || echo " ${GPGPATH} -a --clearsign $RCFILE"
1297 if test x"${NTEST}" = "x-DSH_WITH_SERVER"
1298 then
1299 myident_uid=`(cat /etc/passwd; ypcat passwd) 2>/dev/null |\
1300 grep "^${samhain}:" | awk -F: '{ print $3; }'`
1301 if test x"${myident_uid}" != x
1302 then
1303 DOT_GNUPG=`eval echo ~${samhain}/.gnupg`
1304 test -z "$verbose" || echo " using --homedir ${DOT_GNUPG}"
1305 ${GPGPATH} --homedir ${DOT_GNUPG} -a --clearsign $RCFILE
1306 else
1307 ${GPGPATH} -a --clearsign $RCFILE
1308 fi
1309 else
1310 ${GPGPATH} -a --clearsign $RCFILE
1311 fi
1312
1313 if test -f ${RCFILE}.asc
1314 then
1315 test -z "$verbose" || echo " mv -f ${RCFILE}.asc samhainrc.pre"
1316 mv -f ${RCFILE}.asc samhainrc.pre
1317 else
1318 echo "**********************************************************"
1319 echo
1320 echo "${0}: ERROR: cannot find signed file ${RCFILE}.asc"
1321 echo
1322 echo " --- You need to sign the configuration file ---"
1323 echo
1324 echo "**********************************************************"
1325 cp ${RCFILE} samhainrc.pre
1326 fi
1327 else
1328 test -z "$verbose" || echo " cp $RCFILE samhainrc.pre"
1329 cp $RCFILE samhainrc.pre
1330 fi
1331
1332 if test x"${STEGIN}" != x
1333 then
1334 test -z "$verbose" || echo " searching for ImageMagick convert utility"
1335 OPATH=${PATH}
1336 PATH="/usr/local/bin:/usr/X11R6/bin:"${PATH}
1337
1338 OIFS=${IFS}
1339 IFS=":"
1340
1341 for dd in ${PATH}
1342 do
1343 if test -f "${dd}/convert"
1344 then
1345 "${dd}/convert" --help | grep ImageMagick >/dev/null 2>&1 && \
1346 CONVERT="${dd}/convert"
1347 test -z "$verbose" || echo " CONVERT=${dd}/convert"
1348 fi
1349 done
1350
1351 IFS=${OIFS}
1352
1353 if test x"${CONVERT}" = x
1354 then
1355 echo "${0}: cannot find ImageMagick convert utility in PATH=${PATH}"
1356 exit 1
1357 fi
1358
1359 PATH=${OPATH}
1360
1361 if test -f stealth_template.jpg
1362 then
1363 test -z "$verbose" || echo " ${CONVERT} +compress stealth_template.jpg stealth_template.ps"
1364 "${CONVERT}" +compress stealth_template.jpg stealth_template.ps
1365 else
1366 echo "${0}: cannot find file stealth_template.jpg"
1367 exit 1
1368 fi
1369
1370
1371 if test -f stealth_template.ps
1372 then
1373 :
1374 else
1375 echo "${0}: file stealth_template.ps not created"
1376 exit 1
1377 fi
1378
1379 if test -f samhainrc.pre
1380 then
1381 :
1382 else
1383 echo "${0}: cannot find configuration file samhainrc.pre"
1384 exit 1
1385 fi
1386
1387 if test -f ./samhain_stealth
1388 then
1389 :
1390 else
1391 echo "${0}: cannot find utility ./samhain_stealth"
1392 exit 1
1393 fi
1394
1395 ccount=`./samhain_stealth -o samhainrc.pre 2>&1 | awk '{ print $1 }'`
1396 mcount=`./samhain_stealth -i stealth_template.ps 2>&1 | awk '{ print $7 }'`
1397
1398 if test ${mcount} -lt ${ccount}
1399 then
1400 echo "${0}: configuration file samhainrc too big,"
1401 echo " need a larger image stealth_template.jpg to store"
1402 exit 1
1403 fi
1404
1405 test -z "$verbose" || echo " ./samhain_stealth -s stealth_template.ps samhainrc.pre"
1406 ./samhain_stealth -s stealth_template.ps samhainrc.pre
1407
1408 test -z "$verbose" || echo " mv -f stealth_template.ps samhainrc.install"
1409 mv -f stealth_template.ps samhainrc.install
1410 else
1411 test -z "$verbose" || echo " mv -f samhainrc.pre samhainrc.install"
1412 mv -f samhainrc.pre samhainrc.install
1413 fi
1414
1415 tmp_configfile=`echo ${configfile} | sed 's%^REQ_FROM_SERVER%%'`
1416
1417 if test x"${tmp_configfile}" = x
1418 then
1419 echo " No local configfile to install."
1420 exit 0
1421 fi
1422
1423 if test -f ${DESTDIR}${tmp_configfile} && test x"$force" = x
1424 then
1425 echo " ${DESTDIR}${tmp_configfile} exists ... not overwritten (or use --force)"
1426 else
1427 test -z "$verbose" || echo " ${INSTALL_DATA} samhainrc.install ${DESTDIR}${tmp_configfile}"
1428 ${INSTALL_DATA} samhainrc.install ${DESTDIR}${tmp_configfile}
1429 fi
1430
1431 if test x"${NTEST}" = "x-DSH_WITH_SERVER"
1432 then
1433 test -z "$verbose" || echo " chown @myident@ ${DESTDIR}${tmp_configfile}"
1434 chown @myident@ ${DESTDIR}${tmp_configfile}
1435 fi
1436
1437 #
1438 # Changed: don't check if DESTDIR is set, as these are not
1439 # the true install locations anyway
1440 #
1441 if test -f trustfile && test x"${DESTDIR}" = x
1442 then
1443 test -z "$verbose" || echo " checking whether paths are trustworthy"
1444 RESULT=`./trustfile ${DESTDIR}${tmp_configfile} 2>&1`
1445 if test x$? != x0
1446 then
1447 echo
1448 ./trustfile ${DESTDIR}${tmp_configfile}
1449 echo
1450 else
1451 test -z "$verbose" || echo " configuration file ${DESTDIR}${tmp_configfile} ... OK"
1452 fi
1453
1454 RESULT=`./trustfile ${DESTDIR}${pid_dir} >/dev/null 2>&1`
1455 if test x$? != x0
1456 then
1457 echo
1458 ./trustfile ${DESTDIR}${pid_dir}
1459 echo
1460 else
1461 test -z "$verbose" || echo " state directory ${DESTDIR}${pid_dir} ... OK"
1462 fi
1463
1464 RESULT=`./trustfile ${DESTDIR}${mylogdir} >/dev/null 2>&1`
1465 if test x$? != x0
1466 then
1467 echo
1468 ./trustfile ${DESTDIR}${mylogdir}
1469 echo
1470 else
1471 test -z "$verbose" || echo " state directory ${DESTDIR}${mylogdir} ... OK"
1472 fi
1473
1474 RESULT=`./trustfile ${DESTDIR}${data_root} >/dev/null 2>&1`
1475 if test x$? != x0
1476 then
1477 echo
1478 ./trustfile ${DESTDIR}${data_root}
1479 echo
1480 else
1481 test -z "$verbose" || echo " data directory ${DESTDIR}${data_root} ... OK"
1482 fi
1483 fi
1484 # install_data
1485 exit 0
1486fi
1487
1488
Note: See TracBrowser for help on using the repository browser.