server/misc/usb_maker.py
2015-01-23 01:59:22 +01:00

29 lines
995 B
Python
Executable File

#!/usr/bin/env python
# Import the certificate and the guide into the usb keys
# It needs a file (teams) which contains "certificate_name number"
# certificate_name : is the name of the file into the cert/ folder
# number : how many usb stick it must copy
# A guide.pdf must also be present
import os
separator = ' '
device = '/dev/sdb1'
with open("teams") as f:
for line in f:
cert, members = line.split(separator)
for x in range(0,int(members)):
raw_input("Insert usb AND THEN press enter")
os.system("sleep 4")
os.system("mkfs.vfat " + device)
os.system("mount " + device + " /media")
os.system("cp -v cert/" + cert + " ca.der ca.pem guide.pdf /media")
os.system("umount /media")
print "## " + cert + " was copied to usb device " + x + "/" + members
os.system("sleep 0.4")
print "You may eject the usb key"
print "Next Team"
print "DONE"