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