File: test2

package info (click to toggle)
switchconf 0.0.16-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 172 kB
  • sloc: sh: 437; makefile: 121
file content (53 lines) | stat: -rwxr-xr-x 1,150 bytes parent folder | download | duplicates (3)
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
#!/bin/bash
set -e

# test the funcionality of init.d

# Check if the Setup for the test work
CODE=`grep conf= debian/init.d`
CMDLINE=`mktemp`

cp /proc/cmdline $CMDLINE
chmod u+w $CMDLINE
eval $CODE
conf=${conf:-vazio}
if [ $conf != "vazio" ] ; then
    echo "Failed to setup test"
    echo "conf=$conf"
    echo "$CMDLINE=" `cat $CMDLINE`
    exit 1
fi

echo "switchconf=end" >>$CMDLINE 
eval $CODE
if [ A$conf != "Aend" ] ; then
    echo "Failed to read option from end"
    echo "conf=$conf"
    echo "$CMDLINE=" `cat $CMDLINE`
    exit 1
fi

echo "switchconf=start" > $CMDLINE
cat /proc/cmdline >> $CMDLINE
eval $CODE
if [ A$conf != "Astart" ] ; then
    echo "Failed to read option from start"
    echo "conf=$conf"
    echo "$CMDLINE=" `cat $CMDLINE`
    exit 1
fi

echo "test middle2 switchconf=middle test4" > $CMDLINE
eval $CODE
if [ A$conf != "Amiddle" ] ; then
    echo "Failed to read option from middle"
    echo "conf=$conf"
    echo "$CMDLINE=" `cat $CMDLINE`
    exit 1
fi

echo "switconf=start test middle2 switchconf=middle test4 switchconf=end" > $CMDLINE
eval $CODE
echo "For multiple options in cmdline conf=$conf"

rm $CMDLINE