1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
|
#!/usr/bin/perl -w
use strict;
use Debconf::Client::ConfModule ':all';
use Debconf::Log ':all';
# Preliminaries
version('2.0');
my $capb=capb('backup');
debug "developer" => "Capb returned $capb";
# Put a sentinel exit at the top of the stack to pull us out if the user
# decides to back *right* out of the script.
push(my @STATESTACK, "exit");
# The initial state.
my $STATE="docroot";
# The mechanics of this system are quite simple. If the state subroutine
# returns the name of a state, we move to that state. Else we take the
# previous state off the stack and run that one again.
#
# Every possible state should be represented by a subroutine of the same
# name, which returns either the name of the next state to be called, or
# undef if we're to go back.
while ($STATE ne "exit") {
no strict 'refs';
my $NEXTSTATE = &$STATE;
use strict;
if ($NEXTSTATE) {
push(@STATESTACK, $STATE);
} else {
$NEXTSTATE = pop(@STATESTACK);
}
$STATE=$NEXTSTATE;
}
# All done!
sub docroot
{
title("DokuWiki Document Root");
input("high", "dokuwiki/system/documentroot");
my @ret = go();
if ($ret[0] == 30) {
return undef;
} else {
return "webservers";
}
}
sub webservers
{
title("Select web server");
input("high", "dokuwiki/webservers");
my @ret = go();
if ($ret[0] == 30) {
return undef;
} else {
return "accessible";
}
}
sub accessible
{
title("Access Control");
input("medium", "dokuwiki/system/accessible");
my @ret = go();
if ($ret[0] == 30) {
return undef;
}
@ret = get("dokuwiki/system/accessible");
if ($ret[1] eq "local network") {
return "localnet";
} else {
return "purgepages";
}
}
sub localnet
{
title("Local Network specification");
input("critical", "dokuwiki/system/localnet");
my @ret = go();
if ($ret[0] == 30) {
return undef;
} else {
return "purgepages";
}
}
sub purgepages
{
title("Purging pages on removal");
input("high", "dokuwiki/system/purgepages");
my @ret = go();
if ($ret[0] == 30) {
return undef;
} else {
return "exit";
}
}
|