Hide ephemeral files from Time Machine

This commit is contained in:
Elliot Nunn 2018-05-31 19:12:55 +08:00
parent a2fc3b9d47
commit 2cc7368456
2 changed files with 3 additions and 0 deletions

1
empw
View File

@ -216,6 +216,7 @@ hsyncback = path.join(scriptfolder, 'hsyncback')
if not path.exists(bootimg):
print('Creating new scratch boot disk.')
copyfile(backupimg, bootimg)
run(['xattr', '-w', 'com.apple.metadata:com_apple_backup_excludeItem', 'com.apple.backupd', bootimg])

2
hsync
View File

@ -48,6 +48,8 @@ label = 'Src'
# Dirs are in /full/path/without/trailing/slash form, thanks to os.path.abspath
if not path.exists(srcimg):
run(['touch', srcimg])
run(['xattr', '-w', 'com.apple.metadata:com_apple_backup_excludeItem', 'com.apple.backupd', srcimg])
run(['dd', 'if=/dev/zero', 'of='+srcimg, 'bs=1048576', 'count='+str(256)], stdout=DEVNULL, stderr=DEVNULL, check=True)
run(['hformat', '-l', label, srcimg], stdout=DEVNULL, check=True)
run(['humount'], check=True)