<s> import os <EOL> import subprocess <EOL> import time <EOL> EXCLUDE_PATH = "<STR_LIT>" <EOL> IDS = '<STR_LIT>' <EOL> uids , gids = None , None <EOL> try : <EOL> exec ( open ( IDS ) . read ( ) ) <EOL> except IOError : <EOL> raise <EOL> def execute ( cmd ) : <EOL> print "<STR_LIT>" % str ( cmd ) <EOL> ret = subprocess . Popen ( cmd ) . wait ( ) <EOL> if ret : <EOL> print "<STR_LIT>" <EOL> return ret <EOL> def update_uid ( src , dst ) : <EOL> execute ( [ "<STR_LIT>" , "<STR_LIT:/>" , "<STR_LIT>" , "<STR_LIT>" , str ( src ) , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , str ( dst ) , "<STR_LIT:{}>" , "<STR_LIT:;>" ] ) <EOL> def update_gid ( src , dst ) : <EOL> execute ( [ "<STR_LIT>" , "<STR_LIT:/>" , "<STR_LIT>" , "<STR_LIT>" , str ( src ) , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , str ( dst ) , "<STR_LIT:{}>" , "<STR_LIT:;>" ] ) <EOL> def update ( ids_list , localname ) : <EOL> localid = open ( "<STR_LIT>" % localname ) . readlines ( ) <EOL> dirty = False <EOL> for id_name , ids in ids_list . items ( ) : <EOL> for idx in xrange ( len ( localid ) ) : <EOL> pwd = localid [ idx ] . split ( '<STR_LIT::>' ) <EOL> if len ( pwd ) < <NUM_LIT:3> : <EOL> print "<STR_LIT>" % localid [ idx ] [ : - <NUM_LIT:1> ] <EOL> continue <EOL> if pwd [ <NUM_LIT:0> ] != id_name : <EOL> continue <EOL> if pwd [ <NUM_LIT:1> ] != "<STR_LIT:x>" : <EOL> print "<STR_LIT>" <EOL> pwd [ <NUM_LIT:1> ] = '<STR_LIT:x>' <EOL> localid [ idx ] = "<STR_LIT::>" . join ( pwd ) <EOL> dirty = True <EOL> wanted = "<STR_LIT>" % ( id_name , ids [ <NUM_LIT:0> ] , ids [ <NUM_LIT:1> ] ) <EOL> if ids [ <NUM_LIT:1> ] : <EOL> wanted += '<STR_LIT::>' <EOL> if localid [ idx ] . startswith ( wanted ) : <EOL> if "<STR_LIT>" in os . environ : <EOL> print "<STR_LIT>" % ( <EOL> localname , id_name , wanted , localid [ idx ] [ : - <NUM_LIT:1> ] ) <EOL> continue <EOL> print "<STR_LIT>" % ( <EOL> localname , id_name , wanted , localid [ idx ] [ : - <NUM_LIT:1> ] ) <EOL> if ids [ <NUM_LIT:1> ] : <EOL> update_uid ( pwd [ <NUM_LIT:2> ] , ids [ <NUM_LIT:0> ] ) <EOL> pwd [ <NUM_LIT:3> ] = ids [ <NUM_LIT:1> ] <EOL> else : <EOL> update_gid ( pwd [ <NUM_LIT:2> ] , ids [ <NUM_LIT:0> ] ) <EOL> pwd [ <NUM_LIT:2> ] = ids [ <NUM_LIT:0> ] <EOL> localid [ idx ] = "<STR_LIT::>" . join ( pwd ) <EOL> dirty = True <EOL> if dirty : <EOL> open ( "<STR_LIT>" % localname , "<STR_LIT:w>" ) . write ( <EOL> open ( "<STR_LIT>" % localname ) . read ( ) ) <EOL> open ( "<STR_LIT>" % localname , "<STR_LIT:w>" ) . write ( "<STR_LIT>" . join ( localid ) ) <EOL> print "<STR_LIT>" % ( <EOL> localname , localname ) <EOL> def hide_sf ( ) : <EOL> if ( not os . path . isdir ( EXCLUDE_PATH ) or <EOL> EXCLUDE_PATH in open ( "<STR_LIT>" ) . read ( ) ) : <EOL> return <EOL> subprocess . Popen ( [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:none>" , EXCLUDE_PATH ] ) . wait ( ) <EOL> def unhide_sf ( ) : <EOL> if EXCLUDE_PATH not in open ( "<STR_LIT>" ) . read ( ) : <EOL> return <EOL> subprocess . Popen ( [ "<STR_LIT>" , "<STR_LIT>" ] ) . wait ( ) <EOL> def main ( ) : <EOL> print "<STR_LIT>" % time . ctime ( ) <EOL> hide_sf ( ) <EOL> update ( uids , "<STR_LIT>" ) <EOL> update ( gids , "<STR_LIT>" ) <EOL> unhide_sf ( ) <EOL> print "<STR_LIT>" % time . ctime ( ) <EOL> main ( ) </s>
