Added replication from windows to linux vm

This commit is contained in:
Pedro Pinto committed 2017-10-19 11:23:59 -04:00
1 parent 63746443bc
commit 87501c4d8d
3 files changed
+67 -1

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
from shutil import copyfile
import os, sys, subprocess, time
spark_profile = \
'''\
root = $SOURCE
root = socket://192.168.99.100:8080/$TARGET
ignore = Path build
ignore = Path .git
ignore = Path externals
ignore = Path docker
ignore = Regex .*\.pyc
ignore = Path x64
repeat = watch
batch = true
force = $SOURCE
confirmbigdel = false
ignorearchives = true
'''
this_path = os.path.realpath(__file__)
repo_root = os.path.abspath(os.path.dirname(this_path))
repo_root = os.path.join(repo_root,os.pardir)
repo_root = os.path.join(repo_root,os.pardir)
repo_root = os.path.abspath(repo_root)
repo_name = os.path.basename(repo_root)
profile_loc = os.path.join(os.path.abspath(os.environ['USERPROFILE']),'.unison')
spark_profile = spark_profile.replace("$SOURCE", repo_root)
spark_profile = spark_profile.replace("$TARGET", repo_name)
unison_exe = os.path.join(repo_root,"externals","windows","bin","unison.exe")
if not os.path.exists(profile_loc):
os.mkdir(profile_loc)
with open(os.path.join(profile_loc,repo_name), "w") as text_file:
text_file.write(spark_profile)
while True:
subprocess.call((unison_exe,repo_name))
time.sleep(10)
+23
View File
@@ -0,0 +1,23 @@
#/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker run \
--rm \
-i \
-p 8000:8000 \
-p 8001:8001 \
-p 8080:8080 \
--net host \
-v /etc/passwd:/etc/passwd \
-v /etc/group:/etc/group \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-h $(hostname)_spark \
-w $PWD \
-u $UID \
-v /home:/home \
-e DISPLAY=$DISPLAY \
-t bluetradingsystems/linux_docker \
/bin/bash -c "(cd ~/config && python -m SimpleHTTPServer >/dev/null 2>/dev/null) & (cd ~ && $DIR/../externals/linux/bin/unison -socket 8080) & /bin/bash"