summaryrefslogtreecommitdiff
path: root/source4/setup
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-09-12 20:21:53 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-09-12 20:52:00 +1000
commit8268c2d4e231b05b439bc70331b75342b35daa4e (patch)
treea105880fc0929d391a4a6d7afa059d3eb5759b2b /source4/setup
parent3e246a3cf47214b95fa7d45dafa24b98271c657b (diff)
downloadsamba-8268c2d4e231b05b439bc70331b75342b35daa4e.tar.gz
samba-8268c2d4e231b05b439bc70331b75342b35daa4e.tar.bz2
samba-8268c2d4e231b05b439bc70331b75342b35daa4e.zip
s4-s3-upgrade Remove upgrade_from_s3 script, use samba-tool domain samba3upgrade
Diffstat (limited to 'source4/setup')
-rwxr-xr-xsource4/setup/tests/blackbox_s3upgrade.sh7
-rwxr-xr-xsource4/setup/upgrade_from_s3132
2 files changed, 5 insertions, 134 deletions
diff --git a/source4/setup/tests/blackbox_s3upgrade.sh b/source4/setup/tests/blackbox_s3upgrade.sh
index 59bd70e811..44da3234bf 100755
--- a/source4/setup/tests/blackbox_s3upgrade.sh
+++ b/source4/setup/tests/blackbox_s3upgrade.sh
@@ -10,6 +10,9 @@ fi
PREFIX=`pwd`"/$1"
shift 1
+samba4bindir="$BINDIR"
+samba_tool="$samba4bindir/samba-tool$EXEEXT"
+
. `dirname $0`/../../../testprogs/blackbox/subunit.sh
rm -rf $PREFIX/samba3-upgrade
@@ -35,7 +38,7 @@ cat - > $PREFIX/samba3-upgrade/samba3/smb1.conf <<EOF
debug level = 0
EOF
-testit "samba3-upgrade-member" $PYTHON $SRCDIR/source4/setup/upgrade_from_s3 $PREFIX/samba3-upgrade/samba3/smb1.conf $PREFIX/samba3-upgrade/s4_1 --libdir=$PREFIX/samba3-upgrade/samba3
+testit "samba3-upgrade-member" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb1.conf $PREFIX/samba3-upgrade/s4_1 --libdir=$PREFIX/samba3-upgrade/samba3
# Test 2 (s3 dc)
cat - > $PREFIX/samba3-upgrade/samba3/smb2.conf <<EOF
@@ -56,7 +59,7 @@ cat - > $PREFIX/samba3-upgrade/samba3/smb2.conf <<EOF
domain logons = yes
EOF
-testit "samba3-upgrade-dc" $PYTHON $SRCDIR/source4/setup/upgrade_from_s3 $PREFIX/samba3-upgrade/samba3/smb2.conf $PREFIX/samba3-upgrade/s4_2 --libdir=$PREFIX/samba3-upgrade/samba3
+testit "samba3-upgrade-dc" $samba_tool domain samba3upgrade $PREFIX/samba3-upgrade/samba3/smb2.conf $PREFIX/samba3-upgrade/s4_2 --libdir=$PREFIX/samba3-upgrade/samba3
rm -rf $PREFIX/samba3-upgrade
diff --git a/source4/setup/upgrade_from_s3 b/source4/setup/upgrade_from_s3
deleted file mode 100755
index 6aaf99d8c6..0000000000
--- a/source4/setup/upgrade_from_s3
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/usr/bin/env python
-#
-# Upgrade from Samba3
-# Copyright Jelmer Vernooij 2005-2007
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import logging
-import optparse
-import os, sys
-import tempfile
-
-# Find right directory when running from source tree
-sys.path.insert(0, "bin/python")
-
-import samba
-import samba.getopt as options
-from samba.auth import system_session
-from samba.upgrade import upgrade_from_samba3
-from samba.samba3 import Samba3
-from samba.samba3 import param as s3param
-from samba.provision import ProvisioningError
-
-def get_testparm_var(testparm, varname):
- cmd = "%s -s -l --parameter-name='%s' 2>/dev/null" % (testparm, varname)
- output = os.popen(cmd, 'r').readline()
- return output.strip()
-
-cmd_help = """upgrade_from_s3 [options] <configuration_file> <targetdir>
-
-Input arguments are:
- <configuration_file> - path to existing smb.conf
- <targetdir> - directory in which samba4 database will be created
-
-In addition, specify either samba3 database directory (with --libdir) or
-samba3 testparm utility (with --testparm). """
-
-parser = optparse.OptionParser(cmd_help)
-parser.add_option_group(options.VersionOptions(parser))
-parser.add_option("--quiet", help="Be quiet")
-parser.add_option("--libdir", type="string", metavar="DIR",
- help="samba3 database directory")
-parser.add_option("--testparm", type="string", metavar="PATH",
- help="samba3 testparm utility")
-parser.add_option("--use-xattrs", type="choice", choices=["yes","no","auto"], help="Define if we should use the native fs capabilities or a tdb file for storing attributes likes ntacl, auto tries to make an inteligent guess based on the user rights and system capabilities", default="auto")
-
-opts, args = parser.parse_args()
-
-if len(args) < 2:
- parser.print_usage()
- sys.exit(1)
-
-smbconf = args[0]
-if not os.path.exists(smbconf):
- print("error: %s does not exist" % smbconf)
- sys.exit(1)
-
-targetdir = args[1]
-if not os.path.isdir(targetdir):
- print("error: %s is not a directory" % targetdir)
- sys.exit(1)
-
-libdir = opts.libdir
-testparm = opts.testparm
-
-if not libdir and not testparm:
- print("error: please specify either libdir or testparm")
- sys.exit(1)
-
-if libdir and testparm:
- print("warning: both libdir and testparm specified, libdir will be ignored.")
- libdir = None
-
-logger = logging.getLogger("upgrade")
-logger.addHandler(logging.StreamHandler(sys.stdout))
-if opts.quiet:
- logger.setLevel(logging.WARNING)
-else:
- logger.setLevel(logging.INFO)
-
-s3conf = s3param.get_context()
-
-eadb = True
-if opts.use_xattrs == "yes":
- eadb = False
-elif opts.use_xattrs == "auto" and not s3conf.get("posix:eadb"):
- file = tempfile.NamedTemporaryFile()
- try:
- samba.ntacls.setntacl(lp, file.name,
- "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
- eadb = False
- except:
- logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. "
- "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.")
- file.close()
-
-# Set correct default values from libdir or testparm
-paths = {}
-if libdir:
- paths["state directory"] = libdir
- paths["private dir"] = libdir
- paths["lock directory"] = libdir
-else:
- paths["state directory"] = get_testparm_var(testparm, "state directory")
- paths["private dir"] = get_testparm_var(testparm, "private dir")
- paths["lock directory"] = get_testparm_var(testparm, "lock directory")
-
-for p in paths:
- s3conf.set(p, paths[p])
-
-# load smb.conf parameters
-logger.info("Reading smb.conf")
-s3conf.load(smbconf)
-samba3 = Samba3(smbconf, s3conf)
-
-logger.info("Provisioning")
-try:
- upgrade_from_samba3(samba3, logger, targetdir, session_info=system_session(), useeadb=eadb)
-except ProvisioningError, e:
- print str(e)
- exit(1)