OLD | NEW |
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 Loading... |
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 Loading... |
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() |
OLD | NEW |