summaryrefslogtreecommitdiff
path: root/packaging/Debian/debian/samba.preinst
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2002-02-02 15:44:37 +0000
committerGerald Carter <jerry@samba.org>2002-02-02 15:44:37 +0000
commitc8bc0fa4a7be25cb926750a56085e1e98ed9046b (patch)
treeec7bb9c0ce893fda80a6eb1f264c4717b3f667ac /packaging/Debian/debian/samba.preinst
parent8cb4e23ffc77a9842e1304f3de20af5861982746 (diff)
downloadsamba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.tar.gz
samba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.tar.bz2
samba-c8bc0fa4a7be25cb926750a56085e1e98ed9046b.zip
merge from 2.2
(This used to be commit 473a89cde2e60c359cb435c714dc98974489a118)
Diffstat (limited to 'packaging/Debian/debian/samba.preinst')
-rw-r--r--packaging/Debian/debian/samba.preinst47
1 files changed, 47 insertions, 0 deletions
diff --git a/packaging/Debian/debian/samba.preinst b/packaging/Debian/debian/samba.preinst
new file mode 100644
index 0000000000..6ebefb8fb1
--- /dev/null
+++ b/packaging/Debian/debian/samba.preinst
@@ -0,0 +1,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