Mount pts
This commit is contained in:
parent
19a80b37c1
commit
d7e99f1593
23
mdevuan.py
23
mdevuan.py
|
@ -10,6 +10,7 @@ mountPoint = os.path.abspath(sys.argv[2].rstrip("/"))
|
|||
mountPoints = [ # List of mount points to dismount when quitting
|
||||
os.path.join(mountPoint,"proc"),
|
||||
os.path.join(mountPoint,"sys"),
|
||||
os.path.join(mountPoint,"dev","pts"),
|
||||
os.path.join(mountPoint,"dev"),
|
||||
mountPoint
|
||||
]
|
||||
|
@ -172,12 +173,30 @@ w
|
|||
|
||||
if tries >= 10:
|
||||
raise processError
|
||||
|
||||
|
||||
if os.path.isdir("skel"):
|
||||
print("Adding skel ...")
|
||||
if not os.path.isdir(os.path.join(mountPoint,"etc","skel")):
|
||||
os.makedirs(os.path.join(mountPoint,"etc","skel"))
|
||||
for root,dirs,files in os.walk("skel"):
|
||||
for file in dirs:
|
||||
ffile = os.path.join(root,file)
|
||||
lfile = ffile.replace("skel" + os.path.sep,"",1)
|
||||
ofile = os.path.join(mountPoint,"etc","skel",lfile)
|
||||
if not os.path.isdir(ofile): os.makedirs(ofile)
|
||||
|
||||
for file in files:
|
||||
ffile = os.path.join(root,file)
|
||||
lfile = ffile.replace("skel" + os.path.sep,"",1)
|
||||
ofile = os.path.join(mountPoint,"etc","skel",lfile)
|
||||
if os.path.isfile(ofile): os.remove(ofile)
|
||||
shutil.copyfile(ffile,ofile)
|
||||
|
||||
print("Setting up chroot ...")
|
||||
call(["mount","-o","bind","/dev",os.path.join(mountPoint,"dev")])
|
||||
call(["mount","--bind","/dev/pts",os.path.join(mountPoint,"dev","pts")])
|
||||
call(["mount","-o","bind","/sys",os.path.join(mountPoint,"sys")])
|
||||
call(["mount","-t","proc","/proc",os.path.join(mountPoint,"proc")])
|
||||
shutil.copyfile("/proc/mounts",os.path.join(mountPoint,"etc","mtab"))
|
||||
with open("setup","r",encoding="utf-8") as fhIn:
|
||||
with open(os.path.join(mountPoint,"setup"),"w",encoding="utf-8") as fhOut:
|
||||
for line in fhIn:
|
||||
|
|
Loading…
Reference in New Issue