diff --git a/mdevuan.py b/mdevuan.py index 31e7756..8765fd0 100644 --- a/mdevuan.py +++ b/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: