File: common

package info (click to toggle)
insserv 1.27.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 884 kB
  • sloc: ansic: 5,171; sh: 2,277; perl: 563; makefile: 201
file content (110 lines) | stat: -rwxr-xr-x 2,411 bytes parent folder | download | duplicates (8)
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
#!/bin/bash

basedir=$(dirname $0)
. $basedir/suite

##########################################################################
test_simple_sequence() {
echo
echo "info: test simple script ordering."
echo

initdir_purge

insertscript firstscript <<'EOF' || true
### BEGIN INIT INFO
# Provides:          firstscript
# Required-Start:    
# Required-Stop:     
# Default-Start:     2 3 4 5
# Default-Stop:
### END INIT INFO
EOF

insertscript middlescript <<'EOF' || true
### BEGIN INIT INFO
# Provides:          middlescript
# Required-Start:    firstscript
# Required-Stop:     firstscript
# Default-Start:     2 3 4 5
# Default-Stop:
### END INIT INFO
EOF

insertscript lastscript <<'EOF' || true
### BEGIN INIT INFO
# Provides:          lastscript
# Required-Start:    middlescript
# Required-Stop:     middlescript
# Default-Start:     2 3 4 5
# Default-Stop:
### END INIT INFO
EOF

list_rclinks

check_script_present 2 firstscript
check_script_present 3 firstscript
check_script_present 4 firstscript
check_script_present 5 firstscript
check_order 3 firstscript middlescript
check_order 3 middlescript lastscript
}
##########################################################################
test_undetected_loop() {
echo
echo "info: test if loop involving virtual facility is detected."
echo

initdir_purge
set +C
cat <<'EOF' > $insconf
$local_fs       mountall
EOF
set -C

insertscript hibernate <<EOF
### BEGIN INIT INFO
# Provides:          hibernate-cleanup
# Default-Start:     3
# Default-Stop:
# Required-Start:
# Required-Stop:
# Should-Start:      udev devfsd raid2 mdadm lvm evms cryptdisks
# X-Start-Before:    mountall
### END INIT INFO
EOF

insertscript mountall.sh <<EOF
### BEGIN INIT INFO
# Provides:          mountall
# Required-Start:
# Required-Stop:
# Default-Start:     3
# Default-Stop:
# Short-Description: Mount all filesystems.
### END INIT INFO
EOF

# This should fail, as it introduce a loop
if insertscript mdadm <<'EOF' ; then
### BEGIN INIT INFO
# Provides:          mdadm
# Required-Start:    $local_fs
# Required-Stop:     $local_fs
# Default-Start:     3
# Default-Stop:
### END INIT INFO
EOF
    counttest
    error "Able to insert mdadm even though it introduce a loop"
fi
echo insserv.conf:
cat $insconf
list_rclinks
check_order 3 hibernate mountall.sh
}
##########################################################################

test_simple_sequence
test_undetected_loop