Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / testset / maintainer-scripts / debian / postinst
1 #! /bin/sh
2
3 if [ "$1" = "configure" ]; then
4         if [ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a -d /usr/share/doc/maintainer-scripts ]; then
5                 ln -sf ../share/doc/maintainer-scripts /usr/doc/maintainer-scripts
6         fi
7 fi
8
9 # valid
10 . /usr/share/lintian/shell || exit 0
11 . /usr/share/lintian/shell >/dev/null
12 . /usr/share/lintian/shell 2>/dev/null
13 . /usr/share/lintian/shell </dev/null
14 . "$(dirname $0)/shell" ; bar
15 # invalid
16 . /usr/share/lintian/shell foo
17 . "$(dirname $0)/shell" bar
18
19 print "Hit enter to continue"
20 read
21
22 H[0]='this is a string'
23 echo ${H[0]}
24 echo "Index 0's length is ${#H[0]}"
25 echo "All of the array is: ${H[@]}"
26
27 install-info /usr/share/info/foo \
28         --quiet \ # make it so
29         --section foo
30
31 echo Please use update-rc.d or invoke-rc.d to set up blah blah.
32
33 wm-menu-config
34
35 chown root.root /usr/share/doc/maintainer-scripts/changelog
36 chown root:root /usr/share/doc/maintainer-scripts/changelog
37
38 $FOO=bar
39 update-rc.d foo defaults >/dev/null
40 update-rc.d $FOO defaults
41 update-rc.d foo remove
42
43 # valid
44 FOO=/tmp
45 FOO=/var/tmp
46 : ${FOO:=/tmp}
47 FOO=`mktemp /tmp/scripts.XXXXXX`
48 rm "$FOO"
49 FOO=`tempfile -n/tmp/scripts.tmp`
50 mkdir /var/tmp/scripts
51 # invalid
52 echo foo >>/tmp/scripts.tmp
53 rm /tmp/scripts.tmp
54 rmdir /var/tmp/scripts
55
56 # invalid, maintainer-script-hides-init-failure
57 invoke-rc.d foo start || exit 0
58
59 # The right way to invoke an rc script
60 if which invoke-rc.d >/dev/null 2>&1; then
61     invoke-rc.d package start
62 else
63     /etc/init.d/package start
64 fi
65
66 # Example ucf invocation.
67 ucf /usr/share/foo/configuration /etc/foo.conf
68
69 # Calling gconftool directly.
70 gconftool-2 --makefile-install-rule foo.schema
71
72 # Calling gconf-schemas with no dependency.
73 gconf-schemas --register foo.schema
74
75 # Calling update-xmlcatalog with no dependency.
76 update-xmlcatalog --add --type system --id "/usr/share/sgml/dtd/foo" \
77     --package maintainer-scripts --root
78
79 # Maintainer scripts shouldn't touch /var/lib/dpkg/status.  This is the old
80 # recipe from the dpkg wiki that should be replaced with dpkg-query.
81 sed -n -e \"/^Conffiles:/,/^[^ ]/{\\\\' /etc/conffile'{s/.* //;p}}\" \
82     /var/lib/dpkg/status
83
84 # Don't modify these files.
85 echo 'broken    6714/tcp' >> /etc/services
86 cp /nonexistent /etc/protocols
87 mv /usr/share/doc/rpc /etc/rpc
88
89 # But this is okay.
90 cp /etc/protocols /etc/protocols.new
91
92 # This is also wrong.
93 echo 'broken' > /etc/inetd.conf
94 cp /etc/inetd.conf.new /etc/inetd.conf
95
96 # But this is fine.
97 cp /etc/inetd.conf /srv/chroot/etc/inetd.conf
98
99 # Deprecated and not allowed except the second one.
100 install-sgmlcatalog --install package
101 install-sgmlcatalog --remove package
102
103 # This too is a heredoc.
104 some-program > /etc/config-file <<'EOF'
105 echo "All of the array is: ${H[@]}"
106 EOF
107
108 # But this isn't.
109 cat '<<EOF'
110 echo "All of the array is: ${H[@]}"
111 EOF
112
113 # This is a heredoc
114 cat <<-EOF
115 echo "All of the arry is ${H[@]}"
116 EOF
117
118 # As is this
119 cat <<';'
120 echo "All of the array is ${H[@]}"
121 ;
122
123 # and this
124 cat <<foo
125 echo "All of the array is ${H[@]}"
126 foobar
127 echo $HOSTNAME
128 foo
129
130 # and again
131 cat <<\bar
132 echo "All of the array is ${H[@]}"
133 bar
134
135 # yet another
136 cat <<"x++"
137 echo "All of the array is ${H[@]}"
138 x++
139
140 # Recognize single quotes even if they start at the beginning of a line.
141 echo not a bashism \
142 '/{ptex,tex}/{amstex,plain,generic,}'
143
144 # More bashisms.
145 echo -e 'foo\n'
146 echo "${!foo}"
147 cat $(\< file)
148 select foo in a b ; do echo $foo ; done
149 cnt=$((cnt + 1))
150 if false ; then
151     exec -l /bin/sh
152     exec -c /bin/sh
153     exec -a foo /bin/sh
154 fi
155 let cnt++
156 if test -a /etc/default ; then
157     echo "$RANDOM|stuff"
158 fi
159
160 # Calling start-stop-daemon directly in an init script.
161 start-stop-daemon --start --quiet --name foo --startas /usr/bin/foo
162
163 # But stopping it is fine -- we may be working around something else.
164 start-stop-daemon --stop --quiet --name foo --startas /usr/bin/foo
165
166 # Deprecated chown use with flags.
167 chown -R root.root /usr/share/doc/maintainer-scripts