]>
Commit | Line | Data |
---|---|---|
caf1e72f JB |
1 | --- selinux-sandbox-2.7/sandbox.init.orig 2017-08-04 15:31:00.000000000 +0200 |
2 | +++ selinux-sandbox-2.7/sandbox.init 2017-11-20 19:05:49.396431050 +0100 | |
3 | @@ -1,4 +1,4 @@ | |
4 | -#!/bin/bash | |
5 | +#!/bin/sh | |
6 | ## BEGIN INIT INFO | |
7 | # Provides: sandbox | |
8 | # Default-Start: 3 4 5 | |
9 | @@ -19,50 +19,50 @@ | |
10 | # | |
11 | ||
12 | # Source function library. | |
13 | -. /etc/init.d/functions | |
14 | +. /etc/rc.d/init.d/functions | |
15 | + | |
16 | +[ -f /etc/sysconfig/sandbox-init ] && . /etc/sysconfig/sandbox-init | |
17 | ||
18 | LOCKFILE=/var/lock/subsys/sandbox | |
19 | ||
20 | -base=${0##*/} | |
21 | +RETVAL=0 | |
22 | ||
23 | start() { | |
24 | - echo -n "Starting sandbox" | |
25 | - | |
26 | - [ -f "$LOCKFILE" ] && return 0 | |
27 | - | |
28 | - touch $LOCKFILE | |
29 | - mount --make-rshared / || return $? | |
30 | - return 0 | |
31 | + if [ -f "$LOCKFILE" ]; then | |
32 | + msg_already_running "sandbox" | |
33 | + return | |
34 | + fi | |
35 | + msg_starting "sandbox" | |
36 | + mount --make-rshared / | |
37 | + RETVAL=$? | |
38 | + [ $RETVAL -eq 0 ] && touch "$LOCKFILE" | |
39 | } | |
40 | ||
41 | stop() { | |
42 | - echo -n "Stopping sandbox" | |
43 | - | |
44 | - [ -f "$LOCKFILE" ] || return 1 | |
45 | + if [ ! -f "$LOCKFILE" ]; then | |
46 | + msg_not_running "sandbox" | |
47 | + return | |
48 | + fi | |
49 | + msg_stopping "sandbox" | |
50 | + rm -f "$LOCKFILE" | |
51 | } | |
52 | ||
53 | status() { | |
54 | if [ -f "$LOCKFILE" ]; then | |
55 | - echo "$base is running" | |
56 | + echo "sandbox is running" | |
57 | else | |
58 | - echo "$base is stopped" | |
59 | + echo "sandbox is stopped" | |
60 | fi | |
61 | exit 0 | |
62 | } | |
63 | ||
64 | case "$1" in | |
65 | - restart) | |
66 | - start && success || failure | |
67 | - ;; | |
68 | - | |
69 | - start) | |
70 | - start && success || failure | |
71 | - echo | |
72 | + start|restart) | |
73 | + start | |
74 | ;; | |
75 | ||
76 | stop) | |
77 | - stop && success || failure | |
78 | - echo | |
79 | + stop | |
80 | ;; | |
81 | ||
82 | status) | |
83 | @@ -70,7 +70,9 @@ | |
84 | ;; | |
85 | ||
86 | *) | |
87 | - echo $"Usage: $0 {start|stop|status|restart}" | |
88 | - exit 3 | |
89 | + msg_usage "$0 {start|stop|status|restart}" | |
90 | + RETVAL=3 | |
91 | ;; | |
92 | esac | |
93 | + | |
94 | +exit $RETVAL |