3 # install-symlinks.sh - shell script for installing symbolic lynks
6 # Copyright (C) 1999-2000 Riccardo Facchetti <riccardo@master.oasi.gpa.it>
8 # Modified for use with Bacula 15 November 2001, Kern Sibbald
11 # Theory of operation:
12 # this script attempts to detect which runlevels are appropriate for
13 # apcupsd startup and consequently installs the OS startup symbolic links
14 # in the correct locations.
16 # For example, suse distribution uses sysvinit so the scripts will do:
17 # 1. searches for init scripts directory
18 # 2. try to detect on which runlevels is appropriate to run apcupsd
19 # (presumably all the runlevels at which also syslogd runs)
20 # 3. installs the symbolic links into the previously detected runlevels
25 if [ -z "$action" -o -z "$dist" ]
27 echo "Missing parameter on command line."
33 echo "Generic symlinks installation..."
40 elif [ -d /sbin/init.d ]
42 initrcd="/sbin/init.d"
44 echo "Can not find init scripts directory."
48 for runlevel in 1 2 3 4 5
50 if [ -L $initrcd/rc$runlevel.d/S*syslog ]
52 echo " Installing runlevel $runlevel..."
53 ln -sf $initrcd/apcupsd $initrcd/rc$runlevel.d/K20apcupsd
54 ln -sf $initrcd/apcupsd $initrcd/rc$runlevel.d/S20apcupsd
59 echo " relying on $dist-specific Makefile for symlink installation"
64 echo "Genering symlinks uninstallation..."
71 elif [ -d /sbin/init.d ]
73 initrcd="/sbin/init.d"
75 echo "Can not detect init scripts directory."
79 for runlevel in 1 2 3 4 5
81 if [ -L $initrcd/rc$runlevel.d/S20apcupsd ]
83 echo " Removing runlevel $runlevel..."
84 rm -f $initrcd/rc$runlevel.d/K20apcupsd
85 rm -f $initrcd/rc$runlevel.d/S20apcupsd
90 echo " relying on $dist-specific Makefile for symlink uninstallation"
95 echo "Wrong parameter $action."