copytree does not set owners
This commit is contained in:
parent
3296e1b14c
commit
9edd543305
@ -8,6 +8,8 @@ import sys
|
||||
import os
|
||||
import shutil
|
||||
import fcntl
|
||||
import glob
|
||||
import pwd
|
||||
|
||||
if not os.getuid() == 0:
|
||||
print("You almost definitely don't want to be running this (and you can't be cause you're not root).")
|
||||
@ -56,6 +58,15 @@ for ent in os.listdir('/dev/base'):
|
||||
except:
|
||||
print("failed to make",ent)
|
||||
|
||||
print('Migration does not copy permissions, changing home directory owners...')
|
||||
for path in glob.glob('/home/*'):
|
||||
user = path.replace('/home/','')
|
||||
uid = pwd.getpwnam(user).pw_uid
|
||||
os.chown(path,uid,uid)
|
||||
for root, dirs, files in os.walk(path):
|
||||
for name in dirs+files:
|
||||
os.chown(os.path.join(root, name), uid, uid)
|
||||
|
||||
if '/dev/ram' in root:
|
||||
print("Freeing ramdisk...")
|
||||
if ',' in root:
|
||||
|
Loading…
Reference in New Issue
Block a user