milestone 2
This commit is contained in:
parent
acb5120de3
commit
d071755d84
@ -1 +1,59 @@
|
||||
opus.tweak = Munch()
|
||||
opus.tweak.apply = Munch()
|
||||
def _tweakApplyReg(tag,rtgName,rtgFile):
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: registry -> " +rtgName,1)
|
||||
opus.reg.mount(opus.wim.path(rtgFile))
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isfile(pJoin(ftweak,"reg",rtgName + ".REG")): continue
|
||||
opus.reg.imprt(pJoin(ftweak,"reg",rtgName + ".REG"))
|
||||
|
||||
opus.reg.unmount()
|
||||
opus.tweak.apply.reg = _tweakApplyReg
|
||||
|
||||
def _tweakApplyWim(tag):
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: wim",1)
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isdir(pJoin(ftweak,"wim")): continue
|
||||
opus.main.output("> applying: " +tweak,1)
|
||||
for root,dirs,files in os.walk(pJoin(ftweak,"wim")):
|
||||
for dir in dirs:
|
||||
fdir = os.path.join(root,dir)
|
||||
nfdir = fdir.replace(pJoin(ftweak,"wim"),opus.wim.path())
|
||||
if not os.path.isdir(nfdir):
|
||||
opus.main.output("creating directory: " +nfdir,2)
|
||||
os.makedirs(nfdir)
|
||||
|
||||
for file in files:
|
||||
ffile = os.path.join(root,file)
|
||||
nffile = ffile.replace(pJoin(ftweak,"wim"),opus.wim.path())
|
||||
opus.main.output("adding file: " +nffile,2)
|
||||
if os.path.isdir(nffile): os.remove(nffile)
|
||||
shutil.copyfile(ffile,nffile)
|
||||
opus.tweak.apply.wim = _tweakApplyWim
|
||||
|
||||
def _tweakApplyIso(tag):
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: iso",1)
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isdir(pJoin(ftweak,"iso")): continue
|
||||
opus.main.output("> applying: " +tweak,1)
|
||||
for root,dirs,files in os.walk(pJoin(ftweak,"iso")):
|
||||
for dir in dirs:
|
||||
fdir = os.path.join(root,dir)
|
||||
nfdir = fdir.replace(pJoin(ftweak,"iso"),opus.path.target)
|
||||
if not os.path.isdir(nfdir):
|
||||
opus.main.output("creating directory: " +nfdir,2)
|
||||
os.makedirs(nfdir)
|
||||
|
||||
for file in files:
|
||||
ffile = os.path.join(root,file)
|
||||
nffile = ffile.replace(pJoin(ftweak,"iso"),opus.path.target)
|
||||
opus.main.output("adding file: " +nffile,2)
|
||||
if os.path.isdir(nffile): os.remove(nffile)
|
||||
shutil.copyfile(ffile,nffile)
|
||||
opus.tweak.apply.iso = _tweakApplyIso
|
@ -23,7 +23,7 @@ opus.path.api = pJoin(opus.path.main,"scripts","api")
|
||||
opus.path.tweaks = pJoin(opus.path.main,"tweaks")
|
||||
opus.path.temp = pJoin(opus.path.main,"tmp")
|
||||
opus.path.wim = pJoin(opus.path.temp,"wim")
|
||||
opus.path.target = sys.argv[1]
|
||||
opus.path.target = os.path.realpath(sys.argv[1])
|
||||
opus.verbosity = 2
|
||||
|
||||
with open(pJoin(opus.path.main,"scripts","api","main.py")) as script:
|
||||
@ -79,38 +79,12 @@ opus.os = opus.detect.os(opus.wim.path())
|
||||
|
||||
for tag in opus.os.tags:
|
||||
if not os.path.isdir(pJoin(opus.path.tweaks,tag)): continue
|
||||
|
||||
rtgName = "SOFTWARE"
|
||||
rtgFile = pJoin("Windows","System32","config","SOFTWARE")
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: registry -> " +rtgName, 1)
|
||||
opus.reg.mount(opus.wim.path(rtgFile))
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isfile(pJoin(ftweak,"reg",rtgName + ".REG")): continue
|
||||
opus.reg.imprt(pJoin(ftweak,"reg",rtgName + ".REG"))
|
||||
|
||||
rtgName = "SYSTEM"
|
||||
rtgFile = pJoin("Windows","System32","config","SYSTEM")
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: registry -> " +rtgName, 1)
|
||||
opus.reg.mount(opus.wim.path(rtgFile))
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isfile(pJoin(ftweak,"reg",rtgName + ".REG")): continue
|
||||
opus.reg.imprt(pJoin(ftweak,"reg",rtgName + ".REG"))
|
||||
|
||||
rtgName = "NTUSER"
|
||||
rtgFile = pJoin("Users","Default","NTUSER.DAT")
|
||||
opus.main.output("\n>> [" +tag+ "] applying tweaks: registry -> " +rtgName, 1)
|
||||
opus.reg.mount(opus.wim.path(rtgFile))
|
||||
for tweakRoot,tweaks,_ in opus.path.walklevel(pJoin(opus.path.tweaks,tag)):
|
||||
for tweak in tweaks:
|
||||
ftweak = os.path.join(tweakRoot,tweak)
|
||||
if not os.path.isfile(pJoin(ftweak,"reg",rtgName + ".REG")): continue
|
||||
opus.reg.imprt(pJoin(ftweak,"reg",rtgName + ".REG"))
|
||||
opus.tweak.apply.reg(tag,"SOFTWARE",pJoin("Windows","System32","config","SOFTWARE"))
|
||||
opus.tweak.apply.reg(tag,"SYSTEM",pJoin("Windows","System32","config","SYSTEM"))
|
||||
opus.tweak.apply.reg(tag,"NTUSER",pJoin("Users","Default","NTUSER.DAT"))
|
||||
opus.tweak.apply.wim(tag)
|
||||
opus.tweak.apply.iso(tag)
|
||||
|
||||
opus.main.output("\nif you'd like to make manual changes, please do so now. press enter to finalize or ctrl+c to cancel.")
|
||||
input()
|
||||
opus.reg.unmount()
|
||||
opus.wim.update()
|
Loading…
Reference in New Issue
Block a user