mς ͺˎGc@s•dkTdkTdkTdkZdkZdkZd„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZ d e fd „ƒYZ dS( (t*NcCs=d}yti|ƒd}Wntj o d}nX|S(Nii(tgotittgrptgetgrnamtnametKeyError(RR((td/home/faculty/youssef/public_html/pacman/sample_cache/tarballs/pre/tmp/pacman-3.29/src/UserExists.pyt groupexists s   t GroupExistscBs5tZdZdZdZd„Zd„Zd„ZRS(Ns group existss Groups Existstest if group existscCs0td|idtiƒdt|iƒ ƒS(NsThe user group [s] has not been created on [s].(tReasontselftvaluetsockett gethostnameR(R ((Rt satisfiedscCs |iƒS(N(R R(R ((RtacquirescCstƒS(N(R (R ((Rtretracts(t__name__t __module__ttypettitletactionRRR(((RRs   tGroupAddcBs,tZdZdZdZd„Zd„ZRS(Ns add groupsAdd User Groupssadd user groupcCs`tidd|idƒtidd|idƒ}|iƒotd|iƒ}n|S(NtuserssAbout to add user group [s]...taccsOK to add user group [s]?s groupadd ( tverbotlogR R tasktretreasontoktexecute(R R((RR$s  cCs}tƒ}t|iƒo`tidd|idƒtidd|idƒ}|i ƒot d|iƒ}qyn|S(NRsAbout to remove user group [s]...RsOK to remove user group [s]?s groupdel ( R RRR R RRRRRR(R R((RR)s  (RRRRRRR(((RRs  tUserAddcBs\tZdZdZdZddddd„Zd „Zd „Zd „Zd „Z d „Z RS(Nsadd users Add Userssadd user if necessarys- any -s/bin/shticCs1||_||_||_||_||_dS(N(tusernameR tgrouptshellthdirthomedir(R R"R#R$R%R&((Rt__init__6s     cCsH|idjod|i}n$d|id|id|i}|S(Ns- any -s username: s , group: s , shell: (R R#R"tsR$(R R(((Rtstr<s#cCs#|i|ijo|i|ijS(N(R R"txR#(R R*((RtequalAscCsΙt|iƒ\}}}|o‘yti|ƒd}Wn(t j ot d|idƒSnX||i jp|i djo t ƒSqΕt d|id|i dƒSnt d|idƒSdS( NisUser [s] group does not exist.s- any -s] exists but is not in group [s].s No user [s] has an account.( tuseridsR R"RtuidtgidRtgetgrgidt groupnameRR R#(R RR-R0R.((RRDs $cCsvtƒ}|idjo|ioιt|iƒoΎtidd|idƒt i dd|idƒ}|i ƒou|i djo-t d |id |id |iƒ}qνt d |i d |id |id |iƒ}qq3td|idƒ}qSt d|id |id |iƒSn|ioιt|iƒoΎtidd|idƒt i dd|idƒ}|i ƒou|i djo-t d |id |id |iƒ}q t d |i d |id |id |iƒ}q&qStd|idƒ}n*t d|id |id |iƒ}|i ƒod| dGHn|S(Ns- any -RsAbout to create user account [s]...RsOK to create user account [s]?R!suseradd -m -c pacman -g s -s t suseradd -m -c pacman -d s -g sGroup [s] doesn't exist.suseradd -M -c pacman -g sNew user account [s ] created...(R RR R#R&t groupExistsR"RRRRRR%RR$(R R((RRVs2   -<+  -<) cCsŠtƒ}tidd|idƒtidd|idƒ}|iƒo8|i ot d|iƒ}q†t d|iƒ}n|S( NRsAbout to remove user account [s]...RsOK to remove user account [s]?s userdel -r suserdel ( R RRRR R"RRRR&R(R R((RRss   ( RRRRRR'R)R+RRR(((RR 1s    t UserExistscBs,tZdZdZdZd„Zd„ZRS(Ns user existss User Existsscheck for usercCs |iƒS(N(R R(R ((Rtsatisfy‚scCstƒS(N(R (R ((Rtrestoreƒs(RRRRRR4R5(((RR3|s  ( t Environmentt StringAttrt ExecutiontpwdRR RRRR R3(R RRR3R9R RR((Rt?s  K