This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
windows:hgsync [2021/10/20 14:49] tschulz [hgsync_login_ssh.cmd] |
windows:hgsync [2021/10/20 14:59] tschulz [hgsync_logout.cmd] |
||
---|---|---|---|
Line 3: | Line 3: | ||
===== Client Side ===== | ===== Client Side ===== | ||
- | ==== merge.cmd ==== | + | ==== merge.bat ==== |
<code batch merge.cmd> | <code batch merge.cmd> | ||
Line 16: | Line 16: | ||
==== merge_other.cmd ==== | ==== merge_other.cmd ==== | ||
- | <code batch merge_other.cmd> | + | <code batch merge_other.bat> |
echo %2 | echo %2 | ||
copy %2 %1.%COMPUTERNAME%.conflict | copy %2 %1.%COMPUTERNAME%.conflict | ||
Line 23: | Line 23: | ||
</code> | </code> | ||
- | ==== hgsync_login.cmd ==== | ||
- | |||
- | <code batch hgsync_login.cmd> | ||
- | @echo off | ||
- | |||
- | set LOCAL_REPO="%USERPROFILE%\Documents" | ||
- | set REMOTE_REPO="h:\Documents" | ||
- | set SSH_REPO="ssh://%USERNAME%@sfs/Documents" | ||
- | set PATH=C:\Progra~1\Mercurial;C:\Windows\System32\OpenSSH; | ||
- | |||
- | If exist "%LOCAL_REPO%\.hg" ( | ||
- | If exist "%REMOTE_REPO%\.hg" ( | ||
- | goto Remoteandlocal | ||
- | ) else ( | ||
- | goto onlylocal | ||
- | ) | ||
- | ) else If exist "%REMOTE_REPO%\.hg" ( | ||
- | goto onlyremote | ||
- | ) else If exist "%LOCAL_REPO%\.hg" ( | ||
- | goto onlylocal | ||
- | ) else ( | ||
- | goto missingonboth | ||
- | ) | ||
- | |||
- | goto end | ||
- | |||
- | |||
- | :Remoteandlocal | ||
- | Echo File exist remote and local | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | ||
- | hg pull %REMOTE_REPO% | ||
- | hg merge -t "W:\scripts\merge.bat" | ||
- | hg resolve -t internal:other --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | h: | ||
- | cd %REMOTE_REPO% | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | hg merge -t "W:\scripts\merge_other.bat" | ||
- | hg resolve -t internal:local --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg pull %REMOTE_REPO% | ||
- | hg update | ||
- | goto END | ||
- | |||
- | :onlylocal | ||
- | Echo File exist only local | ||
- | mkdir %REMOTE_REPO% | ||
- | H: | ||
- | cd %REMOTE_REPO% | ||
- | hg init | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | H: | ||
- | cd %REMOTE_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "remote update from %COMPUTERNAME%" | ||
- | hg merge -t "W:\scripts\merge.bat" | ||
- | hg resolve -t internal:other --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "remote merge update from %COMPUTERNAME%" | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg pull %REMOTE_REPO% | ||
- | hg merge -t "W:\scripts\merge_other.bat" | ||
- | hg resolve -t internal:local --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | h: | ||
- | cd %REMOTE_REPO% | ||
- | hg update | ||
- | goto END | ||
- | |||
- | :onlyremote | ||
- | Echo File exist only remote | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg init | ||
- | hg pull %REMOTE_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | ||
- | hg merge -t "W:\scripts\merge.bat" | ||
- | hg resolve -t internal:other --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | h: | ||
- | cd %REMOTE_REPO% | ||
- | hg update | ||
- | goto END | ||
- | |||
- | :missingonboth | ||
- | Echo missing on both | ||
- | mkdir %LOCAL_REPO% | ||
- | C: | ||
- | cd %LOCAL_REPO% | ||
- | hg init | ||
- | mkdir %REMOTE_REPO% | ||
- | H: | ||
- | cd %REMOTE_REPO% | ||
- | hg init | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | H: | ||
- | cd %REMOTE_REPO% | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "remote update from %COMPUTERNAME%" | ||
- | hg merge -t "W:\scripts\merge.bat" | ||
- | hg resolve -t internal:other --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "remote merge update from %COMPUTERNAME%" | ||
- | c: | ||
- | cd %LOCAL_REPO% | ||
- | hg pull %REMOTE_REPO% | ||
- | hg merge -t "W:\scripts\merge_other.bat" | ||
- | hg resolve -t internal:local --all | ||
- | hg update | ||
- | hg addremove | ||
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | ||
- | hg push %REMOTE_REPO% | ||
- | h: | ||
- | cd %REMOTE_REPO% | ||
- | hg update | ||
- | goto END | ||
- | |||
- | :END | ||
- | echo done | ||
- | </code> | ||
==== hgsync_login_ssh.cmd ==== | ==== hgsync_login_ssh.cmd ==== | ||
Line 314: | Line 166: | ||
</code> | </code> | ||
- | ===== hgsync_logout.cmd ===== | ||
- | <code batch hgsync_logout.cmd> | + | ==== hgsync_logout_ssh.cmd ==== |
- | @echo off | + | |
- | set LOCAL_REPO="%USERPROFILE%\Documents" | + | |
- | set REMOTE_REPO="h:\Documents" | + | |
- | set PATH=C:\Progra~1\Mercurial;C:\Windows\System32\OpenSSH; | + | |
- | + | ||
- | If exist "%LOCAL_REPO%\.hg" ( | + | |
- | If exist "%REMOTE_REPO%\.hg" ( | + | |
- | goto Remoteandlocal | + | |
- | ) else ( | + | |
- | goto onlylocal | + | |
- | ) | + | |
- | ) else If exist "%REMOTE_REPO%\.hg" ( | + | |
- | goto onlyremote | + | |
- | ) else If exist "%LOCAL_REPO%\.hg" ( | + | |
- | goto onlylocal | + | |
- | ) else ( | + | |
- | goto missingonboth | + | |
- | ) | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | :Remoteandlocal | + | |
- | Echo File exist remote and local | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | + | |
- | hg pull %REMOTE_REPO% | + | |
- | hg merge -t "W:\scripts\merge_other.bat" | + | |
- | hg resolve -t internal:local --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | h: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | hg merge -t "W:\scripts\merge.bat" | + | |
- | hg resolve -t internal:other --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg pull %REMOTE_REPO% | + | |
- | hg update | + | |
- | goto END | + | |
- | + | ||
- | :onlylocal | + | |
- | Echo File exist only local | + | |
- | mkdir %REMOTE_REPO% | + | |
- | H: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg init | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | H: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "remote update from %COMPUTERNAME%" | + | |
- | hg merge -t "W:\scripts\merge.bat" | + | |
- | hg resolve -t internal:other --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "remote merge update from %COMPUTERNAME%" | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg pull %REMOTE_REPO% | + | |
- | hg merge -t "W:\scripts\merge_other.bat" | + | |
- | hg resolve -t internal:local --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | h: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg update | + | |
- | goto END | + | |
- | + | ||
- | :onlyremote | + | |
- | Echo File exist only remote | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg init | + | |
- | hg pull %REMOTE_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | + | |
- | hg merge -t "W:\scripts\merge_other.bat" | + | |
- | hg resolve -t internal:local --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | h: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg update | + | |
- | goto END | + | |
- | + | ||
- | :missingonboth | + | |
- | Echo missing on both | + | |
- | mkdir %LOCAL_REPO% | + | |
- | C: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg init | + | |
- | mkdir %REMOTE_REPO% | + | |
- | H: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg init | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | H: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "remote update from %COMPUTERNAME%" | + | |
- | hg merge -t "W:\scripts\merge.bat" | + | |
- | hg resolve -t internal:other --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "remote merge update from %COMPUTERNAME%" | + | |
- | c: | + | |
- | cd %LOCAL_REPO% | + | |
- | hg pull %REMOTE_REPO% | + | |
- | hg merge -t "W:\scripts\merge_other.bat" | + | |
- | hg resolve -t internal:local --all | + | |
- | hg update | + | |
- | hg addremove | + | |
- | hg --config ui.username=%USERNAME% commit -m "merge update from %COMPUTERNAME%" | + | |
- | hg push %REMOTE_REPO% | + | |
- | h: | + | |
- | cd %REMOTE_REPO% | + | |
- | hg update | + | |
- | goto END | + | |
- | + | ||
- | :END | + | |
- | echo done | + | |
- | </code> | + | |
- | + | ||
- | ===== hgsync_logout_ssh.cmd ===== | + | |
<code batch hgsync_logout_ssh.cmd> | <code batch hgsync_logout_ssh.cmd> | ||
Line 601: | Line 307: | ||
</code> | </code> | ||
- | ===== userkeygen.sh ===== | + | ===== Server Side ===== |
+ | |||
+ | ==== userkeygen.sh ==== | ||
<code bash /scripts/user_keygen.sh> | <code bash /scripts/user_keygen.sh> | ||
#!/bin/bash | #!/bin/bash | ||
Line 634: | Line 342: | ||
</code> | </code> | ||
+ | ==== hgsync_init.sh ==== | ||
+ | <code bash /scripts/hgsync_init.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | mkdir -p ~/Documents | ||
+ | cd ~/Documents | ||
+ | hg init | ||
+ | </code> | ||
+ | |||
+ | ==== hgsync_login.sh ==== | ||
+ | <code bash /scripts/hgsync_login.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | cd ~/Documents | ||
+ | hg commit -m "merge update" | ||
+ | hg merge -t internal:local | ||
+ | hg update | ||
+ | hg addremove | ||
+ | hg commit -m "merge update" | ||
+ | </code> | ||
+ | |||
+ | ==== hgsync_logout.sh ==== | ||
+ | <code bash /scripts/hgsync_logout.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | cd ~/Documents | ||
+ | hg commit -m "merge update" | ||
+ | hg merge -t internal:other | ||
+ | hg update | ||
+ | hg addremove | ||
+ | hg commit -m "merge update" | ||
+ | </code> | ||
+ | |||
+ | ==== hgsync_update.sh ==== | ||
+ | <code bash /scripts/hgsync_update.sh> | ||
+ | #!/bin/sh | ||
+ | |||
+ | cd ~/Documents | ||
+ | hg update | ||
+ | </code> | ||
+ | |||
+ | ==== /etc/pam.d/common-session ==== | ||
+ | <code pam/etc/pam.d/common-session> | ||
+ | ... | ||
+ | session required pam_mkhomedir.so skel=/etc/skel/ umask=0077 | ||
+ | session optional pam_exec.so /bin/bash /scripts/user_keygen.sh | ||
+ | ... | ||
+ | </code> |