Then
ipkg install py26-mercurial
(many mercurial flavours in repository btw: one for every major python version).Now mercurial should be installed somewhere in '/opt/bin' (which redirects to '/volume1/@optware/bin'), type
hg -v
to check this (or maybe hg-2.6 -v
as ipkg apparently let me do the symbolic link: ln /opt/bin/hg /opt/bin/hg-2.6
).You need to have some directory ready to hold a code repository, e.g. '//volume1/repos', executing
hg init /volume1/repos/testhg
will init/create a mercurial dir with (hidden) management files in it. We could start working in this, as a shared folder on the network (\\diskstation\repos\testhg), or via http (execute
cd /volume1/repos/testhg
, and hg serv
, it mounts an http server on port 8000, accessible via 'http://192.168.0.X:8000' !), or via ssh (through 'ssh://user@192.168.0.x//volume1/repos/testhg') ! So Nice !I finally choosed the ssh way, to easily secure transaction.
So, now
ssh
on synology: Let's activate the service using the web interface.
Test it using kitty or plink with:
plink.exe -ssh -2 root@192.168.0.X "set"
should print a lot of variables contents.But, if we execute
plink.exe -ssh -2 root@192.168.0.X "hg"
: it should fail with ash: hg: not found
. When the ssh daemon starts a session, it uses only a subset of the usual user environment, so our PATH variable is missing directories, hence cant find hg.We might override this by editing (vi)
/etc/ssh/sshd_config
on the synology, to set PermitUserEnvironment yes
. (to restart the ssh daemon after this, type
killall sshd
and /usr/syno/etc.defaults/rc.d/S95sshd.sh start
)This script mod triggers the execution of a script
$HOME/.ssh/environment
for each ssh session creation: let's create such (executable) script with the line PATH=/opt/bin:/opt/sbin:$PATH
in it. Now back to plink: we should now be able to execute
hg
through ssh.And... Everything should roll from this point :)
(Once in a while, telnet into your box (putty) and
ipkg update
and ipkg upgrade
)
11 comments:
Hi !
thanks for your article. This article help me to buy a synology device :) having a mercurial repository which can be access through ssh is so useful.
a little fix for the .ssh/environment file it's not : PATH='/opt/bin:/opt/sbin:$PATH'
but PATH=/opt/bin:/opt/sbin:$PATH (without quote) to get it works.
regards
I would like from my to do a "hg clone". How can i do that ?
Thanks!
py26-mercurial, not py-mercurial26
Wow thanks!
Do you also know how to set up hgweb on the Synology devices? To be able to support multiple repositories? (more info here http://mercurial.selenic.com/wiki/PublishingRepositories)
Hi!
well, even: PATH=/opt/bin:/opt/sbin:$PATH will not get you the expected result, because the execution of .ssh/environment does NOT support variable expansion. Check this with set, you are clobbering your previous PATH this way.
Cheers!
@Mogge: that's a terribly good question. And definitely a way to go as Mercurial advices the use of one repository per project: on my way to hgweb.
@Plymo: interesting, i will check this tonight (fortunately hg only needs 'opt/bin' and 'opt/sbin' to run ?)
it should be:
ln /opt/bin/hg /opt/bin/hg-2.6
You would create an hard link without the -s option. Furthermore the link name and target are wrong turn around.
The line should be:
ln -s /opt/bin/hg-2.6 /opt/bin/hg
Thanks you for this useful post.
Here is my small contribution: in your /usr/syno/apache/conf/httpd.conf-user file you can add the following line
<IfModule alias_module>
...
ScriptAlias /hg /volume1/web/hg/index.cgi
</IfModule>
so you can browse you repository a nicer way like this:
http://diskstation/hg/test
bye,
Stollvor
Hi,
thanks for the article. Now I can use mercurial on my Synology DS :-)
I had some problems with the environment file.
ln -s /opt/bin/hg-2.6 /opt/bin/hg
did not work for me. I am not that much into linux systems to know what's happening in detail, but the following file worked fine:
PATH=/opt/bin:/opt/sbin:$PATH
as anonymous already posted.
So my little question is what maybe wrong with that path variable? As i understand it right it is only for incoming ssh session relevant, is it?
Greetings,
Neril
Post a Comment