summaryrefslogtreecommitdiff
path: root/beagle/debian-rfs/usr/share/debconf
diff options
context:
space:
mode:
authorManuel Traut <manut@mecka.net>2011-04-29 09:09:27 +0200
committerManuel Traut <manut@mecka.net>2011-04-29 09:09:27 +0200
commit5238ad5a0c4a9e1c8cd036f5de4055e39bd71297 (patch)
tree4407c087b9fb5432b1dc11e70b52dacfa0b99feb /beagle/debian-rfs/usr/share/debconf
parent60ead65c41afba7e6aa4bbcf507a1d52f7a8fe9f (diff)
added debootstrap stuff
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'beagle/debian-rfs/usr/share/debconf')
-rw-r--r--beagle/debian-rfs/usr/share/debconf/confmodule91
-rw-r--r--beagle/debian-rfs/usr/share/debconf/confmodule.sh100
-rw-r--r--beagle/debian-rfs/usr/share/debconf/debconf.conf27
-rwxr-xr-xbeagle/debian-rfs/usr/share/debconf/fix_db.pl79
-rwxr-xr-xbeagle/debian-rfs/usr/share/debconf/frontend104
-rwxr-xr-xbeagle/debian-rfs/usr/share/debconf/transition_db.pl90
6 files changed, 491 insertions, 0 deletions
diff --git a/beagle/debian-rfs/usr/share/debconf/confmodule b/beagle/debian-rfs/usr/share/debconf/confmodule
new file mode 100644
index 0000000..a82cbdb
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/confmodule
@@ -0,0 +1,91 @@
+#!/bin/sh
+# This is a shell library to interface to the Debian configuration management
+# system.
+
+###############################################################################
+# Initialization.
+
+# Check to see if a FrontEnd is running.
+if [ ! "$DEBIAN_HAS_FRONTEND" ]; then
+ PERL_DL_NONLAZY=1
+ export PERL_DL_NONLAZY
+ # Since there is no FrontEnd, this program execs a FrontEnd.
+ # It will then run a new copy of $0 that can talk to it.
+ if [ "$DEBCONF_USE_CDEBCONF" ]; then
+ exec /usr/lib/cdebconf/debconf $0 "$@"
+ else
+ exec /usr/share/debconf/frontend $0 "$@"
+ fi
+fi
+
+# Only do this once.
+if [ -z "$DEBCONF_REDIR" ]; then
+ # Redirect standard output to standard error. This prevents common
+ # mistakes by making all the output of the postinst or whatever
+ # script is using this library not be parsed as confmodule commands.
+ #
+ # To actually send something to standard output, send it to fd 3.
+ exec 3>&1
+ if [ "$DEBCONF_USE_CDEBCONF" ]; then
+ exec 1>&5
+ else
+ exec 1>&2
+ fi
+ DEBCONF_REDIR=1
+ export DEBCONF_REDIR
+fi
+
+###############################################################################
+# Commands.
+
+_db_cmd () {
+ IFS=' ' printf '%s\n' "$*" >&3
+ # Set to newline to get whole line.
+ IFS='
+' read -r _db_internal_line
+ # Disgusting, but it's the only good way to split the line,
+ # preserving all other whitespace.
+ RET="${_db_internal_line#[! ][ ]}"
+ case ${_db_internal_line%%[ ]*} in
+ 1) # escaped data
+ RET="$(printf '%s' "$RET" | debconf-escape -u)"
+ return 0
+ ;;
+ esac
+ return ${_db_internal_line%%[ ]*}
+}
+
+db_capb () { _db_cmd "CAPB $@"; }
+db_set () { _db_cmd "SET $@"; }
+db_reset () { _db_cmd "RESET $@"; }
+db_title () { _db_cmd "TITLE $@"; }
+db_input () { _db_cmd "INPUT $@"; }
+db_beginblock () { _db_cmd "BEGINBLOCK $@"; }
+db_endblock () { _db_cmd "ENDBLOCK $@"; }
+db_go () { _db_cmd "GO $@"; }
+db_get () { _db_cmd "GET $@"; }
+db_register () { _db_cmd "REGISTER $@"; }
+db_unregister () { _db_cmd "UNREGISTER $@"; }
+db_subst () { _db_cmd "SUBST $@"; }
+db_fset () { _db_cmd "FSET $@"; }
+db_fget () { _db_cmd "FGET $@"; }
+db_purge () { _db_cmd "PURGE $@"; }
+db_metaget () { _db_cmd "METAGET $@"; }
+db_version () { _db_cmd "VERSION $@"; }
+db_clear () { _db_cmd "CLEAR $@"; }
+db_settitle () { _db_cmd "SETTITLE $@"; }
+db_previous_module () { _db_cmd "PREVIOUS_MODULE $@"; }
+db_info () { _db_cmd "INFO $@"; }
+db_progress () { _db_cmd "PROGRESS $@"; }
+db_data () { _db_cmd "DATA $@"; }
+db_x_loadtemplatefile () { _db_cmd "X_LOADTEMPLATEFILE $@"; }
+
+# An old alias for input.
+db_text () {
+ db_input $@
+}
+
+# Cannot read a return code, since there is none and it would block.
+db_stop () {
+ echo STOP >&3
+}
diff --git a/beagle/debian-rfs/usr/share/debconf/confmodule.sh b/beagle/debian-rfs/usr/share/debconf/confmodule.sh
new file mode 100644
index 0000000..415b361
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/confmodule.sh
@@ -0,0 +1,100 @@
+#!/bin/sh
+# This is a shell library to interface to the Debian configration management
+# system.
+#
+# This library is obsolete. Do not use.
+
+###############################################################################
+# Initialization.
+
+# Check to see if a FrontEnd is running.
+if [ ! "$DEBIAN_HAS_FRONTEND" ]; then
+ PERL_DL_NONLAZY=1
+ export PERL_DL_NONLAZY
+ # Ok, this is pretty crazy. Since there is no FrontEnd, this
+ # program execs a FrontEnd. It will then run a new copy of $0 that
+ # can talk to it.
+ exec /usr/share/debconf/frontend $0 $*
+fi
+
+# Only do this once.
+if [ -z "$DEBCONF_REDIR" ]; then
+ # Redirect standard output to standard error. This prevents common
+ # mistakes by making all the output of the postinst or whatever
+ # script is using this library not be parsed as confmodule commands.
+ #
+ # To actually send something to standard output, send it to fd 3.
+ exec 3>&1 1>&2
+ DEBCONF_REDIR=1
+ export DEBCONF_REDIR
+fi
+
+# For internal use, send text to the frontend.
+_command () {
+ echo $* >&3
+}
+
+echo "WARNING: Using deprecated debconf compatibility library."
+
+###############################################################################
+# Commands.
+
+# Generate subroutines for all commands that don't have special handlers.
+# Each command must be listed twice, once in lower case, once in upper.
+# Doing that saves us a lot of calls to tr at load time. I just wish shell had
+# an upper-case function.
+old_opts="$@"
+for i in "capb CAPB" "set SET" "reset RESET" "title TITLE" \
+ "input INPUT" "beginblock BEGINBLOCK" "endblock ENDBLOCK" "go GO" \
+ "get GET" "register REGISTER" "unregister UNREGISTER" "subst SUBST" \
+ "fset FSET" "fget FGET" "visible VISIBLE" "purge PURGE" \
+ "metaget METAGET" "exist EXIST" \
+ "x_loadtemplatefile X_LOADTEMPLATEFILE"; do
+ # Break string up into words.
+ set -- $i
+ eval "db_$1 () {
+ _command \"$2 \$@\"
+ read _RET
+ old_opts="\$@"
+ set -- \$_RET
+ shift
+ RET="\$*"
+ set -- \$old_opts
+ unset old_opts
+ }"
+done
+# $@ was clobbered above, unclobber.
+set -- $old_opts
+unset old_opts
+
+# By default, 1.0 protocol version is sent to the frontend. You can
+# pass in a different version to override this.
+db_version () {
+ if [ "$1" ]; then
+ _command "VERSION $1"
+ else
+ _command "VERSION 1.0"
+ fi
+ # Not quite correct, but not worth fixing in obsolete code.
+ read -r RET
+}
+
+# Here for backwards compatibility.
+db_go () {
+ _command "GO"
+ read -r RET
+ if [ "$RET" = 30 ]; then
+ RET='back'
+ fi
+}
+
+# Just an alias for input. It tends to make more sense to use this to display
+# text, since displaying text isn't really asking for input.
+db_text () {
+ db_input $@
+}
+
+# Cannot read a return code, since there is none and we would block.
+db_stop () {
+ echo STOP >&3
+}
diff --git a/beagle/debian-rfs/usr/share/debconf/debconf.conf b/beagle/debian-rfs/usr/share/debconf/debconf.conf
new file mode 100644
index 0000000..16a9c57
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/debconf.conf
@@ -0,0 +1,27 @@
+
+Config: configdb
+Templates: templatedb
+
+Name: config
+Driver: File
+Mode: 644
+Reject-Type: password
+Filename: /var/cache/debconf/config.dat
+
+Name: passwords
+Driver: File
+Mode: 600
+Backup: false
+Required: false
+Accept-Type: password
+Filename: /var/cache/debconf/passwords.dat
+
+Name: configdb
+Driver: Stack
+Stack: config, passwords
+
+Name: templatedb
+Driver: File
+Mode: 644
+Filename: /var/cache/debconf/templates.dat
+
diff --git a/beagle/debian-rfs/usr/share/debconf/fix_db.pl b/beagle/debian-rfs/usr/share/debconf/fix_db.pl
new file mode 100755
index 0000000..abe80a3
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/fix_db.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+# This file was preprocessed, do not edit!
+use strict;
+use Debconf::Db;
+use Debconf::Log q{warn};
+
+Debconf::Db->load;
+
+if (! @ARGV || $ARGV[0] ne 'end') {
+ my $fix=0;
+ my $ok;
+ my $counter=0;
+ do {
+ $ok=1;
+
+ my %templates=();
+ my $ti=$Debconf::Db::templates->iterator;
+ while (my $t=$ti->iterate) {
+ $templates{$t}=Debconf::Template->get($t);
+ }
+
+ my %questions=();
+ my $qi=Debconf::Question->iterator;
+ while (my $q=$qi->iterate) {
+ if (! defined $q->template) {
+ warn "question \"".$q->name."\" has no template field; removing it.";
+ $q->addowner("killme",""); # make sure it has one owner at least, so removal is triggered
+ foreach my $owner (split(/, /, $q->owners)) {
+ $q->removeowner($owner);
+ }
+ $ok=0;
+ $fix=1;
+ }
+ elsif (! exists $templates{$q->template->template}) {
+ warn "question \"".$q->name."\" uses nonexistant template ".$q->template->template."; removing it.";
+ foreach my $owner (split(/, /, $q->owners)) {
+ $q->removeowner($owner);
+ }
+ $ok=0;
+ $fix=1;
+ }
+ else {
+ $questions{$q->name}=$q;
+ }
+ }
+
+ foreach my $t (keys %templates) {
+ my @owners=$Debconf::Db::templates->owners($t);
+ if (! @owners) {
+ warn "template \"$t\" has no owners; removing it.";
+ $Debconf::Db::templates->addowner($t, "killme","");
+ $Debconf::Db::templates->removeowner($t, "killme");
+ $fix=1;
+ }
+ foreach my $q (@owners) {
+ if (! exists $questions{$q}) {
+ warn "template \"$t\" claims to be used by nonexistant question \"$q\"; removing that.";
+ $Debconf::Db::templates->removeowner($t, $q);
+ $ok=0;
+ $fix=1;
+ }
+ }
+ }
+ $counter++;
+ } until ($ok || $counter > 20);
+
+ if ($fix) {
+ Debconf::Db->save;
+ exec($0, "end");
+ die "exec of self failed";
+ }
+}
+
+foreach my $templatefile (glob("/var/lib/dpkg/info/*.templates")) {
+ my ($package) = $templatefile =~ m:/var/lib/dpkg/info/(.*?).templates:;
+ Debconf::Template->load($templatefile, $package);
+}
+
+Debconf::Db->save;
diff --git a/beagle/debian-rfs/usr/share/debconf/frontend b/beagle/debian-rfs/usr/share/debconf/frontend
new file mode 100755
index 0000000..4fb0299
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/frontend
@@ -0,0 +1,104 @@
+#!/usr/bin/perl -w
+# This file was preprocessed, do not edit!
+
+
+use strict;
+use Debconf::Db;
+use Debconf::Template;
+use Debconf::AutoSelect qw(:all);
+use Debconf::Log qw(:all);
+
+Debconf::Db->load;
+
+debug developer => "frontend started";
+
+my $frontend=make_frontend();
+
+shift @ARGV if $ARGV[0] eq '--';
+
+my $package;
+if ($ENV{DEBCONF_PACKAGE}) {
+ $package=$ENV{DEBCONF_PACKAGE};
+}
+elsif ($ARGV[0]=~m!^.*/(.*?)\.(?:postinst|postrm|prerm)$!) {
+ $package=$1;
+}
+elsif (-e "/var/lib/dpkg/tmp.ci/control") {
+ open (CONTROL, "< /var/lib/dpkg/tmp.ci/control")
+ || die "Debconf: unable to open control file: $!";
+ while (<CONTROL>) {
+ if (/^Package: (.*)/) {
+ $package=$1;
+ last;
+ }
+ }
+ close CONTROL;
+ if (! exists $ENV{PERL_DL_NONLAZY} || ! $ENV{PERL_DL_NONLAZY}) {
+ warn "PERL_DL_NONLAZY is not set, if debconf is running from a preinst script, this is not safe";
+ }
+}
+else {
+ $package='';
+
+ debug developer => 'Trying to find a templates file..';
+ sub trytemplate {
+ my $fn=shift;
+ debug developer => "Trying $fn";
+ if (-e $fn) {
+ debug developer => "I guess it is $fn";
+ Debconf::Template->load($fn, $package);
+ return 1;
+ }
+ else {
+ return;
+ }
+ }
+
+ unless (trytemplate("$ARGV[0].templates")) {
+ unless ($ARGV[0]=~m/(.*)config$/ && trytemplate("${1}templates")) {
+ unless ($ARGV[0]=~m!^(?:.*/)?(.*)! && trytemplate("/usr/share/debconf/templates/${1}.templates")) {
+ debug developer => "Couldn't find a templates file."
+ }
+ }
+ }
+}
+debug developer => "frontend running, package name is $package";
+$frontend->default_title($package) if length $package;
+$frontend->info(undef);
+
+if ($ARGV[0] =~/^(.*[.\/])(?:postinst|preinst)$/) {
+ my $base=$1;
+
+ my $templates=$base."templates";
+ Debconf::Template->load($templates, $package)
+ if -e $templates;
+
+ my $config=$base."config";
+ if (-e $config) {
+ my $version=$ARGV[2];
+ if (! defined($version)) {
+ $version='';
+ }
+ my $confmodule=make_confmodule($config,
+ "configure", $version);
+
+ $confmodule->owner($package);
+
+ 1 while ($confmodule->communicate);
+
+ exit $confmodule->exitcode if $confmodule->exitcode > 0;
+ }
+}
+
+my $confmodule=make_confmodule(@ARGV);
+
+$confmodule->owner($package);
+
+1 while ($confmodule->communicate);
+
+$frontend->shutdown;
+
+Debconf::Db->save;
+
+exit $confmodule->exitcode;
+
diff --git a/beagle/debian-rfs/usr/share/debconf/transition_db.pl b/beagle/debian-rfs/usr/share/debconf/transition_db.pl
new file mode 100755
index 0000000..bb4daa5
--- /dev/null
+++ b/beagle/debian-rfs/usr/share/debconf/transition_db.pl
@@ -0,0 +1,90 @@
+#!/usr/bin/perl -w
+# This file was preprocessed, do not edit!
+use strict;
+use Debconf::Db;
+use Debconf::Question;
+use Debconf::Template;
+
+my $dir = shift || '/var/lib/debconf';
+
+Debconf::Db->load;
+
+our %questions;
+our %templates;
+
+foreach my $thing (qw(templates debconf)) {
+ if (-e "$dir/$thing.db") {
+ eval qq{require "$dir/$thing.db"};
+ print STDERR $@ if $@;
+ }
+ else {
+ print STDERR "Skipping $dir/$thing.db: DNE\n";
+ }
+}
+
+foreach my $t (keys %templates) {
+ $templates{$t}->{_name}=$t;
+}
+
+my $skipped=0;
+
+foreach my $item (keys %questions) {
+ my @owners=grep { $_ ne '' } keys %{$questions{$item}->{owners}};
+ delete $questions{$item}, next unless @owners;
+
+ next unless defined $questions{$item}->{template}->{_name};
+
+ my $tname=$questions{$item}->{template}->{_name};
+ $skipped++, next unless defined $tname;
+ my $type=$templates{$tname}->{type};
+ my $question=Debconf::Question->new($item, pop(@owners), $type);
+ $question->addowner($_, '') foreach @owners;
+}
+
+my %seen_templates;
+foreach my $item (keys %questions) {
+ my $question=Debconf::Question->get($item);
+ my $tname=$questions{$item}->{template}->{_name};
+ $skipped++, next unless defined $tname;
+ my $template=Debconf::Template->get($tname);
+ unless (defined $template) {
+ $template=Debconf::Template->new($tname, $item, $templates{$tname}->{type});
+ }
+ unless ($seen_templates{$template}) {
+ $template->clearall;
+ foreach my $field (keys %{$templates{$tname}}) {
+ next if $field=~/^_name/; # except this one we added above.
+ $template->$field($templates{$tname}->{$field});
+ }
+ }
+
+
+ if (exists $questions{$item}->{flag_isdefault}) {
+ if ($questions{$item}->{flag_isdefault} eq 'false') {
+ $question->flag('seen', 'true');
+ }
+ delete $questions{$item}->{flag_isdefault};
+ }
+ foreach my $flag (grep /^flag_/, keys %{$questions{$item}}) {
+ if ($questions{$item}->{$flag} eq 'true') {
+ $flag=~s/^flag_//;
+ $question->flag($flag, 'true');
+ }
+ }
+ foreach my $var (keys %{$questions{$item}->{variables}}) {
+ $question->variable($var,
+ $questions{$item}->{variables}->{$var});
+ }
+ if (exists $questions{$item}->{value}
+ and defined $questions{$item}->{value}) {
+ $question->value($questions{$item}->{value});
+ }
+
+ $question->template($questions{$item}->{template}->{_name});
+}
+
+Debconf::Db->save;
+
+if ($skipped) {
+ print STDERR "While upgrading the debconf database, $skipped corrupt items were skipped.\n";
+}