| 1 | # This is -*- perl -*- |
| 2 | |
| 3 | package Debian::OpenAFS::ConfigUtils; |
| 4 | |
| 5 | use strict; |
| 6 | use vars qw( @ISA @EXPORT @unwinds); |
| 7 | @ISA = qw(Exporter); |
| 8 | require Exporter; |
| 9 | @EXPORT = qw(@unwinds run unwind); |
| 10 | |
| 11 | sub run ($) { |
| 12 | print join(' ', @_); |
| 13 | print "\n"; |
| 14 | system (@_) == 0 |
| 15 | or die "Failed: $?\n"; |
| 16 | } |
| 17 | |
| 18 | # This subroutine takes a command to run in case of failure. After |
| 19 | # each succesful step, this routine should be run with a command to |
| 20 | # undo the successful step. |
| 21 | |
| 22 | sub unwind($) { |
| 23 | push @unwinds, $_[0]; |
| 24 | } |
| 25 | |
| 26 | 1; |