|
@@ -1,31 +1,6 @@
|
|
|
from dulwich import porcelain
|
|
|
import os
|
|
|
|
|
|
-
|
|
|
-def is_file_locked(file_path):
|
|
|
- try:
|
|
|
- with open(file_path, 'r'):
|
|
|
- return False
|
|
|
- except IOError:
|
|
|
- return True
|
|
|
-
|
|
|
-
|
|
|
-def close_file(file_object):
|
|
|
- file_object.close()
|
|
|
-
|
|
|
-
|
|
|
-def release_file_resource(file_path):
|
|
|
- file_descriptor = os.open(file_path, os.O_RDONLY)
|
|
|
- os.close(file_descriptor)
|
|
|
-
|
|
|
-
|
|
|
-def unlock_file(file_path):
|
|
|
- if is_file_locked(file_path):
|
|
|
- with open(file_path, 'r') as file:
|
|
|
- close_file(file)
|
|
|
- release_file_resource(file_path)
|
|
|
-
|
|
|
-
|
|
|
def ro():
|
|
|
os.system("/etc/init.d/S01mount_ro start")
|
|
|
|
|
@@ -35,9 +10,8 @@ def rw():
|
|
|
|
|
|
|
|
|
localrep = "/home/"
|
|
|
-unlockfile = localrep + "cclb_launch"
|
|
|
|
|
|
rw()
|
|
|
unlock_file(unlockfile)
|
|
|
-porcelain.pull('.')
|
|
|
+porcelain.pull(localrep)
|
|
|
ro()
|