summaryrefslogtreecommitdiffstats
path: root/src/os-plugins/plugins/x11vnc/OpenSLX/Distro/Suse.pm
blob: f43a38935bcf4541e4d7a2ad93acf2ee52df95bb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright (c) 2008 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
# See http://openslx.org/COPYING
#
# If you have any feedback please consult http://openslx.org/feedback and
# send your suggestions, praise, or complaints to feedback@openslx.org
#
# General information about OpenSLX can be found at http://openslx.org/
# -----------------------------------------------------------------------------
# x11vnc/OpenSLX/Distro/Suse.pm
#    - provides SUSE-specific overrides of the Distro API for the x11vnc plugin.
# -----------------------------------------------------------------------------
package x11vnc::OpenSLX::Distro::Suse;

use strict;
use warnings;

use base qw(x11vnc::OpenSLX::Distro::Base);

use OpenSLX::Basics;
use OpenSLX::Utils;

################################################################################
### interface methods
################################################################################

sub fillRunlevelScript
{
    my $self     = shift;

    my $script = unshiftHereDoc(<<"    End-of-Here");
        #!/bin/sh
        # SuSE compatible start/stop script, generated via stage1 'x11vnc' plugin
        # installation
        #
        # inspiration taken from x11vnc start script:
        #   Copyright 1998-2007 x11vnc, Inc.  All rights reserved.
        #
        # This script manages the services needed to run x11vnc software
        
        # Basic support for the Linux Standard Base Specification 1.3
        ### BEGIN INIT INFO
        # Provides: x11vnc
        # Required-Start: \$syslog
        # Required-Stop:
        # Default-Start: 2 3 5
        # Default-Stop: 0 6
        # Short-Description: Manages the services needed to run x11vnc software
        # Description: Manages the services needed to run x11vnc software
        ### END INIT INFO

        # load the helper stuff
        . /etc/rc.status
        # reset the script status
        rc_reset
    
        [ -f /opt/openslx/plugin-repo/x11vnc/x11vnc-init ] \\
          && CMD="/opt/openslx/plugin-repo/x11vnc/x11vnc-init"

        case \$1 in
          start)
            echo -n "Starting x11vnc background services ..."
            \$CMD start
            rc_status -v
          ;;
          stop)
            # message output should match the given vendor-os
            echo -n "Stopping x11vnc background services ..."
            rc_reset
            \$CMD stop
            rc_status -v
          ;;
          #status)
          #  echo -n "Say something useful here ..."
          #;;
          restart)
            "\$0" stop
            "\$0" start
          ;;
          *)
            echo "Usage: `basename "\$0"` {start|stop|restart}"
            exit 1
         ;;
        esac
        exit 0
    End-of-Here
    return $script;
}

1;