|
|
@ -20,6 +20,7 @@ import sys |
|
|
|
import pwd |
|
|
|
import getopt |
|
|
|
import signal |
|
|
|
import fcntl |
|
|
|
import re |
|
|
|
import subprocess |
|
|
|
import syslog |
|
|
@ -33,6 +34,23 @@ from gi.repository import UDisks |
|
|
|
|
|
|
|
import xml.etree.ElementTree as et |
|
|
|
|
|
|
|
def processCheck(): |
|
|
|
|
|
|
|
global filelock |
|
|
|
filelock=open(os.path.realpath(__file__),'r') |
|
|
|
|
|
|
|
try: |
|
|
|
fcntl.flock(filelock,fcntl.LOCK_EX|fcntl.LOCK_NB) |
|
|
|
except: |
|
|
|
print('Process is already running.') |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
if os.getuid() != 0: |
|
|
|
print('Process must be run as root.') |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
processCheck() |
|
|
|
|
|
|
|
class HotPlugDevice: |
|
|
|
def __init__(self, serial): |
|
|
|
self.__udi = None |
|
|
|