## pack_server.py
## Linux下一键发包(server设备)
import os,sys
gTarget = "server"
#[1]
if len(sys.argv) < 2:
print "Default Package Dir is [server]"
else:
print "Package Dir is %s" % (sys.argv[1])
gTarget = sys.argv[1]
#[2]
if not os.path.exists(gTarget):
print "%s does not exist,will exit..."
else:
#[3]
os.system("mkdir -p /home/newPackage")
os.system("rm -rf /home/newPackage/server.tar.gz*")
#[4]
os.chdir(gTarget)
os.system("tar czf server.tar.gz *")
os.system("md5sum server.tar.gz | awk '{print $1}' > server.tar.gz.md5")
os.system("cp server.tar.gz* /home/newPackage")
#[5]
print "==============================================="
print "Make Packages Finished"
print r"Please Copy the Packages from \\192.168.0.130\home\newPackage."
print "================================================"
~
pack_server.py server