This file is indexed.

/etc/init.d/vdr is in vdr 2.0.3-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#! /bin/bash -p
#
# vdr start-stop script
#
### BEGIN INIT INFO
# Provides:          vdr
# Required-Start:    $remote_fs $network $syslog
# Required-Stop:     $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Starts the Linux Video Disk Recorder (VDR)
# Description:       Starts the Linux Video Disk Recorder (VDR),
#                    if it is enabled in /etc/default/vdr.
### END INIT INFO

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=vdr
DESC="Linux Video Disk Recorder"

DAEMON=/usr/sbin/runvdr
PIDFILE=/var/run/runvdr.pid
VDRPRG=/usr/bin/vdr

test -x $DAEMON || exit 0
test -x $VDRPRG || exit 0

. /usr/lib/vdr/config-loader.sh

# Set shutdown command
test "$ENABLE_SHUTDOWN" = "1" && VDRSHUTDOWN="/usr/lib/vdr/vdr-shutdown.wrapper" \
                              || VDRSHUTDOWN=""

. /usr/lib/vdr/plugin-loader.sh
. /usr/lib/vdr/commands-loader.sh


clean_console()
{
    if [ "$KEYB_TTY" != "" ]; then
        tput -Tlinux clear > $KEYB_TTY
    fi
}

configure_console_input()
{
    if [ "$KEYB_TTY" != "" ]; then
        clean_console
        echo -e "This tty is currently mapped to VDR, keypresses aren't echoed.\r" > $KEYB_TTY
        echo -n "For a login prompt switch to another console." > $KEYB_TTY
        REDIRECT="< $KEYB_TTY"
        if [ "$KEYB_TTY_SWITCH" = "1" ]; then
            chvt `echo "$KEYB_TTY" | sed "s/\/dev\/tty//"`
        fi
    fi
}

get_status()
{
    if start-stop-daemon --start --startas $DAEMON --test \
        --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
    then
        echo " - is not running."
        exit 3
    else
        echo " - is running."
        exit 0
    fi
}

startvdr()
{
    if [ "$ENABLED" != "0" ] ; then
        # only start vdr if there is no other instance running
        if start-stop-daemon --start --startas $DAEMON --test \
            --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
        then
            getplugins
            mergecommands "commands"
            mergecommands "reccmds"
            configure_console_input

            if [ "$VFAT" == "1" ]; then
                OPTIONS="--vfat $OPTIONS"
            fi

            if [ -n "$LIRC" ]; then
                LIRC_OPT="--lirc=$LIRC"
            else
                LIRC_OPT="--lirc"
            fi

            if [ "$ENABLE_CORE_DUMPS" == "1" ]; then
                ulimit -c unlimited
                OPTIONS="$OPTIONS --userdump"
            fi

            start-stop-daemon --start --quiet --startas $DAEMON --background -d /tmp \
                --name $(basename $DAEMON) --pidfile $PIDFILE --make-pidfile -- \
                -v $VIDEO_DIR -c $CFG_DIR -L $PLUGIN_DIR -r $REC_CMD \
                -s $VDRSHUTDOWN -E $EPG_FILE -u $USER -g /tmp \
                --port $SVDRP_PORT $OPTIONS $LIRC_OPT $PLUGINS $REDIRECT
        else
            echo -n " - seems to be running already"
        fi
    else
        echo -n " - aborted (to enable the daemon, edit /etc/default/vdr)"
    fi
}

stopvdr()
{
    if start-stop-daemon --stop --retry 30 \
        --name $(basename $DAEMON) --pidfile $PIDFILE >/dev/null
    then
        start-stop-daemon --stop --retry 30 --oknodo --exec $VDRPRG >/dev/null
        rm -f $PIDFILE
        clean_console
    else
        echo -n " - seems not to be running"
    fi
}

case "$1" in
    start)
        echo -n "Starting $DESC: $NAME"
        startvdr
        echo "."
        ;;
    stop)
        echo -n "Stopping $DESC: $NAME"
        stopvdr
        echo "."
        ;;
    restart|force-reload)
        echo -n "Restarting $DESC: $NAME"
        stopvdr
        sleep 4
        startvdr
        echo "."
        ;;
    status)
        echo -n "Getting status of $DESC: $NAME"
        get_status
        ;;
    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0