Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: cros_generate_stateful_update_payload.py

Issue 4882006: Don't allow hardlinks in tarball. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.6 1 #!/usr/bin/python2.6
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """This module is responsible for generate a stateful update payload.""" 7 """This module is responsible for generate a stateful update payload."""
8 8
9 import logging 9 import logging
10 import optparse 10 import optparse
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 '--read_only', 43 '--read_only',
44 '--rootfs_mountpt=%s' % rootfs_dir, 44 '--rootfs_mountpt=%s' % rootfs_dir,
45 '--stateful_mountpt=%s' % stateful_dir, 45 '--stateful_mountpt=%s' % stateful_dir,
46 ]) 46 ])
47 logger.info('Tarring up /usr/local and /var!') 47 logger.info('Tarring up /usr/local and /var!')
48 subprocess.check_call(['sudo', 48 subprocess.check_call(['sudo',
49 'tar', 49 'tar',
50 '-czf', 50 '-czf',
51 output_gz, 51 output_gz,
52 '--directory=%s' % stateful_dir, 52 '--directory=%s' % stateful_dir,
53 '--hard-dereference',
53 '--transform=s,^dev_image,dev_image_new,', 54 '--transform=s,^dev_image,dev_image_new,',
54 '--transform=s,^var,var_new,', 55 '--transform=s,^var,var_new,',
55 'dev_image', 56 'dev_image',
56 'var', 57 'var',
57 ]) 58 ])
58 except: 59 except:
59 logger.error('Failed to create stateful update file') 60 logger.error('Failed to create stateful update file')
60 raise 61 raise
61 finally: 62 finally:
62 # Unmount best effort regardless. 63 # Unmount best effort regardless.
(...skipping 22 matching lines...) Expand all
85 parser.error('Missing image for stateful payload generator') 86 parser.error('Missing image for stateful payload generator')
86 if not options.output_dir: 87 if not options.output_dir:
87 parser.error('Missing output directory for the payload generator') 88 parser.error('Missing output directory for the payload generator')
88 89
89 GenerateStatefulPayload(os.path.abspath(options.image_path), 90 GenerateStatefulPayload(os.path.abspath(options.image_path),
90 options.output_dir, logger) 91 options.output_dir, logger)
91 92
92 93
93 if __name__ == '__main__': 94 if __name__ == '__main__':
94 main() 95 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698