summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian/samba.preinst
blob: 6ebefb8fb1bb6bd02504aea9063ab72d4cb28468 (plain)
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
#!/bin/sh
#
# The purpose of the preinst script for the samba package is to help
#	the migration of the conffiles smb.conf and smbpasswd from their
#	old location (/etc/) to their new location (/etc/samba/).
#
# Thanks to Ben Pfaff <pfaffben@pilot.msu.edu> for sharing on debian-devel
#	his ideas about how to move conffiles to new locations.
#

# First see if a smb.conf file currently exists.
test -f /etc/smb.conf || exit 0

# Now see if a smb.conf file exists in the new location.
test -e /etc/samba/smb.conf && exit 0

#
# Move smb.conf conffile from its old location (/etc/) to its new one
#	(/etc/samba).
#
# If conffile exists in old location AND conffile does not exist on new
#	location then...
#
if [ -f /etc/smb.conf -a ! -e /etc/samba/smb.conf ]; then
	# The new location for the conffile should not exist yet, so we create the
	#	dir.
	mkdir -p /etc/samba

	# Finally, move the conffile to its new location.
	mv /etc/smb.conf /etc/samba/smb.conf
fi

#
# Move smbpasswd conffile from its old location (/etc/) to its new one
#	(/etc/samba).
#
# If conffile exists in old location AND conffile does not exist on new
#	location then...
#
if [ -f /etc/smbpasswd -a ! -e /etc/samba/smbpasswd ]; then
	# The new location for the conffile should not exist yet, so we create the
	#	dir.
	mkdir -p /etc/samba

	# Finally, move the conffile to its new location.
	mv /etc/smbpasswd /etc/samba/smbpasswd
fi