File: dcmtk.postinst

package info (click to toggle)
dcmtk 3.5.4-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 23,784 kB
  • ctags: 22,942
  • sloc: cpp: 165,761; ansic: 46,396; sh: 3,808; perl: 3,465; makefile: 3,097
file content (69 lines) | stat: -rw-r--r-- 2,313 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

set -e

# Create dcmtk user and group

if ! getent passwd dcmtk >/dev/null 2>&1; then
    if ! getent group dcmtk > /dev/null 2>&1; then
	echo "Adding \`dcmtk' group to system ..."
	addgroup --quiet --system dcmtk || true
    fi
    echo "Adding \`dcmtk' user to system ..."
    adduser --quiet --system --ingroup dcmtk --home /var/lib/dcmtk/db \
	--shell /bin/sh --disabled-password dcmtk || true
fi

# work around possible adduser bug, see #119366
[ -d /var/lib/dcmtk/db ] || mkdir -p /var/lib/dcmtk/db
chmod 755 /var/lib/dcmtk/db
chown -h -R dcmtk:dcmtk /var/lib/dcmtk/db || true


# Handle imagectn -> dcmqrdb transition in (3.5.3 -> 3.5.4)


LASTVERSION=3.5.3-5

case "$1" in
configure)
    if dpkg --compare-versions "$2" le "$LASTVERSION"; then
	
	if [ -e "/etc/dcmtk/imagectn.cfg" ]; then
	    echo
	    echo "Configuration file /etc/dcmtk/imagectn.cfg has been modified by user."
	    echo "This file will be renamed to /etc/dcmtk/dcmqrscp.cfg."
	    echo "The package default version can be found in /etc/dcmtk/dcmqrscp.cfg.dpkg-new."
	    echo
	    mv -f /etc/dcmtk/dcmqrscp.cfg /etc/dcmtk/dcmqrscp.cfg.dpkg-new
	    mv -f /etc/dcmtk/imagectn.cfg /etc/dcmtk/dcmqrscp.cfg
	fi

	if [ -e "/etc/default/imagectn" ]; then
	    echo "Configuration file /etc/default/imagectn has been modified by user."
	    echo "This file will be converted to and replaced by /etc/default/dcmqrscp."
	    echo "The user's old version can be found in /etc/default/imagectn.dpkg-old."
	    echo "The package default version can be found in /etc/default/dcmqrscp.dpkg-new."  
	    echo
	    mv -f /etc/default/imagectn /etc/default/imagectn.dpkg-old
	    mv -f /etc/default/dcmqrscp /etc/default/dcmqrscp.dpkg-new
	    sed -e 's/IMAGECTN_ENABLE/DCMQRSCP_ENABLE/g' -e 's/imagectn/dcmqrscp/g' \
		</etc/default/imagectn.dpkg-old >/etc/default/dcmqrscp
	fi

	if [ -e "/etc/init.d/imagectn" ]; then 
	    echo "Configuration file /etc/init.d/imagectn has been modified by user."
	    echo "This file will be replaced by /etc/init.d/dcmqrscp."
            echo "The user's old version can be found in /etc/init.d/imagectn.dpkg-old"
	    echo
	    mv -f /etc/init.d/imagectn /etc/init.d/imagectn.dpkg-old
	fi
	# Remove (dangling) symlinks in /etc/rcN.d
	update-rc.d imagectn remove >/dev/null
    fi
esac



#DEBHELPER#