Mercurial > hg > Members > kent > dotfiles
diff symlink.py @ 1:c8c579f62d99
add rc files that have relation with mailer.
and symlink.py was modified as adding subroutin that make
hardlink for fetchmailrc.
author | kent <kent@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 15 Nov 2008 00:57:04 +0900 |
parents | 6d5c73fe5744 |
children | 0f43fb312bd6 |
line wrap: on
line diff
--- a/symlink.py Sat Nov 15 00:32:22 2008 +0900 +++ b/symlink.py Sat Nov 15 00:57:04 2008 +0900 @@ -25,6 +25,11 @@ makeSymlink(opt[0], value[1]) else: makeSymlink(opt[0]) + elif value[0] == "LNK": + if len(value) > 1: + makeHardlink(opt[0], value[1]) + else: + makeHardlink(opt[0]) ### make symbolic link dst0 relating with src0 @@ -45,8 +50,27 @@ # make symbolic link print dst+" => "+src - #os.symlink(src, dst) + os.symlink(src, dst) + +### make hardlink dst0 relating with src0 +def makeHardlink(src0, dst0=None): + # correct filename of source and destination + if dst0==None: + dst0 = "."+src0 + src = src0 + dst = home+"/"+dst0 + # check destination file + if os.path.exists(dst): + if force: + os.remove(dst) + else: + print "file "+dst+" already existed!" + return + + # make symbolic link + print dst+" => "+src + os.link(src, dst) main()