~ubuntu-branches/ubuntu/saucy/clamav/saucy-backports

« back to all changes in this revision

Viewing changes to debian/common_functions

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2014-07-15 01:08:10 UTC
  • mfrom: (0.35.47 sid)
  • Revision ID: package-import@ubuntu.com-20140715010810-ru66ek4fun2iseba
Tags: 0.98.4+dfsg-2~ubuntu13.10.1
No-change backport to saucy (LP: #1341962)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
status_of_proc () {
2
 
    local pidfile daemon name status
3
 
 
4
 
    pidfile=
5
 
    OPTIND=1
6
 
    while getopts p: opt ; do
7
 
        case "$opt" in
8
 
            p)  pidfile="$OPTARG";;
9
 
        esac
10
 
    done
11
 
    shift $(($OPTIND - 1))
12
 
 
13
 
    if [ -n "$pidfile" ]; then
14
 
        pidfile="-p $pidfile"
15
 
    fi
16
 
    daemon="$1"
17
 
    name="$2"
18
 
 
19
 
    status="0"
20
 
    pidofproc $pidfile $daemon >/dev/null || status="$?"
21
 
    if [ "$status" = 0 ]; then
22
 
        log_success_msg "$name is running"
23
 
        return 0
24
 
    else
25
 
        log_failure_msg "$name is not running"
26
 
        return $status
27
 
    fi
28
 
}
29
 
 
30
1
to_lower()
31
2
{
32
3
  word="$1"
162
133
  fi
163
134
}
164
135
 
 
136
pathfind() {
 
137
  OLDIFS=”$IFS”
 
138
  IFS=:
 
139
  for p in $PATH; do
 
140
    if [ -x ”$p/$*” ]; then
 
141
      IFS=”$OLDIFS”
 
142
      return 0
 
143
    fi
 
144
  done
 
145
  IFS=”$OLDIFS”
 
146
  return 1
 
147
}
 
148
 
 
149
set_debconf_value()
 
150
{
 
151
prog=$1
 
152
name=$2
 
153
eval variable="\$${name}"
 
154
if [ -n "$variable" ]; then
 
155
  db_set clamav-$prog/$name "$variable" || true
 
156
fi
 
157
}
 
158
 
165
159
make_dir()
166
160
{
167
161
  DIR=$1
171
165
  [ -n "$User" ] || User=clamav
172
166
  mkdir -p -m 0755 "$DIR"
173
167
  chown "$User" "$DIR"
174
 
  [ -x /sbin/restorecon ] && /sbin/restorecon "$DIR"
 
168
  pathfind restorecon && restorecon "$DIR"
175
169
}
176
170
 
177
171
# Debconf Functions