/usr/lib/python2.7/dist-packages/framework/subsystems/ogsmd/modems/abstract/overlay.py is in fso-frameworkd 0.10.1-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #!/usr/bin/env python
"""
The Open GSM Daemon - Python Implementation
(C) 2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
(C) 2008 Openmoko, Inc.
GPLv2 or later
"""
import os
import stat
import shutil
#=========================================================================#
class OverlayFile( object ):
#=========================================================================#
backupPath = "/var/tmp/ogsmd/"
classInitDone = False
def __init__( self, name, overlay ):
self._classInit()
self.name = os.path.abspath( name )
if os.path.exists( self.name ):
self.backupname = "%s/%s" % ( self.__class__.backupPath, self.name.replace( '/', ',' ) )
else:
self.backupname = None
self.overlay = overlay
def store( self ):
"""Store the overlay"""
if self.backupname is not None:
shutil.copy( self.name, self.backupname )
f = open( self.name, "w" )
f.write( self.overlay )
del f
# FIXME store chmod
os.chmod( self.name, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO )
def restore( self ):
"""Restore original content"""
if self.backupname is not None:
shutil.copy( self.backupname, self.name )
# FIXME restore chmod
def __del__( self ):
pass
def _classInit( self ):
if not OverlayFile.classInitDone:
if os.path.exists( OverlayFile.backupPath ) and os.path.isdir( OverlayFile.backupPath ):
pass
else:
# FIXME lets do that without shell
os.system( "mkdir -p %s" % OverlayFile.backupPath )
OverlayFile.classInitDone = True
|