summaryrefslogtreecommitdiff
path: root/beagle/debian-rfs/usr/sbin
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/sbin
parent60ead65c41afba7e6aa4bbcf507a1d52f7a8fe9f (diff)
added debootstrap stuff
Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'beagle/debian-rfs/usr/sbin')
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/add-shell40
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/chgpasswdbin0 -> 37468 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/chpasswdbin0 -> 34108 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/chrootbin0 -> 27396 bytes
l---------beagle/debian-rfs/usr/sbin/cpgr1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/cppwbin0 -> 35424 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/cytunebin0 -> 11676 bytes
l---------beagle/debian-rfs/usr/sbin/dpkg-divert1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/dpkg-preconfigure147
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/dpkg-reconfigure159
l---------beagle/debian-rfs/usr/sbin/dpkg-statoverride1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/e2freefragbin0 -> 10028 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/fdformatbin0 -> 6148 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/filefragbin0 -> 11364 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/groupaddbin0 -> 37484 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/groupdelbin0 -> 33252 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/groupmodbin0 -> 43740 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/grpckbin0 -> 37360 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/grpconvbin0 -> 29488 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/grpunconvbin0 -> 29280 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/iconvconfigbin0 -> 30376 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/install-infobin0 -> 4460 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/invoke-rc.d464
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/ldattachbin0 -> 7280 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/mklost+foundbin0 -> 4616 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/newusersbin0 -> 44936 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/nologinbin0 -> 3320 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/pam-auth-update697
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/pam_getenv123
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/pwckbin0 -> 29828 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/pwconvbin0 -> 25472 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/pwunconvbin0 -> 24632 bytes
l---------beagle/debian-rfs/usr/sbin/ramsize1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/rdevbin0 -> 7592 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/readprofilebin0 -> 15392 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/remove-shell40
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/rmt-tarbin0 -> 43868 bytes
l---------beagle/debian-rfs/usr/sbin/rootflags1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/rtcwakebin0 -> 11220 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/service138
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/tunelpbin0 -> 6612 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/tzconfig3
l---------beagle/debian-rfs/usr/sbin/update-alternatives1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/update-bootsystem-insserv24
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/update-passwdbin0 -> 17348 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/update-rc.d591
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/update-rc.d-insserv593
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/useraddbin0 -> 72948 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/userdelbin0 -> 43776 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/usermodbin0 -> 72736 bytes
l---------beagle/debian-rfs/usr/sbin/vidmode1
l---------beagle/debian-rfs/usr/sbin/vigr1
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/vipwbin0 -> 36456 bytes
-rwxr-xr-xbeagle/debian-rfs/usr/sbin/zicbin0 -> 38548 bytes
54 files changed, 3027 insertions, 0 deletions
diff --git a/beagle/debian-rfs/usr/sbin/add-shell b/beagle/debian-rfs/usr/sbin/add-shell
new file mode 100755
index 0000000..f7a4a55
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/add-shell
@@ -0,0 +1,40 @@
+#!/bin/sh -e
+
+if test $# -eq 0
+then
+ echo usage: $0 shellname [shellname ...]
+ exit 1
+fi
+
+file=/etc/shells
+# I want this to be GUARANTEED to be on the same filesystem as $file
+tmpfile=${file}.tmp
+
+set -o noclobber
+
+trap "rm -f $tmpfile" EXIT
+
+if ! cat $file > $tmpfile
+then
+ cat 1>&2 <<EOF
+Either another instance of $0 is running, or it was previously interrupted.
+Please examine ${tmpfile} to see if it should be moved onto ${file}.
+EOF
+ exit 1
+fi
+
+for i
+do
+ if ! grep -q "^${i}$" $tmpfile
+ then
+ echo $i >> $tmpfile
+ fi
+done
+
+chmod --reference=$file $tmpfile
+chown --reference=$file $tmpfile
+
+mv $tmpfile $file
+
+trap "" EXIT
+exit 0
diff --git a/beagle/debian-rfs/usr/sbin/chgpasswd b/beagle/debian-rfs/usr/sbin/chgpasswd
new file mode 100755
index 0000000..d261758
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/chgpasswd
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/chpasswd b/beagle/debian-rfs/usr/sbin/chpasswd
new file mode 100755
index 0000000..cf9ca2d
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/chpasswd
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/chroot b/beagle/debian-rfs/usr/sbin/chroot
new file mode 100755
index 0000000..8e51cd4
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/chroot
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/cpgr b/beagle/debian-rfs/usr/sbin/cpgr
new file mode 120000
index 0000000..d41955f
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/cpgr
@@ -0,0 +1 @@
+cppw \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/cppw b/beagle/debian-rfs/usr/sbin/cppw
new file mode 100755
index 0000000..27d81e0
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/cppw
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/cytune b/beagle/debian-rfs/usr/sbin/cytune
new file mode 100755
index 0000000..ff5d99a
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/cytune
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/dpkg-divert b/beagle/debian-rfs/usr/sbin/dpkg-divert
new file mode 120000
index 0000000..7668cac
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/dpkg-divert
@@ -0,0 +1 @@
+../bin/dpkg-divert \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/dpkg-preconfigure b/beagle/debian-rfs/usr/sbin/dpkg-preconfigure
new file mode 100755
index 0000000..0a86b9a
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/dpkg-preconfigure
@@ -0,0 +1,147 @@
+#!/usr/bin/perl -w
+# This file was preprocessed, do not edit!
+
+
+
+BEGIN {
+ eval qq{
+ use strict;
+ use FileHandle;
+ use Debconf::Log qw(:all);
+ use Debconf::Db;
+ use Debconf::Template;
+ use Debconf::Config;
+ use Debconf::AutoSelect qw(:all);
+ use Debconf::Gettext;
+ };
+ if ($@) {
+ print STDERR "debconf: Perl may be unconfigured ($@) -- aborting\n";
+ exit 0;
+ }
+}
+
+Debconf::Db->load;
+
+my $apt=0;
+Debconf::Config->getopt(
+qq{Usage: dpkg-preconfigure [options] [debs]
+ --apt Apt mode.},
+ "apt" => \$apt,
+);
+
+$|=1;
+
+my @debs=@ARGV;
+@ARGV=();
+
+my $have_tty=1;
+
+if ($apt) {
+ while (<>) {
+ chomp;
+ push @debs, $_ if length $_;
+ }
+
+ exit unless @debs;
+
+ $have_tty=0 unless open (STDIN, "/dev/tty");
+}
+elsif (! @debs) {
+ print STDERR sprintf("dpkg-preconfigure: ".gettext("must specify some debs to preconfigure")), "\n";
+ exit(1);
+}
+
+if (! -x "/usr/bin/apt-extracttemplates") {
+ warn gettext("delaying package configuration, since apt-utils is not installed");
+ exit;
+}
+
+my $frontend=make_frontend();
+
+if (! $have_tty && $frontend->need_tty) {
+ print STDERR sprintf("dpkg-preconfigure: ".gettext("unable to re-open stdin: %s"), $!)."\n";
+ exit 0;
+}
+
+my ($package, $version, $template, $config);
+unless (open(INFO, "-|")) {
+ my $command_max=20000; # LINUX SPECIFIC!!
+ my $static_len=length("apt-extracttemplates");
+ my $len=$static_len;
+ my @collect;
+ if ($apt && @debs > 30) {
+ STDERR->autoflush(1);
+ }
+ foreach my $deb (@debs) {
+ $len += length($deb) + 1;
+ if ($len < $command_max && @collect < 30) {
+ push @collect, $deb;
+ }
+ else {
+ if (system("apt-extracttemplates", @collect) != 0) {
+ print STDERR sprintf("debconf: ".gettext("apt-extracttemplates failed: %s")."\n",$!);
+ }
+ if ($apt && @debs > 30) {
+ $progress += @collect;
+ printf STDERR "\r".gettext("Extracting templates from packages: %d%%"), $progress * 100 / @debs;
+ }
+
+ @collect=($deb);
+ $len=$static_len + length($deb) + 1;
+ }
+ }
+ if (system("apt-extracttemplates", @collect) != 0) {
+ print STDERR sprintf("debconf: ".gettext("apt-extracttemplates failed: %s")."\n",$!);
+ }
+ if ($apt && @debs > 30) {
+ $progress += @collect;
+ printf STDERR "\r".gettext("Extracting templates from packages: %d%%")."\n", $progress * 100 / @debs;
+ }
+ exit;
+}
+my @buffer=<INFO>;
+if ($apt && @buffer) {
+ print gettext("Preconfiguring packages ...\n");
+}
+foreach my $line (@buffer) {
+ ($package, $version, $template, $config)=split /\s/, $line;
+
+ if (defined $template && length $template) {
+ eval q{
+ Debconf::Template->load($template, $package)
+ };
+ unlink $template;
+ if ($@) {
+ print STDERR "$package ".sprintf(gettext("template parse error: %s"), $@)."\n";
+ unlink $config;
+ next;
+ }
+ }
+}
+
+foreach my $line (@buffer) {
+ ($package, $version, $template, $config)=split /\s/, $line;
+
+ if (defined $config && length $config && -e $config) {
+ debug user => sprintf("preconfiguring %s (%s)",$package,$version);
+ chmod(0755, $config) or
+ die sprintf(gettext("debconf: can't chmod: %s"), $!);
+ $frontend->default_title($package);
+ $frontend->info(undef);
+ my $confmodule=make_confmodule($config, 'configure', $version);
+ $confmodule->owner($package);
+ 1 while ($confmodule->communicate);
+ if ($confmodule->exitcode > 0) {
+ print STDERR sprintf(
+ gettext("%s failed to preconfigure, with exit status %s"),
+ $package, $confmodule->exitcode)."\n";
+ }
+ unlink $config;
+ }
+}
+
+$frontend->shutdown;
+
+Debconf::Db->save;
+
+
diff --git a/beagle/debian-rfs/usr/sbin/dpkg-reconfigure b/beagle/debian-rfs/usr/sbin/dpkg-reconfigure
new file mode 100755
index 0000000..e63684f
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/dpkg-reconfigure
@@ -0,0 +1,159 @@
+#!/usr/bin/perl -w
+# This file was preprocessed, do not edit!
+
+
+
+my $infodir="/var/lib/dpkg/info";
+
+use strict;
+use Debconf::Db;
+use Debconf::Gettext;
+use Debconf::Template;
+use Debconf::Config;
+use Debconf::AutoSelect qw(:all);
+use Debconf::Log qw(:all);
+
+Debconf::Config->priority('low');
+
+my $unseen_only=0;
+my $all=0;
+my $force=0;
+my $default_priority=0;
+my $reload=1;
+Debconf::Config->getopt(
+gettext(qq{Usage: dpkg-reconfigure [options] packages
+ -a, --all Reconfigure all packages.
+ -u, --unseen-only Show only not yet seen questions.
+ --default-priority Use default priority instead of low.
+ --force Force reconfiguration of broken packages.
+ --no-reload Do not reload templates. (Use with caution.)}),
+ "all|a" => \$all,
+ "unseen-only|u" => \$unseen_only,
+ "default-priority" => \$default_priority,
+ "force" => \$force,
+ "reload!" => \$reload,
+);
+
+if ($> != 0) {
+ print STDERR sprintf(gettext("%s must be run as root"), $0)."\n";
+ exit 1;
+}
+
+Debconf::Db->load;
+
+if ($default_priority) {
+ Debconf::Config->priority(Debconf::Question->get('debconf/priority')->value);
+}
+
+if (lc Debconf::Config->frontend eq 'noninteractive' &&
+ ! Debconf::Config->frontend_forced) {
+ Debconf::Config->frontend('dialog');
+}
+
+my $frontend=make_frontend();
+
+unless ($unseen_only) {
+ Debconf::Config->reshow(1);
+}
+
+my @packages;
+if ($all) {
+ @packages=allpackages();
+ exit unless @packages;
+}
+else {
+ @packages=@ARGV;
+ if (! @packages) {
+ print STDERR "$0: ".gettext("please specify a package to reconfigure")."\n";
+ exit 1;
+ }
+}
+
+$ENV{DEBCONF_RECONFIGURE}=1;
+
+foreach my $pkg (@packages) {
+ $frontend->default_title($pkg);
+ $frontend->info(undef);
+
+ $_=`dpkg --status $pkg`;
+ my ($version)=m/Version: (.*)\n/;
+ my ($status)=m/Status: (.*)\n/;
+ if (! $force) {
+ if (! defined $status || $status =~ m/not-installed$/) {
+ print STDERR "$0: ".sprintf(gettext("%s is not installed"), $pkg)."\n";
+ exit 1;
+ }
+ if ($status !~ m/ ok installed$/) {
+ print STDERR "$0: ".sprintf(gettext("%s is broken or not fully installed"), $pkg)."\n";
+ exit 1;
+ }
+ }
+
+ if ($reload) {
+ Debconf::Template->load("$infodir/$pkg.templates", $pkg)
+ if -e "$infodir/$pkg.templates";
+ }
+
+ foreach my $info (['prerm', 'upgrade', $version],
+ ['config', 'reconfigure', $version],
+ ['postinst', 'configure', $version]) {
+ my $script=shift @$info;
+ next unless -x "$infodir/$pkg.$script";
+
+ my $is_confmodule='';
+
+ if ($script ne 'config') {
+ open (IN, "<$infodir/$pkg.$script");
+ while (<IN>) {
+ if (/confmodule/i) {
+ $is_confmodule=1;
+ last;
+ }
+ }
+ close IN;
+ }
+
+ if ($script eq 'config' || $is_confmodule) {
+ my $confmodule=make_confmodule(
+ "$infodir/$pkg.$script", @$info);
+
+ $confmodule->owner($pkg);
+
+ 1 while ($confmodule->communicate);
+
+ exit $confmodule->exitcode if $confmodule->exitcode > 0;
+ }
+ else {
+ Debconf::Db->save;
+
+ delete $ENV{DEBIAN_HAS_FRONTEND};
+ my $ret=system("$infodir/$pkg.$script", @$info);
+ if (int($ret / 256) != 0) {
+ exit int($ret / 256);
+ }
+ $ENV{DEBIAN_HAS_FRONTEND}=1;
+
+ Debconf::Db->load;
+ }
+ }
+}
+
+$frontend->shutdown;
+
+Debconf::Db->save;
+
+sub allpackages {
+ my @ret;
+ local $/="\n\n";
+
+ open (STATUS, "</var/lib/dpkg/status")
+ || die sprintf(gettext("Cannot read status file: %s"), $!);
+ while (<STATUS>) {
+ push @ret, $1
+ if m/Status:\s*.*\sinstalled\n/ && m/Package:\s*(.*)\n/;
+ }
+ close STATUS;
+
+ return sort @ret;
+}
+
diff --git a/beagle/debian-rfs/usr/sbin/dpkg-statoverride b/beagle/debian-rfs/usr/sbin/dpkg-statoverride
new file mode 120000
index 0000000..d1bbaa0
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/dpkg-statoverride
@@ -0,0 +1 @@
+../bin/dpkg-statoverride \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/e2freefrag b/beagle/debian-rfs/usr/sbin/e2freefrag
new file mode 100755
index 0000000..112cbd2
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/e2freefrag
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/fdformat b/beagle/debian-rfs/usr/sbin/fdformat
new file mode 100755
index 0000000..9bf81ce
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/fdformat
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/filefrag b/beagle/debian-rfs/usr/sbin/filefrag
new file mode 100755
index 0000000..7224cc1
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/filefrag
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/groupadd b/beagle/debian-rfs/usr/sbin/groupadd
new file mode 100755
index 0000000..9783a89
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/groupadd
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/groupdel b/beagle/debian-rfs/usr/sbin/groupdel
new file mode 100755
index 0000000..e71f295
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/groupdel
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/groupmod b/beagle/debian-rfs/usr/sbin/groupmod
new file mode 100755
index 0000000..7699b63
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/groupmod
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/grpck b/beagle/debian-rfs/usr/sbin/grpck
new file mode 100755
index 0000000..9c2930d
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/grpck
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/grpconv b/beagle/debian-rfs/usr/sbin/grpconv
new file mode 100755
index 0000000..e037b30
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/grpconv
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/grpunconv b/beagle/debian-rfs/usr/sbin/grpunconv
new file mode 100755
index 0000000..f2e020c
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/grpunconv
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/iconvconfig b/beagle/debian-rfs/usr/sbin/iconvconfig
new file mode 100755
index 0000000..fd20548
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/iconvconfig
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/install-info b/beagle/debian-rfs/usr/sbin/install-info
new file mode 100755
index 0000000..6f13a86
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/install-info
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/invoke-rc.d b/beagle/debian-rfs/usr/sbin/invoke-rc.d
new file mode 100755
index 0000000..e5887ee
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/invoke-rc.d
@@ -0,0 +1,464 @@
+#!/bin/sh
+#
+# invoke-rc.d.sysvinit - Executes initscript actions
+#
+# SysVinit /etc/rc?.d version for Debian's sysvinit package
+#
+# Copyright (C) 2000,2001 Henrique de Moraes Holschuh <hmh@debian.org>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Constants
+RUNLEVEL=/sbin/runlevel
+POLICYHELPER=/usr/sbin/policy-rc.d
+INITDPREFIX=/etc/init.d/
+RCDPREFIX=/etc/rc
+
+# Options
+BEQUIET=
+MODE=
+ACTION=
+FALLBACK=
+NOFALLBACK=
+FORCE=
+RETRY=
+RETURNFAILURE=
+RC=
+
+# Shell options
+set +e
+
+dohelp () {
+ #
+ # outputs help and usage
+ #
+cat <<EOF
+
+invoke-rc.d, Debian/SysVinit (/etc/rc?.d) initscript subsystem.
+Copyright (c) 2000,2001 Henrique de Moraes Holschuh <hmh@debian.org>
+
+Usage:
+ invoke-rc.d [options] <basename> <action> [extra parameters]
+
+ basename - Initscript ID, as per update-rc.d(8)
+ action - Initscript action. Known actions are:
+ start, [force-]stop, restart,
+ [force-]reload, status
+ WARNING: not all initscripts implement all of the above actions.
+
+ extra parameters are passed as is to the initscript, following
+ the action (first initscript parameter).
+
+Options:
+ --quiet
+ Quiet mode, no error messages are generated.
+ --force
+ Try to run the initscript regardless of policy and subsystem
+ non-fatal errors.
+ --try-anyway
+ Try to run init script even if a non-fatal error is found.
+ --disclose-deny
+ Return status code 101 instead of status code 0 if
+ initscript action is denied by local policy rules or
+ runlevel constrains.
+ --query
+ Returns one of status codes 100-106, does not run
+ the initscript. Implies --disclose-deny and --no-fallback.
+ --no-fallback
+ Ignores any fallback action requests by the policy layer.
+ Warning: this is usually a very *bad* idea for any actions
+ other than "start".
+ --help
+ Outputs help message to stdout
+
+EOF
+}
+
+printerror () {
+ #
+ # prints an error message
+ # $* - error message
+ #
+if test x${BEQUIET} = x ; then
+ echo `basename $0`: "$*" >&2
+fi
+}
+
+formataction () {
+ #
+ # formats a list in $* into $printaction
+ # for human-friendly printing to stderr
+ # and sets $naction to action or actions
+ #
+printaction=`echo $* | sed 's/ /, /g'`
+if test $# -eq 1 ; then
+ naction=action
+else
+ naction=actions
+fi
+}
+
+querypolicy () {
+ #
+ # queries policy database
+ # returns: $RC = 104 - ok, run
+ # $RC = 101 - ok, do not run
+ # other - exit with status $RC, maybe run if $RETRY
+ # initial status of $RC is taken into account.
+ #
+
+policyaction="${ACTION}"
+if test x${RC} = "x101" ; then
+ if test "${ACTION}" = "start" || test "${ACTION}" = "restart" ; then
+ policyaction="(${ACTION})"
+ fi
+fi
+
+if test "x${POLICYHELPER}" != x && test -x "${POLICYHELPER}" ; then
+ FALLBACK=`${POLICYHELPER} ${BEQUIET} ${INITSCRIPTID} "${policyaction}" ${RL}`
+ RC=$?
+ formataction ${ACTION}
+ case ${RC} in
+ 0) RC=104
+ ;;
+ 1) RC=105
+ ;;
+ 101) if test x${FORCE} != x ; then
+ printerror Overriding policy-rc.d denied execution of ${printaction}.
+ RC=104
+ else
+ printerror policy-rc.d denied execution of ${printaction}.
+ fi
+ ;;
+ esac
+ if test x${MODE} != xquery ; then
+ case ${RC} in
+ 105) printerror policy-rc.d query returned \"behaviour undefined\",
+ printerror assuming \"${printaction}\" is allowed.
+ RC=104
+ ;;
+ 106) formataction ${FALLBACK}
+ if test x${FORCE} = x ; then
+ if test x${NOFALLBACK} = x ; then
+ ACTION="${FALLBACK}"
+ printerror executing ${naction} \"${printaction}\" instead due to policy-rc.d request.
+ RC=104
+ else
+ printerror ignoring policy-rc.d fallback request: ${printaction}.
+ RC=101
+ fi
+ else
+ printerror ignoring policy-rc.d fallback request: ${printaction}.
+ RC=104
+ fi
+ ;;
+ esac
+ fi
+ case ${RC} in
+ 100|101|102|103|104|105|106) ;;
+ *) printerror WARNING: policy-rc.d returned unexpected error status ${RC}, 102 used instead.
+ RC=102
+ ;;
+ esac
+else
+ if test x${RC} = x ; then
+ RC=104
+ fi
+fi
+return
+}
+
+verifyparameter () {
+ #
+ # Verifies if $1 is not null, and $# = 1
+ #
+if test $# -eq 0 ; then
+ printerror syntax error: invalid empty parameter
+ exit 103
+elif test $# -ne 1 ; then
+ printerror syntax error: embedded blanks are not allowed in \"$*\"
+ exit 103
+fi
+return
+}
+
+##
+## main
+##
+
+## Verifies command line arguments
+
+if test $# -eq 0 ; then
+ printerror syntax error: missing required parameter, --help assumed
+ dohelp
+ exit 103
+fi
+
+state=I
+while test $# -gt 0 && test ${state} != III ; do
+ case "$1" in
+ --help) dohelp
+ exit 0
+ ;;
+ --quiet) BEQUIET=--quiet
+ ;;
+ --force) FORCE=yes
+ RETRY=yes
+ ;;
+ --try-anyway)
+ RETRY=yes
+ ;;
+ --disclose-deny)
+ RETURNFAILURE=yes
+ ;;
+ --query) MODE=query
+ RETURNFAILURE=yes
+ ;;
+ --no-fallback)
+ NOFALLBACK=yes
+ ;;
+ --*) printerror syntax error: unknown option \"$1\"
+ exit 103
+ ;;
+ *) case ${state} in
+ I) verifyparameter $1
+ INITSCRIPTID=$1
+ ;;
+ II) verifyparameter $1
+ ACTION=$1
+ ;;
+ esac
+ state=${state}I
+ ;;
+ esac
+ shift
+done
+
+if test ${state} != III ; then
+ printerror syntax error: missing required parameter
+ exit 103
+fi
+
+#NOTE: It may not be obvious, but "$@" from this point on must expand
+#to the extra initscript parameters, except inside functions.
+
+## sanity checks and just-in-case warnings.
+case ${ACTION} in
+ start|stop|force-stop|restart|reload|force-reload|status)
+ ;;
+ *)
+ if test "x${POLICYHELPER}" != x && test -x "${POLICYHELPER}" ; then
+ printerror action ${ACTION} is unknown, but proceeding anyway.
+ fi
+ ;;
+esac
+
+## Verifies if the given initscript ID is known
+## For sysvinit, this error is critical
+if test ! -f "${INITDPREFIX}${INITSCRIPTID}" ; then
+ printerror unknown initscript, ${INITDPREFIX}${INITSCRIPTID} not found.
+ exit 100
+fi
+
+## Queries sysvinit for the current runlevel
+RL=`${RUNLEVEL} | sed 's/.*\ //'`
+if test ! $? ; then
+ printerror "could not determine current runlevel"
+ if test x${RETRY} = x ; then
+ exit 102
+ fi
+ RL=
+fi
+
+## Running ${RUNLEVEL} to get current runlevel do not work in the boot
+## runlevel (scripts in /etc/rcS.d/), as /var/run/utmp contain
+## runlevel 0 or 6 (written at shutdown) at that point.
+if test x${RL} = x0 || test x${RL} = x6 ; then
+ if ps -fp 1 | grep -q 'init boot' ; then
+ RL=S
+ fi
+fi
+
+## Handles shutdown sequences VERY safely
+## i.e.: forget about policy, and do all we can to run the script.
+## BTW, why the heck are we being run in a shutdown runlevel?!
+if test x${RL} = x0 || test x${RL} = x6 ; then
+ FORCE=yes
+ RETRY=yes
+ POLICYHELPER=
+ BEQUIET=
+ printerror "-----------------------------------------------------"
+ printerror "WARNING: 'invoke-rc.d ${INITSCRIPTID} ${ACTION}' called"
+ printerror "during shutdown sequence."
+ printerror "enabling safe mode: initscript policy layer disabled"
+ printerror "-----------------------------------------------------"
+fi
+
+## Verifies the existance of proper S??initscriptID and K??initscriptID
+## *links* in the proper /etc/rc?.d/ directory
+verifyrclink () {
+ #
+ # verifies if parameters are non-dangling symlinks
+ # all parameters are verified
+ #
+ doexit=
+ while test $# -gt 0 ; do
+ if test ! -L "$1" ; then
+ printerror not a symlink: $1
+ doexit=102
+ fi
+ if test ! -f "$1" ; then
+ printerror dangling symlink: $1
+ doexit=102
+ fi
+ shift
+ done
+ if test x${doexit} != x && test x${RETRY} = x; then
+ exit ${doexit}
+ fi
+ return 0
+}
+
+# we do handle multiple links per runlevel
+# but we don't handle embedded blanks in link names :-(
+if test x${RL} != x ; then
+ SLINK=`ls -d -Q ${RCDPREFIX}${RL}.d/S[0-9][0-9]${INITSCRIPTID} 2>/dev/null | xargs`
+ KLINK=`ls -d -Q ${RCDPREFIX}${RL}.d/K[0-9][0-9]${INITSCRIPTID} 2>/dev/null | xargs`
+ SSLINK=`ls -d -Q ${RCDPREFIX}S.d/S[0-9][0-9]${INITSCRIPTID} 2>/dev/null | xargs`
+
+ verifyrclink ${SLINK} ${KLINK} ${SSLINK}
+fi
+
+testexec () {
+ #
+ # returns true if any of the parameters is
+ # executable (after following links)
+ #
+ while test $# -gt 0 ; do
+ if test -x "$1" ; then
+ return 0
+ fi
+ shift
+ done
+ return 1
+}
+
+RC=
+
+###
+### LOCAL INITSCRIPT POLICY: Enforce need of a start entry
+### in either runlevel S or current runlevel to allow start
+### or restart.
+###
+case ${ACTION} in
+ start|restart)
+ if testexec ${SLINK} ; then
+ RC=104
+ elif testexec ${KLINK} ; then
+ RC=101
+ elif testexec ${SSLINK} ; then
+ RC=104
+ fi
+ ;;
+esac
+
+# test if /etc/init.d/initscript is actually executable
+if testexec "${INITDPREFIX}${INITSCRIPTID}" ; then
+ if test x${RC} = x && test x${MODE} = xquery ; then
+ RC=105
+ fi
+
+ # call policy layer
+ querypolicy
+ case ${RC} in
+ 101|104)
+ ;;
+ *) if test x${MODE} != xquery ; then
+ printerror policy-rc.d returned error status ${RC}
+ if test x${RETRY} = x ; then
+ exit ${RC}
+ else
+ RC=102
+ fi
+ fi
+ ;;
+ esac
+else
+ ###
+ ### LOCAL INITSCRIPT POLICY: non-executable initscript; deny exec.
+ ### (this is common sense, actually :^P )
+ ###
+ RC=101
+fi
+
+## Handles --query
+if test x${MODE} = xquery ; then
+ exit ${RC}
+fi
+
+
+setechoactions () {
+ if test $# -gt 1 ; then
+ echoaction=true
+ else
+ echoaction=
+ fi
+}
+getnextaction () {
+ saction=$1
+ shift
+ ACTION="$@"
+}
+
+## Executes initscript
+## note that $ACTION is a space-separated list of actions
+## to be attempted in order until one suceeds.
+if test x${FORCE} != x || test ${RC} -eq 104 ; then
+ if testexec "${INITDPREFIX}${INITSCRIPTID}" ; then
+ RC=102
+ setechoactions ${ACTION}
+ while test ! -z "${ACTION}" ; do
+ getnextaction ${ACTION}
+ if test ! -z ${echoaction} ; then
+ printerror executing initscript action \"${saction}\"...
+ fi
+
+ "${INITDPREFIX}${INITSCRIPTID}" "${saction}" "$@" && exit 0
+ RC=$?
+
+ if test ! -z "${ACTION}" ; then
+ printerror action \"${saction}\" failed, trying next action...
+ fi
+ done
+ printerror initscript ${INITSCRIPTID}, action \"${saction}\" failed.
+ exit ${RC}
+ fi
+ exit 102
+fi
+
+## Handles --disclose-deny and denied "status" action (bug #381497)
+if test ${RC} -eq 101 && test x${RETURNFAILURE} = x ; then
+ if test "x${ACTION%% *}" = "xstatus"; then
+ printerror emulating initscript action \"status\", returning \"unknown\"
+ RC=4
+ else
+ RC=0
+ fi
+else
+ formataction ${ACTION}
+ printerror initscript ${naction} \"${printaction}\" not executed.
+fi
+
+exit ${RC}
diff --git a/beagle/debian-rfs/usr/sbin/ldattach b/beagle/debian-rfs/usr/sbin/ldattach
new file mode 100755
index 0000000..b676705
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/ldattach
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/mklost+found b/beagle/debian-rfs/usr/sbin/mklost+found
new file mode 100755
index 0000000..bbd671d
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/mklost+found
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/newusers b/beagle/debian-rfs/usr/sbin/newusers
new file mode 100755
index 0000000..a91875a
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/newusers
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/nologin b/beagle/debian-rfs/usr/sbin/nologin
new file mode 100755
index 0000000..4abb9b9
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/nologin
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/pam-auth-update b/beagle/debian-rfs/usr/sbin/pam-auth-update
new file mode 100755
index 0000000..7010cdc
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/pam-auth-update
@@ -0,0 +1,697 @@
+#!/usr/bin/perl -w
+
+# pam-auth-update: update /etc/pam.d/common-* from /usr/share/pam-configs
+#
+# Update the /etc/pam.d/common-* files based on the per-package profiles
+# provided in /usr/share/pam-configs/ taking into consideration user's
+# preferences (as determined via debconf prompting).
+#
+# Written by Steve Langasek <steve.langasek@canonical.com>
+#
+# Copyright (C) 2008 Canonical Ltd.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 3 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# # This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+use strict;
+use Debconf::Client::ConfModule ':all';
+use IPC::Open2 'open2';
+
+version('2.0');
+my $capb=capb('backup escape');
+
+my $inputdir = '/usr/share/pam-configs';
+my $template = 'libpam-runtime/profiles';
+my $errtemplate = 'libpam-runtime/conflicts';
+my $overridetemplate = 'libpam-runtime/override';
+my $blanktemplate = 'libpam-runtime/no_profiles_chosen';
+my $confdir = '/etc/pam.d';
+my $savedir = '/var/lib/pam';
+my (%profiles, @sorted, @enabled, @conflicts, @new, %removals);
+my $force = 0;
+my $package = 0;
+my $priority = 'high';
+my %md5sums = (
+ 'auth' => ['8d4fe17e66ba25de16a117035d1396aa'],
+ 'account' => ['3c0c362eaf3421848b679d63fd48c3fa'],
+ 'password' => [
+ '50fce2113dfda83ac8bdd5a6e706caec',
+ '4bd7610f2e85f8ddaef79c7db7cb49eb',
+ '9ba753d0824276b44bcadfee1f87b6bc',
+ ],
+ 'session' => [
+ '240fb92986c885b327cdb21dd641da8c',
+ '4a25673e8b36f1805219027d3be02cd2',
+ ],
+ 'session-noninteractive' => [
+ 'ad2b78ce1498dd637ef36469430b6ac6',
+ ],
+);
+
+opendir(DIR, $inputdir) || die "could not open config directory: $!";
+while (my $profile = readdir(DIR)) {
+ next if ($profile eq '.' || $profile eq '..');
+ %{$profiles{$profile}} = parse_pam_profile($inputdir . '/' . $profile);
+}
+closedir DIR;
+
+# use a '--force' arg to specify that /etc/pam.d should be overwritten;
+# used only on upgrades where the postinst has already determined that the
+# checksums match. Module packages other than libpam-runtime itself must
+# NEVER use this option! Document with big skullses and crossboneses! It
+# needs to be exposed for libpam-runtime because that's the package that
+# decides whether we have a pristine config to be converted, and knows
+# whether the version being upgraded from is one for which the conversion
+# should be done.
+
+while ($#ARGV >= 0) {
+ my $opt = shift;
+ if ($opt eq '--force') {
+ $force = 1;
+ } elsif ($opt eq '--package') {
+ $package = 1;
+ } elsif ($opt eq '--remove') {
+ while ($#ARGV >= 0) {
+ last if ($ARGV[0] =~ /^--/);
+ $removals{shift @ARGV} = 1;
+ }
+ # --remove implies --package
+ $package = 1 if (keys(%removals));
+ }
+}
+
+$priority = 'medium' if ($package);
+
+x_loadtemplatefile('/var/lib/dpkg/info/libpam-runtime.templates','libpam-runtime');
+
+# always sort by priority, so we have consistency and don't have to
+# shuffle later
+@sorted = sort { $profiles{$b}->{'Priority'} <=> $profiles{$a}->{'Priority'}
+ || $b cmp $a }
+ keys(%profiles);
+# If we're being called for package removal, filter out those options here
+@sorted = grep { !$removals{$_} } @sorted;
+
+subst($template, 'profile_names', join(', ',@sorted));
+subst($template, 'profiles',
+ join(', ', map { $profiles{$_}->{'Name'} } @sorted));
+
+my $diff = diff_profiles($confdir,$savedir);
+
+if ($diff) {
+ @enabled = grep { !$removals{$_} } @{$diff->{'mods'}};
+} else {
+ @enabled = split(/, /,get($template));
+}
+
+# find out what we've seen, so we can ignore those defaults
+my %seen;
+if (-e $savedir . '/seen') {
+ open(SEEN,$savedir . '/seen');
+ while (<SEEN>) {
+ chomp;
+ $seen{$_} = 1;
+ }
+ close(SEEN);
+}
+
+# filter out any options that are no longer available for any reason
+@enabled = grep { $profiles{$_} } @enabled;
+
+# an empty module set is an error, so in that case grab all the defaults
+if (!@enabled) {
+ %seen = ();
+ $priority = 'high' unless ($force);
+}
+
+# add any previously-unseen configs
+push(@enabled,
+ grep { $profiles{$_}->{'Default'} eq 'yes' && !$seen{$_} } @sorted);
+@enabled = sort { $profiles{$b}->{'Priority'} <=> $profiles{$a}->{'Priority'}
+ || $b cmp $a }
+ @enabled;
+my $prev = '';
+@enabled = grep { $_ ne $prev && (($prev) = $_) } @enabled;
+
+# Do we have any new options to show? If not, we shouldn't reprompt the
+# user, at any priority level, unless explicitly called.
+@new = grep { !$seen{$_} } @sorted;
+
+# if diff_profiles() fails, and we weren't passed a 'force' argument
+# (because this isn't an upgrade from an old version, or the checksum
+# didn't match, or we're being called by some other module package), prompt
+# the user whether to override. If the user declines (the default), we
+# never again manage this config unless manually called with '--force'.
+if (!$diff && !$force) {
+ input('high',$overridetemplate);
+ go();
+ $force = 1 if (get($overridetemplate) eq 'true');
+}
+
+if (!$diff && !$force) {
+ print STDERR <<EOF;
+
+pam-auth-update: Local modifications to /etc/pam.d/common-*, not updating.
+pam-auth-update: Run pam-auth-update --force to override.
+
+EOF
+ exit;
+}
+
+umask(0022);
+
+do {
+ @conflicts = ();
+
+ if (@new || !$package) {
+ fset($template,'seen','false');
+ }
+ set($template,join(', ', @enabled));
+
+ input($priority,$template);
+ go();
+
+ @enabled = split(/, /, get($template));
+
+ # in case of conflicts, automatically unset the lower priority
+ # item of each pair
+ foreach my $elem (@enabled)
+ {
+ for (my $i=$#enabled; $i >= 0; $i--)
+ {
+ my $conflict = $enabled[$i];
+ if ($profiles{$elem}->{'Conflicts'}->{$conflict}) {
+ splice(@enabled,$i,1);
+ my $desc = $profiles{$elem}->{'Name'}
+ . ', ' . $profiles{$conflict}->{'Name'};
+ push(@conflicts,$desc);
+ }
+ }
+ }
+ if (@conflicts) {
+ subst($errtemplate, 'conflicts', join("\\n", @conflicts));
+ input('high',$errtemplate);
+ }
+ set($template, join(', ', @enabled));
+ if (!@enabled) {
+ input('high',$blanktemplate);
+ # we can only end up here by user error, but give them another
+ # shot at selecting a correct config anyway.
+ fset($template,'seen','false');
+ }
+} while (@conflicts || !@enabled);
+
+# the decision has been made about what configs to use, so even if
+# something fails after this, we shouldn't go munging the default
+# options again. Save the list of known configs to /var/lib/pam.
+open(SEEN,"> $savedir/seen");
+for my $i (@sorted) {
+ print SEEN "$i\n";
+}
+close(SEEN);
+
+# @enabled now contains our list of profiles to use for piecing together
+# a config
+# we have:
+# - templates into which we insert the specialness
+# - magic comments denoting the beginning and end of our managed block;
+# looking at only the functional config lines would potentially let us
+# handle more cases, at the expense of much greater complexity, so
+# pass on this at least for the first round
+# - a representation of the autogenerated config stored in /var/lib/pam,
+# that we can diff against in order to account for changed options or
+# manually dropped modules
+# - a hash describing the local modifications the user has made to the
+# config; these are always preserved unless manually overridden with
+# the --force option
+
+write_profiles(\%profiles, \@enabled, $confdir, $savedir, $diff, $force);
+
+
+# take a single line from a stock config, and merge it with the
+# information about local admin edits
+sub merge_one_line
+{
+ my ($line,$diff,$count) = @_;
+ my (@opts,$modline);
+
+ my ($adds,$removes);
+
+ $line =~ /^((\[[^]]+\]|\w+)\s+\S+)\s*(.*)/;
+
+ @opts = split(/\s+/,$3);
+ $modline = $1;
+ $modline =~ s/end/$count/g;
+ if ($diff) {
+ my $mod = $modline;
+ $mod =~ s/(\[[^0-9]*)[0-9]+(.*\])/$1$2/g;
+ $adds = \%{$diff->{'add'}{$mod}};
+ $removes = \%{$diff->{'remove'}{$mod}};
+ } else {
+ $adds = $removes = undef;
+ }
+
+ for (my $i = 0; $i <= $#opts; $i++) {
+ if ($adds->{$opts[$i]}) {
+ delete $adds->{$opts[$i]};
+ }
+ if ($removes->{$opts[$i]}) {
+ splice(@opts,$i,1);
+ $i--;
+ }
+ }
+ return $modline . " " . join(' ',@opts,sort keys(%{$adds})) . "\n";
+}
+
+# return the lines for a given config name, type, and position in the stack
+sub lines_for_module_and_type
+{
+ my ($profiles, $mod, $type, $modpos) = @_;
+ if ($modpos == 0 && $profiles->{$mod}{$type . '-Initial'}) {
+ return $profiles->{$mod}{$type . '-Initial'};
+ }
+ return $profiles->{$mod}{$type};
+}
+
+# create a single PAM config from the indicated template and selections,
+# writing to a new file
+sub create_from_template
+{
+ my($template,$dest,$profiles,$enabled,$diff,$type) = @_;
+ my $state = 0;
+ my $uctype = ucfirst($type);
+ $type =~ s/-noninteractive//;
+
+ open(INPUT,$template) || return 0;
+ open(OUTPUT,">$dest") || return 0;
+
+ while (<INPUT>) {
+ if ($state == 1) {
+ if (/^# here's the fallback if no module succeeds/) {
+ print OUTPUT;
+ $state++;
+ }
+ next;
+ }
+ if ($state == 3) {
+ if (/^# end of pam-auth-update config/) {
+ print OUTPUT;
+ $state++;
+ }
+ next;
+ }
+
+ print OUTPUT;
+
+ my ($pattern,$val);
+ if ($state == 0) {
+ $pattern = '^# here are the per-package modules \(the "Primary" block\)';
+ $val = 'Primary';
+ } elsif ($state == 2) {
+ $pattern = '^# and here are more per-package modules \(the "Additional" block\)';
+ $val = 'Additional';
+ } else {
+ next;
+ }
+
+ if (/$pattern/) {
+ my $i = 0;
+ my $count = 0;
+ # first we need to get a count of lines that we're
+ # going to output, so we can fix up the jumps correctly
+ for my $mod (@{$enabled}) {
+ my $output;
+ next if (!$profiles->{$mod}{$uctype . '-Type'});
+ next if $profiles->{$mod}{$uctype . '-Type'} ne $val;
+ $output = lines_for_module_and_type($profiles, $mod, $uctype, $i++);
+ # bypasses a perl warning about @_, sigh
+ my @tmparr = split("\n+",$output);
+ $count += @tmparr;
+ }
+
+ # in case anything tries to jump in the 'additional'
+ # block, let's try not to jump off the stack...
+ $count-- if ($val eq 'Additional');
+
+ # no primary block, so output a stock pam_permit line
+ # to keep the stack intact
+ if ($val eq 'Primary' && $count == 0)
+ {
+ print OUTPUT "$type\t[default=1]\t\t\tpam_permit.so\n";
+ }
+
+ $i = 0;
+ for my $mod (@{$enabled}) {
+ my $output;
+ my @output;
+ next if (!$profiles->{$mod}{$uctype . '-Type'});
+ next if $profiles->{$mod}{$uctype . '-Type'} ne $val;
+ $output = lines_for_module_and_type($profiles, $mod, $uctype, $i++);
+ for my $line (split("\n",$output)) {
+ $line = merge_one_line($line,$diff,
+ $count);
+ print OUTPUT "$type\t$line";
+ $count--;
+ }
+ }
+ $state++;
+ }
+ }
+ close(INPUT);
+ close(OUTPUT);
+
+ if ($state < 4) {
+ unlink($dest);
+ return 0;
+ }
+ return 1;
+}
+
+# take a template file, strip out everything between the markers, and
+# return the md5sum of the remaining contents. Used for testing for
+# local modifications of the boilerplate.
+sub get_template_md5sum
+{
+ my($template) = @_;
+ my $state = 0;
+
+ open(INPUT,$template) || return '';
+ my($md5sum_fd,$output_fd);
+ my $pid = open2($md5sum_fd, $output_fd, 'md5sum');
+ return '' if (!$pid);
+
+ while (<INPUT>) {
+ if ($state == 1) {
+ if (/^# here's the fallback if no module succeeds/) {
+ print $output_fd $_;
+ $state++;
+ }
+ next;
+ }
+ if ($state == 3) {
+ if (/^# end of pam-auth-update config/) {
+ print $output_fd $_;
+ $state++;
+ }
+ next;
+ }
+
+ print $output_fd $_;
+
+ my ($pattern,$val);
+ if ($state == 0) {
+ $pattern = '^# here are the per-package modules \(the "Primary" block\)';
+ } elsif ($state == 2) {
+ $pattern = '^# and here are more per-package modules \(the "Additional" block\)';
+ } else {
+ next;
+ }
+
+ if (/$pattern/) {
+ $state++;
+ }
+ }
+ close(INPUT);
+ close($output_fd);
+ my $md5sum = <$md5sum_fd>;
+ close($md5sum_fd);
+ waitpid $pid, 0;
+
+ $md5sum = (split(/\s+/,$md5sum))[0];
+ return $md5sum;
+}
+
+# merge a set of module declarations into a set of new config files,
+# using the information returned from diff_profiles().
+sub write_profiles
+{
+ my($profiles,$enabled,$confdir,$savedir,$diff,$force) = @_;
+
+ if (! -d $savedir) {
+ mkdir($savedir);
+ }
+
+ # because we can't atomically replace both /var/lib/pam/$foo and
+ # /etc/pam.d/common-$foo at the same time, take steps to make this
+ # somewhat robust
+ for my $type ('auth','account','password','session',
+ 'session-noninteractive')
+ {
+ my $target = $confdir . '/common-' . $type;
+ my $template = $target;
+ my $dest = $template . '.pam-new';
+
+ my $diff = $diff;
+ if ($diff) {
+ $diff = \%{$diff->{$type}};
+ }
+
+ # Detect if the template is unmodified, and if so, use
+ # the version from /usr/share. Depends on knowing the
+ # md5sums of the originals.
+ my $md5sum = get_template_md5sum($template);
+ for my $i (@{$md5sums{$type}}) {
+ if ($md5sum eq $i) {
+ $template = '/usr/share/pam/common-' . $type;
+ last;
+ }
+ }
+
+ # first, write out the new config
+ if (!create_from_template($template,$dest,$profiles,$enabled,
+ $diff,$type))
+ {
+ if (!$force) {
+ return 0;
+ }
+ $template = '/usr/share/pam/common-' . $type;
+ if (!create_from_template($template,$dest,$profiles,
+ $enabled,$diff,$type))
+ {
+ return 0;
+ }
+ }
+
+ # then write out the saved config
+ if (!open(OUTPUT, "> $savedir/$type.new")) {
+ unlink($dest);
+ return 0;
+ }
+ my $i = 0;
+ my $uctype = ucfirst($type);
+ for my $mod (@{$enabled}) {
+ my $output;
+ next if (!$profiles->{$mod}{$uctype . '-Type'});
+ next if ($profiles->{$mod}{$uctype . '-Type'} eq 'Additional');
+
+ $output = lines_for_module_and_type($profiles, $mod, $uctype, $i++);
+ if ($output) {
+ print OUTPUT "Module: $mod\n";
+ print OUTPUT $output . "\n";
+ }
+ }
+
+ # no primary block, so output a stock pam_permit line
+ if ($i == 0)
+ {
+ print OUTPUT "Module: null\n";
+ print OUTPUT "[default=1]\t\t\tpam_permit.so\n";
+ }
+
+ $i = 0;
+ for my $mod (@{$enabled}) {
+ my $output;
+ next if (!$profiles->{$mod}{$uctype . '-Type'});
+ next if ($profiles->{$mod}{$uctype . '-Type'} eq 'Primary');
+
+ $output = lines_for_module_and_type($profiles, $mod, $uctype, $i++);
+ if ($output) {
+ print OUTPUT "Module: $mod\n";
+ print OUTPUT $output . "\n";
+ }
+ }
+
+ close(OUTPUT);
+
+ # then do the renames, back-to-back
+ # we have to use system because File::Copy is in
+ # perl-modules, not perl-base
+ if (-e "$target" && $force) {
+ system('cp','-f',$target,$target . '.pam-old');
+ }
+ rename($dest,$target);
+ rename("$savedir/$type.new","$savedir/$type");
+ }
+
+ # at the end of a successful write, reset the 'seen' flag and the
+ # value of the debconf override question.
+ fset($overridetemplate,'seen','false');
+ set($overridetemplate,'false');
+}
+
+# reconcile the current config in /etc/pam.d with the saved ones in
+# /var/lib/pam; returns a hash of profile names and the corresponding
+# options that should be added/removed relative to the stock config.
+# returns false if any of the markers are missing that permit a merge,
+# or on any other failure.
+sub diff_profiles
+{
+ my ($sourcedir,$savedir) = @_;
+ my (%diff);
+
+ @{$diff{'mods'}} = ();
+ # Load the saved config from /var/lib/pam, then iterate through all
+ # lines in the current config that are in the managed block.
+ # If anything fails here, just return immediately since we then
+ # have nothing to merge; instead, the caller will decide later
+ # whether to force an overwrite.
+ for my $type ('auth','account','password','session',
+ 'session-noninteractive')
+ {
+ my (@saved,$modname);
+
+ open(SAVED,$savedir . '/' . $type) || return 0;
+ while (<SAVED>) {
+ if (/^Module: (.*)/) {
+ $modname = $1;
+ next;
+ }
+ chomp;
+ # trim out the destination of any jumps; this saves
+ # us from having to re-parse everything just to fix
+ # up the jump lengths, when changes to these will
+ # already show up as inconsistencies elsewhere
+ s/(\[[^0-9]*)[0-9]+(.*\])/$1$2/g;
+ s/(\[.*)end(.*\])/$1$2/g;
+ my (@temp) = ($modname,$_);
+ push(@saved,\@temp);
+ }
+ close(SAVED);
+
+ my $state = 0;
+ my (@prev_opts,$curmod);
+ my $realtype = $type;
+ $realtype =~ s/-noninteractive//;
+
+ open(CURRENT,$sourcedir . '/common-' . $type) || return 0;
+ while (<CURRENT>) {
+ if ($state == 0) {
+ $state = 1
+ if (/^# here are the per-package modules \(the "Primary" block\)/);
+ next;
+ }
+ if ($state == 1) {
+ s/^$realtype\s+//;
+ if (/^# here's the fallback if no module succeeds/) {
+ $state = 2;
+ next;
+ }
+ }
+ if ($state == 2) {
+ $state = 3
+ if (/^# and here are more per-package modules \(the "Additional" block\)/);
+ next;
+ }
+ if ($state == 3) {
+ last if (/^# end of pam-auth-update config/);
+ s/^$realtype\s+//;
+ }
+
+ my $found = 0;
+ my $curopts;
+ while (!$found && $#saved >= 0) {
+ my $line;
+ ($modname,$line) = @{$saved[0]};
+ shift(@saved);
+ $line =~ /^((\[[^]]+\]|\w+)\s+\S+)\s*(.*)/;
+ @prev_opts = split(/\s+/,$3);
+ $curmod = $1;
+ # FIXME: the key isn't derived from the config
+ # name, so collisions are possible if more
+ # than one config references the same module
+
+ $_ =~ s/(\[[^0-9]*)[0-9]+(.*\])/$1$2/g;
+ # check if this is a match for the current line
+ if ($_ =~ /^\Q$curmod\E\s*(.*)$/) {
+ $found = 1;
+ $curopts = $1;
+ push(@{$diff{'mods'}},$modname);
+ }
+ }
+
+ # there's a line in the live config that doesn't
+ # correspond to anything from the saved config.
+ # treat this as a failure; it's very error-prone
+ # to decide what to do with an added line that
+ # didn't come from a package.
+ return 0 if (!$found);
+
+ for my $opt (split(/\s+/,$curopts)) {
+ my $found = 0;
+ for (my $i = 0; $i <= $#prev_opts; $i++) {
+ if ($prev_opts[$i] eq $opt) {
+ $found = 1;
+ splice(@prev_opts,$i,1);
+ }
+ }
+ $diff{$type}{'add'}{$curmod}{$opt} = 1 if (!$found);
+ }
+ for my $opt (@prev_opts) {
+ $diff{$type}{'remove'}{$curmod}{$opt} = 1;
+ }
+ }
+ close(CURRENT);
+
+ # we couldn't parse the config, so the merge fails
+ return 0 if ($state < 3);
+ }
+ return \%diff;
+}
+
+# simple function to parse a provided config file, in pseudo-RFC822
+# format,
+sub parse_pam_profile
+{
+ my ($profile) = $_[0];
+ my $fieldname;
+ my %profile;
+ open(PROFILE, $profile) || die "could not read profile $profile: $!";
+ while (<PROFILE>) {
+ if (/^(\S+):\s+(.*)$/) {
+ $fieldname = $1;
+ # compatibility with the first implementation round;
+ # "Auth-Final" is now just called "Auth"
+ $fieldname =~ s/-Final$//;
+ if ($fieldname eq 'Conflicts') {
+ foreach my $elem (split(/, /, $2)) {
+ $profile{'Conflicts'}->{$elem} = 1;
+ }
+ } else {
+ $profile{$fieldname} = $2;
+ }
+ } else {
+ chomp;
+ s/^\s+//;
+ $profile{$fieldname} .= "\n$_";
+ $profile{$fieldname} =~ s/^[\n\s]+//;
+ }
+ }
+ close(PROFILE);
+ if (!defined($profile{'Session-Interactive-Only'})) {
+ $profile{'Session-noninteractive-Type'} = $profile{'Session-Type'};
+ $profile{'Session-noninteractive'} = $profile{'Session'};
+ $profile{'Session-noninteractive-Initial'} = $profile{'Session-Initial'};
+ }
+ return %profile;
+}
diff --git a/beagle/debian-rfs/usr/sbin/pam_getenv b/beagle/debian-rfs/usr/sbin/pam_getenv
new file mode 100755
index 0000000..2abddca
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/pam_getenv
@@ -0,0 +1,123 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+pam_getenv - get environment variables from /etc/environment
+
+=head1 SYNOPSIS
+
+pam_getenv B<[-l] [-s]> I<env_var>
+
+=head1 DESCRIPTION
+
+This tool will print out the value of I<env_var> from F</etc/environment>. It will attempt to expand environment variable references in the definition of I<env_var> but will fail if PAM items are expanded.
+
+The B<-l> option indicates the script should return an environment variable related to default locale information.
+
+The B<-s> option indicates that the script should return an
+system default environment variable.
+
+Currently neither the B<-l> or B<-s> options do anything. They are
+included because future versions of Debian may have a separate
+repository for the initial environment used by init scripts and for
+system locale information. These options will allow this script to be
+a stable interface even in that environment.
+
+=cut
+
+# Copyright 2004 by Sam Hartman
+# This script may be copied under the terms of the GNU GPL
+# version 2, or at your option any later version.
+
+use strict;
+use vars qw(*CONFIGFILE *ENVFILE);
+
+sub read_line($) {
+ my $fh = shift;
+ my $line;
+ local $_;
+ line: while (<$fh>) {
+ chomp;
+ s/^\s+//;
+s/\#.*$//;
+ next if $_ eq "";
+ if (s/\\\s*$//) {
+ $line .= $_;
+ next line;
+ }
+
+ $line .= $_;
+ last;
+ }
+ $line;
+
+}
+
+
+sub parse_line($) {
+ my $var;
+ my (%x, @x);
+ local $_ = shift;
+ return undef unless defined $_ and s/(\S+)\s//;
+ $var->{Name} = $1;
+ s/^\s*//;
+ @x = split(/=([^"\s]\S*|"[^"]*")\s*/, $_);
+ unless (scalar(@x)%2 == 0) {
+ push @x, undef;
+ }
+ %x = @x;
+ @{$var}{"Default", "Override"} =
+ @x{"DEFAULT", "OVERRIDE"};
+ $var;
+}
+
+sub expand_val($) {
+ my ($val) = @_;
+return undef unless $val;
+ die "Cannot handle PAM items\n" if /(?<!\\)\@/;
+ $val =~ s/(?<!\\)\${([^}]+)}/$ENV{$1}||""/eg;
+ return $val;
+}
+
+my $lookup;
+
+while ($_ = shift) {
+ next if $_ eq "-s";
+ next if $_ eq "-l";
+ $lookup = $_;
+ last;
+}
+unless (defined $lookup) {
+ die "Usage: pam_getenv [-l] [-s] env_var\n";
+}
+
+my %allvars;
+
+open (CONFIGFILE, "/etc/security/pam_env.conf")
+ or die "Cannot open environment file: $!\n";
+
+while (my $var = parse_line(read_line(\*CONFIGFILE))) {
+ my $val;
+ unless ($val = expand_val($var->{Override})) {
+ $val = expand_val($var->{Default});
+ }
+ $allvars{$var->{Name}} = $val;
+}
+
+if (open (ENVFILE, "/etc/environment")) {
+ while (my $line = read_line(\*ENVFILE)) {
+ $line =~ s/^export //;
+ $line =~ /(.*?)=(.+)/ or next;
+ my ($var, $val) = ($1, $2);
+ # This is bizarre logic (" and ' match each other, quotes are only
+ # significant at the start and end of the string, and the trailing quote
+ # may be omitted), but it's what pam_env does.
+ $val =~ s/^["'](.*?)["']?$/$1/;
+ $allvars{$var} = $val;
+ }
+}
+
+if (exists $allvars{$lookup}) {
+ print $allvars{$lookup}, "\n";
+ exit(0);
+}
diff --git a/beagle/debian-rfs/usr/sbin/pwck b/beagle/debian-rfs/usr/sbin/pwck
new file mode 100755
index 0000000..bd6b918
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/pwck
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/pwconv b/beagle/debian-rfs/usr/sbin/pwconv
new file mode 100755
index 0000000..abd3964
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/pwconv
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/pwunconv b/beagle/debian-rfs/usr/sbin/pwunconv
new file mode 100755
index 0000000..15d9163
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/pwunconv
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/ramsize b/beagle/debian-rfs/usr/sbin/ramsize
new file mode 120000
index 0000000..f9af812
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/ramsize
@@ -0,0 +1 @@
+rdev \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/rdev b/beagle/debian-rfs/usr/sbin/rdev
new file mode 100755
index 0000000..4b12bab
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/rdev
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/readprofile b/beagle/debian-rfs/usr/sbin/readprofile
new file mode 100755
index 0000000..51466f3
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/readprofile
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/remove-shell b/beagle/debian-rfs/usr/sbin/remove-shell
new file mode 100755
index 0000000..1e6b739
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/remove-shell
@@ -0,0 +1,40 @@
+#!/bin/sh -e
+
+if test $# -eq 0
+then
+ echo usage: $0 shellname '[shellname ...]' 1>&2
+ exit 1
+fi
+
+file=/etc/shells
+# I want this to be GUARANTEED to be on the same filesystem as $file
+tmpfile=${file}.tmp
+otmpfile=${file}.tmp2
+
+set -o noclobber
+
+trap "rm -f $tmpfile $otmpfile" EXIT
+
+if ! cat $file > $tmpfile
+then
+ cat 1>&2 <<EOF
+Either another instance of $0 is running, or it was previously interrupted.
+Please examine ${tmpfile} to see if it should be moved onto ${file}.
+EOF
+ exit 1
+fi
+
+# this is supposed to be reliable, not pretty
+for i
+do
+ grep -v "^${i}$" $tmpfile > $otmpfile || true
+ mv $otmpfile $tmpfile
+done
+
+chmod --reference=$file $tmpfile
+chown --reference=$file $tmpfile
+
+mv $tmpfile $file
+
+trap "" EXIT
+exit 0
diff --git a/beagle/debian-rfs/usr/sbin/rmt-tar b/beagle/debian-rfs/usr/sbin/rmt-tar
new file mode 100755
index 0000000..ec79931
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/rmt-tar
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/rootflags b/beagle/debian-rfs/usr/sbin/rootflags
new file mode 120000
index 0000000..f9af812
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/rootflags
@@ -0,0 +1 @@
+rdev \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/rtcwake b/beagle/debian-rfs/usr/sbin/rtcwake
new file mode 100755
index 0000000..ca25674
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/rtcwake
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/service b/beagle/debian-rfs/usr/sbin/service
new file mode 100755
index 0000000..752dfe2
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/service
@@ -0,0 +1,138 @@
+#!/bin/sh
+
+###########################################################################
+# /usr/bin/service
+#
+# A convenient wrapper for the /etc/init.d init scripts.
+#
+# This script is a modified version of the /sbin/service utility found on
+# Red Hat/Fedora systems (licensed GPLv2+).
+#
+# Copyright (C) 2006 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2008 Canonical Ltd.
+# * August 2008 - Dustin Kirkland <kirkland@canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# On Debian GNU/Linux systems, the complete text of the GNU General
+# Public License can be found in `/usr/share/common-licenses/GPL-2'.
+###########################################################################
+
+
+is_ignored_file() {
+ case "$1" in
+ skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+VERSION="`basename $0` ver. 0.91-ubuntu1"
+USAGE="Usage: `basename $0` < option > | --status-all | \
+[ service_name [ command | --full-restart ] ]"
+SERVICE=
+ACTION=
+SERVICEDIR="/etc/init.d"
+OPTIONS=
+
+if [ $# -eq 0 ]; then
+ echo "${USAGE}" >&2
+ exit 1
+fi
+
+cd /
+while [ $# -gt 0 ]; do
+ case "${1}" in
+ --help | -h | --h* )
+ echo "${USAGE}" >&2
+ exit 0
+ ;;
+ --version | -V )
+ echo "${VERSION}" >&2
+ exit 0
+ ;;
+ *)
+ if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
+ cd ${SERVICEDIR}
+ for SERVICE in * ; do
+ case "${SERVICE}" in
+ functions | halt | killall | single| linuxconf| kudzu)
+ ;;
+ *)
+ if ! is_ignored_file "${SERVICE}" \
+ && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ if ! grep -qs "\Wstatus)" "$SERVICE"; then
+ #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
+ echo " [ ? ] $SERVICE" 1>&2
+ continue
+ else
+ out=$(env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
+ if [ "$?" = "0" -a -n "$out" ]; then
+ #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
+ echo " [ + ] $SERVICE"
+ continue
+ else
+ #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
+ echo " [ - ] $SERVICE"
+ continue
+ fi
+ fi
+ #env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status
+ fi
+ ;;
+ esac
+ done
+ exit 0
+ elif [ $# -eq 2 -a "${2}" = "--full-restart" ]; then
+ SERVICE="${1}"
+ if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" stop
+ env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" start
+ exit $?
+ fi
+ elif [ -z "${SERVICE}" ]; then
+ SERVICE="${1}"
+ elif [ -z "${ACTION}" ]; then
+ ACTION="${1}"
+ else
+ OPTIONS="${OPTIONS} ${1}"
+ fi
+ shift
+ ;;
+ esac
+done
+
+if [ -r "/etc/init/${SERVICE}.conf" ]; then
+ # Upstart configuration exists for this job
+ case "${ACTION}" in
+ start|stop|restart|status|reload)
+ # Action is a valid upstart action
+ exec ${ACTION} ${SERVICE} ${OPTIONS}
+ ;;
+ force-reload)
+ # Upstart just uses reload for force-reload
+ exec reload ${SERVICE} ${OPTIONS}
+ ;;
+ esac
+fi
+
+# Otherwise, use the traditional sysvinit
+if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ exec env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${ACTION} ${OPTIONS}
+else
+ echo "${SERVICE}: unrecognized service" >&2
+ exit 1
+fi
diff --git a/beagle/debian-rfs/usr/sbin/tunelp b/beagle/debian-rfs/usr/sbin/tunelp
new file mode 100755
index 0000000..f27042e
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/tunelp
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/tzconfig b/beagle/debian-rfs/usr/sbin/tzconfig
new file mode 100755
index 0000000..73a53c0
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/tzconfig
@@ -0,0 +1,3 @@
+#!/bin/sh
+echo "WARNING: the tzconfig command is deprecated, please use:"
+echo " dpkg-reconfigure tzdata"
diff --git a/beagle/debian-rfs/usr/sbin/update-alternatives b/beagle/debian-rfs/usr/sbin/update-alternatives
new file mode 120000
index 0000000..499c0c0
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/update-alternatives
@@ -0,0 +1 @@
+../bin/update-alternatives \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/update-bootsystem-insserv b/beagle/debian-rfs/usr/sbin/update-bootsystem-insserv
new file mode 100755
index 0000000..5b20a17
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/update-bootsystem-insserv
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# Author: Petter Reinholdtsen
+# Date: 2009-08-04
+#
+# Transition script only to be used by sysv-rc version 2.87dsf-2 if
+# insserv is upgraded without sysv-rc being upgraded too.
+
+set -e
+
+case "$1" in
+ enable|'')
+ exit 0
+ ;;
+ check)
+ exit 1
+ ;;
+ *)
+ echo "error: Unknown argument '$1'"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/beagle/debian-rfs/usr/sbin/update-passwd b/beagle/debian-rfs/usr/sbin/update-passwd
new file mode 100755
index 0000000..917c2f1
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/update-passwd
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/update-rc.d b/beagle/debian-rfs/usr/sbin/update-rc.d
new file mode 100755
index 0000000..96bb41f
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/update-rc.d
@@ -0,0 +1,591 @@
+#! /usr/bin/perl
+#
+# update-rc.d Update the links in /etc/rc[0-9S].d/
+#
+
+use strict;
+use warnings;
+
+my $initd = "/etc/init.d";
+my $etcd = "/etc/rc";
+my $notreally = 0;
+
+# Save last action to this directory
+my $archive = "/var/lib/update-rc.d";
+
+# Print usage message and die.
+
+sub usage {
+ print STDERR "update-rc.d: error: @_\n" if ($#_ >= 0);
+ print STDERR <<EOF;
+usage: update-rc.d [-n] [-f] <basename> remove
+ update-rc.d [-n] <basename> defaults [NN | SS KK]
+ update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
+ update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
+ -n: not really
+ -f: force
+
+The disable|enable API is not stable and might change in the future.
+EOF
+ exit (1);
+}
+
+# Dependency based boot sequencing is the default, but upgraded
+# systems might keep the legacy ordering until the sysadm choose to
+# migrate to the new ordering method.
+if ( ! -f "/etc/init.d/.legacy-bootordering" ) {
+ info("using dependency based boot sequencing");
+ exit insserv_updatercd(@ARGV);
+}
+
+# Check out options.
+my $force;
+
+my @orig_argv = @ARGV;
+
+while($#ARGV >= 0 && ($_ = $ARGV[0]) =~ /^-/) {
+ shift @ARGV;
+ if (/^-n$/) { $notreally++; next }
+ if (/^-f$/) { $force++; next }
+ if (/^-h|--help$/) { &usage; }
+ &usage("unknown option");
+}
+
+sub save_last_action {
+ my ($script, @arguments) = @_;
+
+ return if $notreally;
+
+ open(FILE, ">", "$archive/${script}.new") || die "unable to write to $archive/${script}.new";
+ print FILE join(" ","update-rc.d",@arguments), "\n";
+ close(FILE);
+ rename "$archive/${script}.new", "$archive/${script}";
+}
+
+sub remove_last_action {
+ my ($script) = @_;
+ unlink "$archive/$script";
+}
+
+# Action.
+
+&usage() if ($#ARGV < 1);
+my $bn = shift @ARGV;
+
+unless ($bn =~ m/[a-zA-Z0-9+.-]+/) {
+ print STDERR "update-rc.d: illegal character in name '$bn'\n";
+ exit (1);
+}
+
+if ($ARGV[0] ne 'remove') {
+ if (! -f "$initd/$bn") {
+ print STDERR "update-rc.d: $initd/$bn: file does not exist\n";
+ exit (1);
+ }
+ &parse_lsb_header("$initd/$bn");
+ &cmp_args_with_defaults($bn, $ARGV[0], @ARGV);
+} elsif (-f "$initd/$bn") {
+ if (!$force) {
+ printf STDERR "update-rc.d: $initd/$bn exists during rc.d purge (use -f to force)\n";
+ exit (1);
+ }
+}
+
+my @startlinks;
+my @stoplinks;
+
+$_ = $ARGV[0];
+if (/^remove$/) { &checklinks ("remove"); remove_last_action($bn); }
+elsif (/^defaults$/) { &defaults (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+elsif (/^(start|stop)$/) { &startstop (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+elsif (/^(dis|en)able$/) { &toggle (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+else { &usage; }
+
+exit (0);
+
+sub info {
+ print STDOUT "update-rc.d: @_\n";
+}
+
+sub warning {
+ print STDERR "update-rc.d: warning: @_\n";
+}
+
+sub error {
+ print STDERR "update-rc.d: error: @_\n";
+ exit (1);
+}
+
+sub error_code {
+ my $rc = shift;
+ print STDERR "update-rc.d: error: @_\n";
+ exit ($rc);
+}
+
+# Check if there are links in /etc/rc[0-9S].d/
+# Remove if the first argument is "remove" and the links
+# point to $bn.
+
+sub is_link () {
+ my ($op, $fn, $bn) = @_;
+ if (! -l $fn) {
+ warning "$fn is not a symbolic link\n";
+ return 0;
+ } else {
+ my $linkdst = readlink ($fn);
+ if (! defined $linkdst) {
+ die ("update-rc.d: error reading symbolic link: $!\n");
+ }
+ if (($linkdst ne "../init.d/$bn") && ($linkdst ne "$initd/$bn")) {
+ warning "$fn is not a link to ../init.d/$bn or $initd/$bn\n";
+ return 0;
+ }
+ }
+ return 1;
+}
+
+sub checklinks {
+ my ($i, $found, $fn, $islnk);
+
+ print " Removing any system startup links for $initd/$bn ...\n"
+ if (defined $_[0] && $_[0] eq 'remove');
+
+ $found = 0;
+
+ foreach $i (0..9, 'S') {
+ unless (chdir ("$etcd$i.d")) {
+ next if ($i =~ m/^[789S]$/);
+ die("update-rc.d: chdir $etcd$i.d: $!\n");
+ }
+ opendir(DIR, ".");
+ my $saveBN=$bn;
+ $saveBN =~ s/\+/\\+/g;
+ foreach $_ (readdir(DIR)) {
+ next unless (/^[SK]\d\d$saveBN$/);
+ $fn = "$etcd$i.d/$_";
+ $found = 1;
+ $islnk = &is_link ($_[0], $fn, $bn);
+ next unless (defined $_[0] and $_[0] eq 'remove');
+ if (! $islnk) {
+ print " $fn is not a link to ../init.d/$bn; not removing\n";
+ next;
+ }
+ print " $etcd$i.d/$_\n";
+ next if ($notreally);
+ unlink ("$etcd$i.d/$_") ||
+ die("update-rc.d: unlink: $!\n");
+ }
+ closedir(DIR);
+ }
+ $found;
+}
+
+sub parse_lsb_header {
+ my $initdscript = shift;
+ my %lsbinfo;
+ my $lsbheaders = "Provides|Required-Start|Required-Stop|Default-Start|Default-Stop";
+ open(INIT, "<$initdscript") || die "error: unable to read $initdscript";
+ while (<INIT>) {
+ chomp;
+ $lsbinfo{'found'} = 1 if (m/^\#\#\# BEGIN INIT INFO\s*$/);
+ last if (m/\#\#\# END INIT INFO\s*$/);
+ if (m/^\# ($lsbheaders):\s*(\S?.*)$/i) {
+ $lsbinfo{lc($1)} = $2;
+ }
+ }
+ close(INIT);
+
+ # Check that all the required headers are present
+ if (!$lsbinfo{found}) {
+ printf STDERR "update-rc.d: warning: $initdscript missing LSB information\n";
+ printf STDERR "update-rc.d: see <http://wiki.debian.org/LSBInitScripts>\n";
+ } else {
+ for my $key (split(/\|/, lc($lsbheaders))) {
+ if (!exists $lsbinfo{$key}) {
+ warning "$initdscript missing LSB keyword '$key'\n";
+ }
+ }
+ }
+}
+
+
+# Process the arguments after the "enable" or "disable" keyword.
+
+sub toggle {
+ my @argv = @_;
+ my ($action, %lvls, @start, @stop, @xstartlinks);
+
+ if (!&checklinks) {
+ print " System start/stop links for $initd/$bn do not exist.\n";
+ exit (0);
+ }
+
+ $action = $argv[0];
+ if ($#argv > 1) {
+ while ($#argv > 0 && shift @argv) {
+ if ($argv[0] =~ /^[S2-5]$/) {
+ $lvls{$argv[0]}++;
+ } else {
+ &usage ("expected 'S' '2' '3' '4' or '5'");
+ }
+ }
+ } else {
+ $lvls{$_}++ for ('S', '2', '3', '4', '5');
+ }
+
+ push(@start, glob($etcd . '[2-5S].d/[KS][0-9][0-9]' . $bn));
+
+ foreach (@start) {
+ my $islink = &is_link (undef, $_, $bn);
+ next if !$islink;
+
+ next unless my ($lvl, $sk, $seq) = m/^$etcd([2-5S])\.d\/([SK])([0-9]{2})$bn$/;
+ $startlinks[$lvl] = $sk . $seq;
+
+ if ($action eq 'disable' and $sk eq 'S' and $lvls{$lvl}) {
+ $xstartlinks[$lvl] = 'K' . sprintf "%02d", (100 - $seq);
+ } elsif ($action eq 'enable' and $sk eq 'K' and $lvls{$lvl}) {
+ $xstartlinks[$lvl] = 'S' . sprintf "%02d", -($seq - 100);
+ } else {
+ $xstartlinks[$lvl] = $sk . $seq;
+ }
+ }
+
+ push(@stop, glob($etcd . '[016].d/[KS][0-9][0-9]' . $bn));
+
+ foreach (@stop) {
+ my $islink = &is_link (undef, $_, $bn);
+ next if !$islink;
+
+ next unless my ($lvl, $sk, $seq) = m/^$etcd([016])\.d\/([SK])([0-9]{2})$bn$/;
+ $stoplinks[$lvl] = $sk . $seq;
+ }
+
+ if ($action eq 'disable') {
+ print " Disabling system startup links for $initd/$bn ...\n";
+ } elsif ($action eq 'enable') {
+ print " Enabling system startup links for $initd/$bn ...\n";
+ }
+
+ &checklinks ("remove");
+ @startlinks = @xstartlinks;
+
+ 1;
+}
+
+# Process the arguments after the "defaults" keyword.
+
+sub defaults {
+ my @argv = @_;
+ my ($start, $stop) = (20, 20);
+
+ &usage ("defaults takes only one or two codenumbers") if ($#argv > 2);
+ $start = $stop = $argv[1] if ($#argv >= 1);
+ $stop = $argv[2] if ($#argv >= 2);
+ &usage ("codenumber must be a number between 0 and 99")
+ if ($start !~ /^\d\d?$/ || $stop !~ /^\d\d?$/);
+
+ $start = sprintf("%02d", $start);
+ $stop = sprintf("%02d", $stop);
+
+ $stoplinks[$_] = "K$stop" for (0, 1, 6);
+ $startlinks[$_] = "S$start" for (2, 3, 4, 5);
+
+ 1;
+}
+
+# Process the arguments after the start or stop keyword.
+
+sub startstop {
+ my @argv = @_;
+ my($letter, $NN, $level);
+
+ while ($#argv >= 0) {
+ if ($argv[0] eq 'start') { $letter = 'S'; }
+ elsif ($argv[0] eq 'stop') { $letter = 'K'; }
+ else {
+ &usage("expected start|stop");
+ }
+
+ if ($argv[1] !~ /^\d\d?$/) {
+ &usage("expected NN after $argv[0]");
+ }
+ $NN = sprintf("%02d", $argv[1]);
+
+ if ($argv[-1] ne '.') {
+ &usage("start|stop arguments not terminated by \".\"");
+ }
+
+ shift @argv; shift @argv;
+ $level = shift @argv;
+ do {
+ if ($level !~ m/^[0-9S]$/) {
+ &usage(
+ "expected runlevel [0-9S] (did you forget \".\" ?)");
+ }
+ if (! -d "$etcd$level.d") {
+ print STDERR
+ "update-rc.d: $etcd$level.d: no such directory\n";
+ exit(1);
+ }
+ $level = 99 if ($level eq 'S');
+ $startlinks[$level] = "$letter$NN" if ($letter eq 'S');
+ $stoplinks[$level] = "$letter$NN" if ($letter eq 'K');
+ } while (($level = shift @argv) ne '.');
+ }
+ 1;
+}
+
+# Create the links.
+
+sub makelinks {
+ my($t, $i);
+ my @links;
+
+ if (&checklinks) {
+ print " System start/stop links for $initd/$bn already exist.\n";
+ return 0;
+ }
+ print " Adding system startup for $initd/$bn ...\n";
+
+ # nice unreadable perl mess :)
+
+ for($t = 0; $t < 2; $t++) {
+ @links = $t ? @startlinks : @stoplinks;
+ for($i = 0; $i <= $#links; $i++) {
+ my $lvl = $i;
+ $lvl = 'S' if ($i == 99);
+ next if (!defined $links[$i] or $links[$i] eq '');
+ print " $etcd$lvl.d/$links[$i]$bn -> ../init.d/$bn\n";
+ next if ($notreally);
+ symlink("../init.d/$bn", "$etcd$lvl.d/$links[$i]$bn")
+ || die("update-rc.d: symlink: $!\n");
+ }
+ }
+
+ 1;
+}
+
+## Dependency based
+sub insserv_updatercd {
+ my @args = @_;
+ my @opts;
+ my $scriptname;
+ my $action;
+ my $notreally = 0;
+
+ my @orig_argv = @args;
+
+ while($#args >= 0 && ($_ = $args[0]) =~ /^-/) {
+ shift @args;
+ if (/^-n$/) { push(@opts, $_); $notreally++; next }
+ if (/^-f$/) { push(@opts, $_); next }
+ if (/^-h|--help$/) { &usage; }
+ usage("unknown option");
+ }
+
+ usage("not enough arguments") if ($#args < 1);
+
+ $scriptname = shift @args;
+ $action = shift @args;
+ if ("remove" eq $action) {
+ if ( -f "/etc/init.d/$scriptname" ) {
+ my $rc = system("insserv", @opts, "-r", $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ remove_last_action($scriptname);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ # insserv removes all dangling symlinks, no need to tell it
+ # what to look for.
+ my $rc = system("insserv", @opts) >> 8;
+ if (0 == $rc && !$notreally) {
+ remove_last_action($scriptname);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ }
+ } elsif ("defaults" eq $action || "start" eq $action ||
+ "stop" eq $action) {
+ # All start/stop/defaults arguments are discarded so emit a
+ # message if arguments have been given and are in conflict
+ # with Default-Start/Default-Stop values of LSB comment.
+ cmp_args_with_defaults($scriptname, $action, @args);
+
+ if ( -f "/etc/init.d/$scriptname" ) {
+ my $rc = system("insserv", @opts, $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ save_last_action($scriptname, @orig_argv);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ error("initscript does not exist: /etc/init.d/$scriptname");
+ }
+ } elsif ("disable" eq $action || "enable" eq $action) {
+ insserv_toggle($notreally, $action, $scriptname, @args);
+ # Call insserv to resequence modified links
+ my $rc = system("insserv", @opts, $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ save_last_action($scriptname, @orig_argv);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ usage();
+ }
+}
+
+sub parse_def_start_stop {
+ my $script = shift;
+ my (%lsb, @def_start_lvls, @def_stop_lvls);
+
+ open my $fh, '<', $script or error("unable to read $script");
+ while (<$fh>) {
+ chomp;
+ if (m/^### BEGIN INIT INFO$/) {
+ $lsb{'begin'}++;
+ }
+ elsif (m/^### END INIT INFO$/) {
+ $lsb{'end'}++;
+ last;
+ }
+ elsif ($lsb{'begin'} and not $lsb{'end'}) {
+ if (m/^# Default-Start:\s*(\S?.*)$/) {
+ @def_start_lvls = split(' ', $1);
+ }
+ if (m/^# Default-Stop:\s*(\S?.*)$/) {
+ @def_stop_lvls = split(' ', $1);
+ }
+ }
+ }
+ close($fh);
+
+ return (\@def_start_lvls, \@def_stop_lvls);
+}
+
+sub lsb_header_for_script {
+ my $name = shift;
+
+ foreach my $file ("/etc/insserv/overrides/$name", "/etc/init.d/$name",
+ "/usr/share/insserv/overrides/$name") {
+ return $file if -s $file;
+ }
+
+ error("cannot find a LSB script for $name");
+}
+
+sub cmp_args_with_defaults {
+ my ($name, $act) = (shift, shift);
+ my ($lsb_start_ref, $lsb_stop_ref, $arg_str, $lsb_str);
+ my (@arg_start_lvls, @arg_stop_lvls, @lsb_start_lvls, @lsb_stop_lvls);
+
+ ($lsb_start_ref, $lsb_stop_ref) = parse_def_start_stop("/etc/init.d/$name");
+ @lsb_start_lvls = @$lsb_start_ref;
+ @lsb_stop_lvls = @$lsb_stop_ref;
+ return if (!@lsb_start_lvls and !@lsb_stop_lvls);
+
+ if ($act eq 'defaults') {
+ @arg_start_lvls = (2, 3, 4, 5);
+ @arg_stop_lvls = (0, 1, 6);
+ } elsif ($act eq 'start' or $act eq 'stop') {
+ my $start = $act eq 'start' ? 1 : 0;
+ my $stop = $act eq 'stop' ? 1 : 0;
+
+ # The legacy part of this program passes arguments starting with
+ # "start|stop NN x y z ." but the insserv part gives argument list
+ # starting with sequence number (ie. strips off leading "start|stop")
+ # Start processing arguments immediately after the first seq number.
+ my $argi = $_[0] eq $act ? 2 : 1;
+
+ while (defined $_[$argi]) {
+ my $arg = $_[$argi];
+
+ # Runlevels 0 and 6 are always stop runlevels
+ if ($arg eq 0 or $arg eq 6) {
+ $start = 0; $stop = 1;
+ } elsif ($arg eq 'start') {
+ $start = 1; $stop = 0; $argi++; next;
+ } elsif ($arg eq 'stop') {
+ $start = 0; $stop = 1; $argi++; next;
+ } elsif ($arg eq '.') {
+ next;
+ }
+ push(@arg_start_lvls, $arg) if $start;
+ push(@arg_stop_lvls, $arg) if $stop;
+ } continue {
+ $argi++;
+ }
+ }
+
+ if ($#arg_start_lvls != $#lsb_start_lvls or
+ join("\0", sort @arg_start_lvls) ne join("\0", sort @lsb_start_lvls)) {
+ $arg_str = @arg_start_lvls ? "@arg_start_lvls" : "none";
+ $lsb_str = @lsb_start_lvls ? "@lsb_start_lvls" : "none";
+ warning "$name start runlevel arguments ($arg_str) do not match",
+ "LSB Default-Start values ($lsb_str)";
+ }
+ if ($#arg_stop_lvls != $#lsb_stop_lvls or
+ join("\0", sort @arg_stop_lvls) ne join("\0", sort @lsb_stop_lvls)) {
+ $arg_str = @arg_stop_lvls ? "@arg_stop_lvls" : "none";
+ $lsb_str = @lsb_stop_lvls ? "@lsb_stop_lvls" : "none";
+ warning "$name stop runlevel arguments ($arg_str) do not match",
+ "LSB Default-Stop values ($lsb_str)";
+ }
+}
+
+sub insserv_toggle {
+ my ($dryrun, $act, $name) = (shift, shift, shift);
+ my (@toggle_lvls, $start_lvls, $stop_lvls, @symlinks);
+ my $lsb_header = lsb_header_for_script($name);
+
+ # Extra arguments to disable|enable action are runlevels. If none
+ # given parse LSB info for Default-Start value.
+ if ($#_ >= 0) {
+ @toggle_lvls = @_;
+ } else {
+ ($start_lvls, $stop_lvls) = parse_def_start_stop($lsb_header);
+ @toggle_lvls = @$start_lvls;
+ if ($#toggle_lvls < 0) {
+ error("$name Default-Start contains no runlevels, aborting.");
+ }
+ }
+
+ # Find symlinks in rc.d directories. Refuse to modify links in runlevels
+ # not used for normal system start sequence.
+ for my $lvl (@toggle_lvls) {
+ if ($lvl !~ /^[S2345]$/) {
+ warning("$act action will have no effect on runlevel $lvl");
+ next;
+ }
+ push(@symlinks, $_) for glob("/etc/rc$lvl.d/[SK][0-9][0-9]$name");
+ }
+
+ if (!@symlinks) {
+ error("no runlevel symlinks to modify, aborting!");
+ }
+
+ # Toggle S/K bit of script symlink.
+ for my $cur_lnk (@symlinks) {
+ my $sk;
+ my @new_lnk = split(//, $cur_lnk);
+
+ if ("disable" eq $act) {
+ $sk = rindex($cur_lnk, '/S') + 1;
+ next if $sk < 1;
+ $new_lnk[$sk] = 'K';
+ } else {
+ $sk = rindex($cur_lnk, '/K') + 1;
+ next if $sk < 1;
+ $new_lnk[$sk] = 'S';
+ }
+
+ if ($dryrun) {
+ printf("rename(%s, %s)\n", $cur_lnk, join('', @new_lnk));
+ next;
+ }
+
+ rename($cur_lnk, join('', @new_lnk)) or error($!);
+ }
+}
diff --git a/beagle/debian-rfs/usr/sbin/update-rc.d-insserv b/beagle/debian-rfs/usr/sbin/update-rc.d-insserv
new file mode 100755
index 0000000..1853251
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/update-rc.d-insserv
@@ -0,0 +1,593 @@
+#! /usr/bin/perl
+#
+# update-rc.d Update the links in /etc/rc[0-9S].d/
+#
+
+use strict;
+use warnings;
+
+my $initd = "/etc/init.d";
+my $etcd = "/etc/rc";
+my $notreally = 0;
+
+# Save last action to this directory
+my $archive = "/var/lib/update-rc.d";
+
+# Print usage message and die.
+
+sub usage {
+ print STDERR "update-rc.d: error: @_\n" if ($#_ >= 0);
+ print STDERR <<EOF;
+usage: update-rc.d [-n] [-f] <basename> remove
+ update-rc.d [-n] <basename> defaults [NN | SS KK]
+ update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
+ update-rc.d [-n] <basename> disable|enable [S|2|3|4|5]
+ -n: not really
+ -f: force
+
+The disable|enable API is not stable and might change in the future.
+EOF
+ exit (1);
+}
+
+# Dependency based boot sequencing is the default, but upgraded
+# systems might keep the legacy ordering until the sysadm choose to
+# migrate to the new ordering method. sysv-rc version 2.87dsf-2 will
+# remove /var/lib/insserv/using-insserv and this divert, thus transfering
+# the responsibility for dependency based update-rc.d to sysv-rc.
+if ( -f "/var/lib/insserv/using-insserv" && ! -f "/etc/init.d/.legacy-bootordering" ) {
+ info("using dependency based boot sequencing");
+ exit insserv_updatercd(@ARGV);
+}
+
+# Check out options.
+my $force;
+
+my @orig_argv = @ARGV;
+
+while($#ARGV >= 0 && ($_ = $ARGV[0]) =~ /^-/) {
+ shift @ARGV;
+ if (/^-n$/) { $notreally++; next }
+ if (/^-f$/) { $force++; next }
+ if (/^-h|--help$/) { &usage; }
+ &usage("unknown option");
+}
+
+sub save_last_action {
+ my ($script, @arguments) = @_;
+
+ return if $notreally;
+
+ open(FILE, ">", "$archive/${script}.new") || die "unable to write to $archive/${script}.new";
+ print FILE join(" ","update-rc.d",@arguments), "\n";
+ close(FILE);
+ rename "$archive/${script}.new", "$archive/${script}";
+}
+
+sub remove_last_action {
+ my ($script) = @_;
+ unlink "$archive/$script";
+}
+
+# Action.
+
+&usage() if ($#ARGV < 1);
+my $bn = shift @ARGV;
+
+unless ($bn =~ m/[a-zA-Z0-9+.-]+/) {
+ print STDERR "update-rc.d: illegal character in name '$bn'\n";
+ exit (1);
+}
+
+if ($ARGV[0] ne 'remove') {
+ if (! -f "$initd/$bn") {
+ print STDERR "update-rc.d: $initd/$bn: file does not exist\n";
+ exit (1);
+ }
+ &parse_lsb_header("$initd/$bn");
+ &cmp_args_with_defaults($bn, $ARGV[0], @ARGV);
+} elsif (-f "$initd/$bn") {
+ if (!$force) {
+ printf STDERR "update-rc.d: $initd/$bn exists during rc.d purge (use -f to force)\n";
+ exit (1);
+ }
+}
+
+my @startlinks;
+my @stoplinks;
+
+$_ = $ARGV[0];
+if (/^remove$/) { &checklinks ("remove"); remove_last_action($bn); }
+elsif (/^defaults$/) { &defaults (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+elsif (/^(start|stop)$/) { &startstop (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+elsif (/^(dis|en)able$/) { &toggle (@ARGV); &makelinks; save_last_action($bn, @orig_argv); }
+else { &usage; }
+
+exit (0);
+
+sub info {
+ print STDOUT "update-rc.d: @_\n";
+}
+
+sub warning {
+ print STDERR "update-rc.d: warning: @_\n";
+}
+
+sub error {
+ print STDERR "update-rc.d: error: @_\n";
+ exit (1);
+}
+
+sub error_code {
+ my $rc = shift;
+ print STDERR "update-rc.d: error: @_\n";
+ exit ($rc);
+}
+
+# Check if there are links in /etc/rc[0-9S].d/
+# Remove if the first argument is "remove" and the links
+# point to $bn.
+
+sub is_link () {
+ my ($op, $fn, $bn) = @_;
+ if (! -l $fn) {
+ warning "$fn is not a symbolic link\n";
+ return 0;
+ } else {
+ my $linkdst = readlink ($fn);
+ if (! defined $linkdst) {
+ die ("update-rc.d: error reading symbolic link: $!\n");
+ }
+ if (($linkdst ne "../init.d/$bn") && ($linkdst ne "$initd/$bn")) {
+ warning "$fn is not a link to ../init.d/$bn or $initd/$bn\n";
+ return 0;
+ }
+ }
+ return 1;
+}
+
+sub checklinks {
+ my ($i, $found, $fn, $islnk);
+
+ print " Removing any system startup links for $initd/$bn ...\n"
+ if (defined $_[0] && $_[0] eq 'remove');
+
+ $found = 0;
+
+ foreach $i (0..9, 'S') {
+ unless (chdir ("$etcd$i.d")) {
+ next if ($i =~ m/^[789S]$/);
+ die("update-rc.d: chdir $etcd$i.d: $!\n");
+ }
+ opendir(DIR, ".");
+ my $saveBN=$bn;
+ $saveBN =~ s/\+/\\+/g;
+ foreach $_ (readdir(DIR)) {
+ next unless (/^[SK]\d\d$saveBN$/);
+ $fn = "$etcd$i.d/$_";
+ $found = 1;
+ $islnk = &is_link ($_[0], $fn, $bn);
+ next unless (defined $_[0] and $_[0] eq 'remove');
+ if (! $islnk) {
+ print " $fn is not a link to ../init.d/$bn; not removing\n";
+ next;
+ }
+ print " $etcd$i.d/$_\n";
+ next if ($notreally);
+ unlink ("$etcd$i.d/$_") ||
+ die("update-rc.d: unlink: $!\n");
+ }
+ closedir(DIR);
+ }
+ $found;
+}
+
+sub parse_lsb_header {
+ my $initdscript = shift;
+ my %lsbinfo;
+ my $lsbheaders = "Provides|Required-Start|Required-Stop|Default-Start|Default-Stop";
+ open(INIT, "<$initdscript") || die "error: unable to read $initdscript";
+ while (<INIT>) {
+ chomp;
+ $lsbinfo{'found'} = 1 if (m/^\#\#\# BEGIN INIT INFO\s*$/);
+ last if (m/\#\#\# END INIT INFO\s*$/);
+ if (m/^\# ($lsbheaders):\s*(\S?.*)$/i) {
+ $lsbinfo{lc($1)} = $2;
+ }
+ }
+ close(INIT);
+
+ # Check that all the required headers are present
+ if (!$lsbinfo{found}) {
+ printf STDERR "update-rc.d: warning: $initdscript missing LSB information\n";
+ printf STDERR "update-rc.d: see <http://wiki.debian.org/LSBInitScripts>\n";
+ } else {
+ for my $key (split(/\|/, lc($lsbheaders))) {
+ if (!exists $lsbinfo{$key}) {
+ warning "$initdscript missing LSB keyword '$key'\n";
+ }
+ }
+ }
+}
+
+
+# Process the arguments after the "enable" or "disable" keyword.
+
+sub toggle {
+ my @argv = @_;
+ my ($action, %lvls, @start, @stop, @xstartlinks);
+
+ if (!&checklinks) {
+ print " System start/stop links for $initd/$bn do not exist.\n";
+ exit (0);
+ }
+
+ $action = $argv[0];
+ if ($#argv > 1) {
+ while ($#argv > 0 && shift @argv) {
+ if ($argv[0] =~ /^[S2-5]$/) {
+ $lvls{$argv[0]}++;
+ } else {
+ &usage ("expected 'S' '2' '3' '4' or '5'");
+ }
+ }
+ } else {
+ $lvls{$_}++ for ('S', '2', '3', '4', '5');
+ }
+
+ push(@start, glob($etcd . '[2-5S].d/[KS][0-9][0-9]' . $bn));
+
+ foreach (@start) {
+ my $islink = &is_link (undef, $_, $bn);
+ next if !$islink;
+
+ next unless my ($lvl, $sk, $seq) = m/^$etcd([2-5S])\.d\/([SK])([0-9]{2})$bn$/;
+ $startlinks[$lvl] = $sk . $seq;
+
+ if ($action eq 'disable' and $sk eq 'S' and $lvls{$lvl}) {
+ $xstartlinks[$lvl] = 'K' . sprintf "%02d", (100 - $seq);
+ } elsif ($action eq 'enable' and $sk eq 'K' and $lvls{$lvl}) {
+ $xstartlinks[$lvl] = 'S' . sprintf "%02d", -($seq - 100);
+ } else {
+ $xstartlinks[$lvl] = $sk . $seq;
+ }
+ }
+
+ push(@stop, glob($etcd . '[016].d/[KS][0-9][0-9]' . $bn));
+
+ foreach (@stop) {
+ my $islink = &is_link (undef, $_, $bn);
+ next if !$islink;
+
+ next unless my ($lvl, $sk, $seq) = m/^$etcd([016])\.d\/([SK])([0-9]{2})$bn$/;
+ $stoplinks[$lvl] = $sk . $seq;
+ }
+
+ if ($action eq 'disable') {
+ print " Disabling system startup links for $initd/$bn ...\n";
+ } elsif ($action eq 'enable') {
+ print " Enabling system startup links for $initd/$bn ...\n";
+ }
+
+ &checklinks ("remove");
+ @startlinks = @xstartlinks;
+
+ 1;
+}
+
+# Process the arguments after the "defaults" keyword.
+
+sub defaults {
+ my @argv = @_;
+ my ($start, $stop) = (20, 20);
+
+ &usage ("defaults takes only one or two codenumbers") if ($#argv > 2);
+ $start = $stop = $argv[1] if ($#argv >= 1);
+ $stop = $argv[2] if ($#argv >= 2);
+ &usage ("codenumber must be a number between 0 and 99")
+ if ($start !~ /^\d\d?$/ || $stop !~ /^\d\d?$/);
+
+ $start = sprintf("%02d", $start);
+ $stop = sprintf("%02d", $stop);
+
+ $stoplinks[$_] = "K$stop" for (0, 1, 6);
+ $startlinks[$_] = "S$start" for (2, 3, 4, 5);
+
+ 1;
+}
+
+# Process the arguments after the start or stop keyword.
+
+sub startstop {
+ my @argv = @_;
+ my($letter, $NN, $level);
+
+ while ($#argv >= 0) {
+ if ($argv[0] eq 'start') { $letter = 'S'; }
+ elsif ($argv[0] eq 'stop') { $letter = 'K'; }
+ else {
+ &usage("expected start|stop");
+ }
+
+ if ($argv[1] !~ /^\d\d?$/) {
+ &usage("expected NN after $argv[0]");
+ }
+ $NN = sprintf("%02d", $argv[1]);
+
+ if ($argv[-1] ne '.') {
+ &usage("start|stop arguments not terminated by \".\"");
+ }
+
+ shift @argv; shift @argv;
+ $level = shift @argv;
+ do {
+ if ($level !~ m/^[0-9S]$/) {
+ &usage(
+ "expected runlevel [0-9S] (did you forget \".\" ?)");
+ }
+ if (! -d "$etcd$level.d") {
+ print STDERR
+ "update-rc.d: $etcd$level.d: no such directory\n";
+ exit(1);
+ }
+ $level = 99 if ($level eq 'S');
+ $startlinks[$level] = "$letter$NN" if ($letter eq 'S');
+ $stoplinks[$level] = "$letter$NN" if ($letter eq 'K');
+ } while (($level = shift @argv) ne '.');
+ }
+ 1;
+}
+
+# Create the links.
+
+sub makelinks {
+ my($t, $i);
+ my @links;
+
+ if (&checklinks) {
+ print " System start/stop links for $initd/$bn already exist.\n";
+ return 0;
+ }
+ print " Adding system startup for $initd/$bn ...\n";
+
+ # nice unreadable perl mess :)
+
+ for($t = 0; $t < 2; $t++) {
+ @links = $t ? @startlinks : @stoplinks;
+ for($i = 0; $i <= $#links; $i++) {
+ my $lvl = $i;
+ $lvl = 'S' if ($i == 99);
+ next if (!defined $links[$i] or $links[$i] eq '');
+ print " $etcd$lvl.d/$links[$i]$bn -> ../init.d/$bn\n";
+ next if ($notreally);
+ symlink("../init.d/$bn", "$etcd$lvl.d/$links[$i]$bn")
+ || die("update-rc.d: symlink: $!\n");
+ }
+ }
+
+ 1;
+}
+
+## Dependency based
+sub insserv_updatercd {
+ my @args = @_;
+ my @opts;
+ my $scriptname;
+ my $action;
+ my $notreally = 0;
+
+ my @orig_argv = @args;
+
+ while($#args >= 0 && ($_ = $args[0]) =~ /^-/) {
+ shift @args;
+ if (/^-n$/) { push(@opts, $_); $notreally++; next }
+ if (/^-f$/) { push(@opts, $_); next }
+ if (/^-h|--help$/) { &usage; }
+ usage("unknown option");
+ }
+
+ usage("not enough arguments") if ($#args < 1);
+
+ $scriptname = shift @args;
+ $action = shift @args;
+ if ("remove" eq $action) {
+ if ( -f "/etc/init.d/$scriptname" ) {
+ my $rc = system("insserv", @opts, "-r", $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ remove_last_action($scriptname);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ # insserv removes all dangling symlinks, no need to tell it
+ # what to look for.
+ my $rc = system("insserv", @opts) >> 8;
+ if (0 == $rc && !$notreally) {
+ remove_last_action($scriptname);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ }
+ } elsif ("defaults" eq $action || "start" eq $action ||
+ "stop" eq $action) {
+ # All start/stop/defaults arguments are discarded so emit a
+ # message if arguments have been given and are in conflict
+ # with Default-Start/Default-Stop values of LSB comment.
+ cmp_args_with_defaults($scriptname, $action, @args);
+
+ if ( -f "/etc/init.d/$scriptname" ) {
+ my $rc = system("insserv", @opts, $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ save_last_action($scriptname, @orig_argv);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ error("initscript does not exist: /etc/init.d/$scriptname");
+ }
+ } elsif ("disable" eq $action || "enable" eq $action) {
+ insserv_toggle($notreally, $action, $scriptname, @args);
+ # Call insserv to resequence modified links
+ my $rc = system("insserv", @opts, $scriptname) >> 8;
+ if (0 == $rc && !$notreally) {
+ save_last_action($scriptname, @orig_argv);
+ }
+ error_code($rc, "insserv rejected the script header") if $rc;
+ exit $rc;
+ } else {
+ usage();
+ }
+}
+
+sub parse_def_start_stop {
+ my $script = shift;
+ my (%lsb, @def_start_lvls, @def_stop_lvls);
+
+ open my $fh, '<', $script or error("unable to read $script");
+ while (<$fh>) {
+ chomp;
+ if (m/^### BEGIN INIT INFO$/) {
+ $lsb{'begin'}++;
+ }
+ elsif (m/^### END INIT INFO$/) {
+ $lsb{'end'}++;
+ last;
+ }
+ elsif ($lsb{'begin'} and not $lsb{'end'}) {
+ if (m/^# Default-Start:\s*(\S?.*)$/) {
+ @def_start_lvls = split(' ', $1);
+ }
+ if (m/^# Default-Stop:\s*(\S?.*)$/) {
+ @def_stop_lvls = split(' ', $1);
+ }
+ }
+ }
+ close($fh);
+
+ return (\@def_start_lvls, \@def_stop_lvls);
+}
+
+sub lsb_header_for_script {
+ my $name = shift;
+
+ foreach my $file ("/etc/insserv/overrides/$name", "/etc/init.d/$name",
+ "/usr/share/insserv/overrides/$name") {
+ return $file if -s $file;
+ }
+
+ error("cannot find a LSB script for $name");
+}
+
+sub cmp_args_with_defaults {
+ my ($name, $act) = (shift, shift);
+ my ($lsb_start_ref, $lsb_stop_ref, $arg_str, $lsb_str);
+ my (@arg_start_lvls, @arg_stop_lvls, @lsb_start_lvls, @lsb_stop_lvls);
+
+ ($lsb_start_ref, $lsb_stop_ref) = parse_def_start_stop("/etc/init.d/$name");
+ @lsb_start_lvls = @$lsb_start_ref;
+ @lsb_stop_lvls = @$lsb_stop_ref;
+ return if (!@lsb_start_lvls and !@lsb_stop_lvls);
+
+ if ($act eq 'defaults') {
+ @arg_start_lvls = (2, 3, 4, 5);
+ @arg_stop_lvls = (0, 1, 6);
+ } elsif ($act eq 'start' or $act eq 'stop') {
+ my $start = $act eq 'start' ? 1 : 0;
+ my $stop = $act eq 'stop' ? 1 : 0;
+
+ # The legacy part of this program passes arguments starting with
+ # "start|stop NN x y z ." but the insserv part gives argument list
+ # starting with sequence number (ie. strips off leading "start|stop")
+ # Start processing arguments immediately after the first seq number.
+ my $argi = $_[0] eq $act ? 2 : 1;
+
+ while (defined $_[$argi]) {
+ my $arg = $_[$argi];
+
+ # Runlevels 0 and 6 are always stop runlevels
+ if ($arg eq 0 or $arg eq 6) {
+ $start = 0; $stop = 1;
+ } elsif ($arg eq 'start') {
+ $start = 1; $stop = 0; $argi++; next;
+ } elsif ($arg eq 'stop') {
+ $start = 0; $stop = 1; $argi++; next;
+ } elsif ($arg eq '.') {
+ next;
+ }
+ push(@arg_start_lvls, $arg) if $start;
+ push(@arg_stop_lvls, $arg) if $stop;
+ } continue {
+ $argi++;
+ }
+ }
+
+ if ($#arg_start_lvls != $#lsb_start_lvls or
+ join("\0", sort @arg_start_lvls) ne join("\0", sort @lsb_start_lvls)) {
+ $arg_str = @arg_start_lvls ? "@arg_start_lvls" : "none";
+ $lsb_str = @lsb_start_lvls ? "@lsb_start_lvls" : "none";
+ warning "$name start runlevel arguments ($arg_str) do not match",
+ "LSB Default-Start values ($lsb_str)";
+ }
+ if ($#arg_stop_lvls != $#lsb_stop_lvls or
+ join("\0", sort @arg_stop_lvls) ne join("\0", sort @lsb_stop_lvls)) {
+ $arg_str = @arg_stop_lvls ? "@arg_stop_lvls" : "none";
+ $lsb_str = @lsb_stop_lvls ? "@lsb_stop_lvls" : "none";
+ warning "$name stop runlevel arguments ($arg_str) do not match",
+ "LSB Default-Stop values ($lsb_str)";
+ }
+}
+
+sub insserv_toggle {
+ my ($dryrun, $act, $name) = (shift, shift, shift);
+ my (@toggle_lvls, $start_lvls, $stop_lvls, @symlinks);
+ my $lsb_header = lsb_header_for_script($name);
+
+ # Extra arguments to disable|enable action are runlevels. If none
+ # given parse LSB info for Default-Start value.
+ if ($#_ >= 0) {
+ @toggle_lvls = @_;
+ } else {
+ ($start_lvls, $stop_lvls) = parse_def_start_stop($lsb_header);
+ @toggle_lvls = @$start_lvls;
+ if ($#toggle_lvls < 0) {
+ error("$name Default-Start contains no runlevels, aborting.");
+ }
+ }
+
+ # Find symlinks in rc.d directories. Refuse to modify links in runlevels
+ # not used for normal system start sequence.
+ for my $lvl (@toggle_lvls) {
+ if ($lvl !~ /^[S2345]$/) {
+ warning("$act action will have no effect on runlevel $lvl");
+ next;
+ }
+ push(@symlinks, $_) for glob("/etc/rc$lvl.d/[SK][0-9][0-9]$name");
+ }
+
+ if (!@symlinks) {
+ error("no runlevel symlinks to modify, aborting!");
+ }
+
+ # Toggle S/K bit of script symlink.
+ for my $cur_lnk (@symlinks) {
+ my $sk;
+ my @new_lnk = split(//, $cur_lnk);
+
+ if ("disable" eq $act) {
+ $sk = rindex($cur_lnk, '/S') + 1;
+ next if $sk < 1;
+ $new_lnk[$sk] = 'K';
+ } else {
+ $sk = rindex($cur_lnk, '/K') + 1;
+ next if $sk < 1;
+ $new_lnk[$sk] = 'S';
+ }
+
+ if ($dryrun) {
+ printf("rename(%s, %s)\n", $cur_lnk, join('', @new_lnk));
+ next;
+ }
+
+ rename($cur_lnk, join('', @new_lnk)) or error($!);
+ }
+}
diff --git a/beagle/debian-rfs/usr/sbin/useradd b/beagle/debian-rfs/usr/sbin/useradd
new file mode 100755
index 0000000..6da55fb
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/useradd
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/userdel b/beagle/debian-rfs/usr/sbin/userdel
new file mode 100755
index 0000000..e41f7a1
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/userdel
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/usermod b/beagle/debian-rfs/usr/sbin/usermod
new file mode 100755
index 0000000..beda563
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/usermod
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/vidmode b/beagle/debian-rfs/usr/sbin/vidmode
new file mode 120000
index 0000000..f9af812
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/vidmode
@@ -0,0 +1 @@
+rdev \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/vigr b/beagle/debian-rfs/usr/sbin/vigr
new file mode 120000
index 0000000..95923b0
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/vigr
@@ -0,0 +1 @@
+vipw \ No newline at end of file
diff --git a/beagle/debian-rfs/usr/sbin/vipw b/beagle/debian-rfs/usr/sbin/vipw
new file mode 100755
index 0000000..7e043f9
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/vipw
Binary files differ
diff --git a/beagle/debian-rfs/usr/sbin/zic b/beagle/debian-rfs/usr/sbin/zic
new file mode 100755
index 0000000..f742b95
--- /dev/null
+++ b/beagle/debian-rfs/usr/sbin/zic
Binary files differ