Mercurial > hg > Members > kent > dotfiles
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:6d5c73fe5744 | 1:c8c579f62d99 |
---|---|
23 if value[0] == "SYM": | 23 if value[0] == "SYM": |
24 if len(value) > 1: | 24 if len(value) > 1: |
25 makeSymlink(opt[0], value[1]) | 25 makeSymlink(opt[0], value[1]) |
26 else: | 26 else: |
27 makeSymlink(opt[0]) | 27 makeSymlink(opt[0]) |
28 elif value[0] == "LNK": | |
29 if len(value) > 1: | |
30 makeHardlink(opt[0], value[1]) | |
31 else: | |
32 makeHardlink(opt[0]) | |
28 | 33 |
29 | 34 |
30 ### make symbolic link dst0 relating with src0 | 35 ### make symbolic link dst0 relating with src0 |
31 def makeSymlink(src0, dst0=None): | 36 def makeSymlink(src0, dst0=None): |
32 # correct filename of source and destination | 37 # correct filename of source and destination |
43 print "file "+dst+" already existed!" | 48 print "file "+dst+" already existed!" |
44 return | 49 return |
45 | 50 |
46 # make symbolic link | 51 # make symbolic link |
47 print dst+" => "+src | 52 print dst+" => "+src |
48 #os.symlink(src, dst) | 53 os.symlink(src, dst) |
49 | 54 |
55 ### make hardlink dst0 relating with src0 | |
56 def makeHardlink(src0, dst0=None): | |
57 # correct filename of source and destination | |
58 if dst0==None: | |
59 dst0 = "."+src0 | |
60 src = src0 | |
61 dst = home+"/"+dst0 | |
62 | |
63 # check destination file | |
64 if os.path.exists(dst): | |
65 if force: | |
66 os.remove(dst) | |
67 else: | |
68 print "file "+dst+" already existed!" | |
69 return | |
70 | |
71 # make symbolic link | |
72 print dst+" => "+src | |
73 os.link(src, dst) | |
50 | 74 |
51 main() | 75 main() |
52 | 76 |
53 | 77 |
54 | 78 |