|
Revision 29, 0.8 kB
(checked in by sylvinus, 21 months ago)
|
|
First import of prototype Jamendo application
|
-
Property svn:mime-type set to
text/plain
|
| Line | |
|---|
| 1 | import sys,os |
|---|
| 2 | |
|---|
| 3 | fonera = "root@192.168.10.1:" |
|---|
| 4 | pwd = "admin" |
|---|
| 5 | |
|---|
| 6 | module = sys.argv[1] |
|---|
| 7 | |
|---|
| 8 | if (not os.path.isdir(module)) or (not os.path.isdir(os.path.join(module,"luasrc"))): |
|---|
| 9 | print "%s is not a luci app" % module |
|---|
| 10 | sys.exit(0) |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | def scp_dir_to_fonera(local_dir,remote_dir): |
|---|
| 14 | cmd = "expect -c 'set timeout 10; spawn sh -c \"scp -r %s/* %s%s\" ; expect \"password\: \";send \"%s\n\"; interact'" % (local_dir,fonera,remote_dir,pwd) |
|---|
| 15 | os.system(cmd) |
|---|
| 16 | |
|---|
| 17 | dir_luasrc = os.path.join(module,"luasrc") |
|---|
| 18 | dir_htdocs = os.path.join(module,"htdocs") |
|---|
| 19 | dir_root = os.path.join(module,"root") |
|---|
| 20 | |
|---|
| 21 | if os.path.isdir(dir_luasrc): |
|---|
| 22 | scp_dir_to_fonera(dir_luasrc,"/usr/lib/lua/luci/") |
|---|
| 23 | |
|---|
| 24 | if os.path.isdir(dir_htdocs): |
|---|
| 25 | scp_dir_to_fonera(dir_htdocs,"/www/") |
|---|
| 26 | |
|---|
| 27 | if os.path.isdir(dir_root): |
|---|
| 28 | scp_dir_to_fonera(dir_root,"/") |
|---|