#!/opt/panel-migrator/thirdparties/python/bin/python
# vim:filetype=python

import sys
import platform
import os.path

execution_path = __file__
if platform.system() != 'Windows':
	while os.path.islink(execution_path):
		execution_path = os.readlink(execution_path)

script_dir = os.path.dirname(execution_path)

base_dir = os.path.abspath(os.path.join(script_dir, '..'))
lib_dir = os.path.join(base_dir, 'lib')
# store variable data (configs, logs and sessions) in base dir
var_dir = base_dir

# include panel migrator modules into sys.path
sys.path.extend([os.path.join(lib_dir, 'python2.7', 'site-packages')])
# necessary to run panel migrator from sources
sys.path.extend([os.path.join(lib_dir, 'python')])

from parallels.core.cli.migration_cli import run

if __name__ == '__main__':
	sys.exit(run(base_dir, var_dir, execution_path, sys.argv[1:]))