mirror of
https://git.proxmox.com/git/dab
synced 2025-10-04 00:16:04 +00:00
initial import from internal svn repository
This commit is contained in:
commit
8ab34b8799
65
Makefile
Normal file
65
Makefile
Normal file
@ -0,0 +1,65 @@
|
||||
VERSION=1.1
|
||||
PACKAGE=dab
|
||||
PKGREL=15
|
||||
|
||||
|
||||
SCRIPTS= \
|
||||
scripts/init.pl \
|
||||
scripts/defenv \
|
||||
scripts/mysql_randompw \
|
||||
scripts/init_urandom \
|
||||
scripts/ssh_gen_host_keys
|
||||
|
||||
DEB=${PACKAGE}_${VERSION}-${PKGREL}_all.deb
|
||||
|
||||
DESTDIR=
|
||||
PREFIX=/usr
|
||||
DATADIR=${PREFIX}/lib/${PACKAGE}
|
||||
SBINDIR=${PREFIX}/sbin
|
||||
MANDIR=${PREFIX}/share/man
|
||||
DOCDIR=${PREFIX}/share/doc/${PACKAGE}
|
||||
MAN1DIR=${MANDIR}/man1/
|
||||
PERLDIR=${PREFIX}/share/perl5/
|
||||
|
||||
all: ${DEB}
|
||||
|
||||
.PHONY: install
|
||||
install: dab dab.1 DAB.pm devices.tar.gz ${SCRIPTS}
|
||||
install -d ${DESTDIR}${SBINDIR}
|
||||
install -m 0755 dab ${DESTDIR}${SBINDIR}
|
||||
install -d ${DESTDIR}${MAN1DIR}
|
||||
install -m 0644 dab.1 ${DESTDIR}${MAN1DIR}
|
||||
gzip -f9 ${DESTDIR}${MAN1DIR}/dab.1
|
||||
install -D -m 0644 DAB.pm ${DESTDIR}${PERLDIR}/PVE/DAB.pm
|
||||
install -d ${DESTDIR}${DATADIR}/scripts
|
||||
install -m 0755 ${SCRIPTS} ${DESTDIR}${DATADIR}/scripts
|
||||
install -m 0644 devices.tar.gz ${DESTDIR}${DATADIR}
|
||||
|
||||
.PHONY: deb
|
||||
deb ${DEB}: dab dab.1 DAB.pm control changelog.Debian
|
||||
rm -rf debian
|
||||
mkdir debian
|
||||
make DESTDIR=debian install
|
||||
install -d -m 0755 debian/DEBIAN
|
||||
sed -e s/@@VERSION@@/${VERSION}/ -e s/@@PKGRELEASE@@/${PKGREL}/ <control >debian/DEBIAN/control
|
||||
install -D -m 0644 copyright debian/${DOCDIR}/copyright
|
||||
install -m 0644 changelog.Debian debian/${DOCDIR}
|
||||
gzip -9 debian/${DOCDIR}/changelog.Debian
|
||||
dpkg-deb --build debian
|
||||
mv debian.deb ${DEB}
|
||||
rm -rf debian
|
||||
lintian ${DEB}
|
||||
|
||||
|
||||
dab.pdf: dab.1
|
||||
groff -man dab.1 |ps2pdf - > dab.pdf
|
||||
|
||||
dab.1: dab
|
||||
rm -f dab.1
|
||||
pod2man -n $< -s 1 -r ${VERSION} <$< >$@
|
||||
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f ${DEB} dab.1 dab.pdf *~
|
||||
|
114
changelog.Debian
Normal file
114
changelog.Debian
Normal file
@ -0,0 +1,114 @@
|
||||
dab (1.1-15) unstable; urgency=low
|
||||
|
||||
* fix typo in scripts/mysql_randompw
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 15 Aug 2011 05:56:52 +0200
|
||||
|
||||
dab (1.1-14) unstable; urgency=low
|
||||
|
||||
* include SUITE-updates for squeeze
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 09 May 2011 10:57:08 +0200
|
||||
|
||||
dab (1.1-13) unstable; urgency=low
|
||||
|
||||
* use insserv instead of update-rc.d (for newer versions)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 06 May 2011 06:59:25 +0200
|
||||
|
||||
dab (1.1-12) unstable; urgency=low
|
||||
|
||||
* use UPASSWD instead of PASSWD inside shell scripts (avoid problems
|
||||
with new 'dash')
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 03 Mar 2011 06:41:31 +0100
|
||||
|
||||
dab (1.1-11) unstable; urgency=low
|
||||
|
||||
* use HNAME instead of HOSTNAME inside shell scripts (avoid problems
|
||||
with new 'dash')
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Wed, 02 Mar 2011 07:00:47 +0100
|
||||
|
||||
dab (1.1-10) unstable; urgency=low
|
||||
|
||||
* use '=' instead of '==' to compare strings in shell scripts
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 16 Dec 2010 06:37:54 +0100
|
||||
|
||||
dab (1.1-9) unstable; urgency=low
|
||||
|
||||
* correct update-rc.d invocation (add '.' after runlevel)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 04 Oct 2010 09:27:36 +0200
|
||||
|
||||
dab (1.1-8) unstable; urgency=low
|
||||
|
||||
* fix postgres startup script for squeeze
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 09 Sep 2010 11:19:27 +0200
|
||||
|
||||
dab (1.1-7) unstable; urgency=low
|
||||
|
||||
* support dependency based startup (squeeze)
|
||||
|
||||
* use postgresql 8.4 for squeeze
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 09 Sep 2010 10:37:10 +0200
|
||||
|
||||
dab (1.1-6) unstable; urgency=low
|
||||
|
||||
* use mysql-server-5.1 for squeezs
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Thu, 19 Aug 2010 08:32:57 +0200
|
||||
|
||||
dab (1.1-5) unstable; urgency=low
|
||||
|
||||
* bug fix: only print a warning for packages installed directly with
|
||||
'dpkg' (when there is no information in 'available' list)
|
||||
|
||||
* only mount /proc/ if not already mounted (avoid problems with vzctl
|
||||
3.0.24)
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Mon, 09 Aug 2010 10:18:28 +0200
|
||||
|
||||
dab (1.1-4) unstable; urgency=low
|
||||
|
||||
* add support for debian squeeze (debian 6.0)
|
||||
|
||||
* ve_exec - query return status
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 12 Jan 2010 12:22:33 +0100
|
||||
|
||||
dab (1.1-3) unstable; urgency=low
|
||||
|
||||
* support intrepid and jaunty (patch from Sebastiaan Blommers)
|
||||
|
||||
* apache NO_START is only used by etch
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Tue, 19 May 2009 10:30:54 +0200
|
||||
|
||||
dab (1.1-2) unstable; urgency=low
|
||||
|
||||
* DAB.pm (finalize): remove aquota.group and aquota.user
|
||||
|
||||
* ignore non-existent Release[.gpg] files
|
||||
|
||||
* __record_provides(): correct skipself implementation
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 23 Jan 2009 15:22:02 +0100
|
||||
|
||||
dab (1.1-1) unstable; urgency=low
|
||||
|
||||
* first public release
|
||||
|
||||
* new manual page
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 16 Jan 2009 11:42:51 +0100
|
||||
|
||||
dab (1.0-1) unstable; urgency=low
|
||||
|
||||
* first package build
|
||||
|
||||
-- Proxmox Support Team <support@proxmox.com> Fri, 28 Nov 2008 10:46:34 +0100
|
||||
|
10
control
Normal file
10
control
Normal file
@ -0,0 +1,10 @@
|
||||
Package: dab
|
||||
Version: @@VERSION@@-@@PKGRELEASE@@
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Architecture: all
|
||||
Depends: perl (>= 5.6.0-16), wget, make, binutils, vzctl
|
||||
Maintainer: Proxmox Support Team <support@proxmox.com>
|
||||
Description: Debian OpenVZ Appliance Builder
|
||||
This package contains scripts to automate the creation of openvz
|
||||
appliances.
|
21
copyright
Normal file
21
copyright
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (C) 2007 Proxmox Server Solutions GmbH
|
||||
|
||||
Copyright: dab is under GNU GPL, the GNU General Public License.
|
||||
|
||||
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; version 2 dated June, 1991.
|
||||
|
||||
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.
|
||||
|
||||
The complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL'.
|
579
dab
Executable file
579
dab
Executable file
@ -0,0 +1,579 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use Getopt::Long;
|
||||
use PVE::DAB;
|
||||
|
||||
$ENV{'LC_ALL'} = 'C';
|
||||
|
||||
sub print_usage {
|
||||
my ($msg) = @_;
|
||||
|
||||
if ($msg) {
|
||||
print STDERR "ERROR: $msg\n";
|
||||
}
|
||||
print STDERR "dab <command> [parameters]\n";
|
||||
}
|
||||
|
||||
|
||||
if (scalar (@ARGV) == 0) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
my $cmdline = join (' ', @ARGV);
|
||||
|
||||
my $cmd = shift @ARGV;
|
||||
|
||||
if (!$cmd) {
|
||||
print_usage("no command specified");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
my $dab = PVE::DAB->new();
|
||||
|
||||
$dab->writelog ("dab: $cmdline\n");
|
||||
|
||||
$SIG{INT} = $SIG{TERM} = $SIG{QUIT} = $SIG{HUP} = sub {
|
||||
die "interrupted by signal\n";
|
||||
};
|
||||
|
||||
eval {
|
||||
|
||||
if ($cmd eq 'init') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->initialize();
|
||||
|
||||
} elsif ($cmd eq 'bootstrap') {
|
||||
|
||||
my $opts = {};
|
||||
|
||||
if (!GetOptions ($opts, 'exim', 'minimal')) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "command 'bootstrap' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->ve_init();
|
||||
|
||||
$dab->bootstrap ($opts);
|
||||
|
||||
} elsif ($cmd eq 'finalize') {
|
||||
|
||||
my $opts = {};
|
||||
|
||||
if (!GetOptions ($opts, 'keepmycnf')) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->finalize($opts);
|
||||
|
||||
} elsif ($cmd eq 'veid') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
print $dab->{veid} . "\n";
|
||||
|
||||
} elsif ($cmd eq 'basedir') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
print $dab->vz_priv_dir() . "\n";
|
||||
|
||||
} elsif ($cmd eq 'packagefile') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
print "$dab->{targetname}.tar.gz\n";
|
||||
|
||||
} elsif ($cmd eq 'list') {
|
||||
|
||||
my $verbose;
|
||||
|
||||
if (!GetOptions ('verbose' =>\$verbose)) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
my $instpkgs = $dab->read_installed ();
|
||||
|
||||
foreach my $pkg (sort keys %$instpkgs) {
|
||||
if ($verbose) {
|
||||
my $version = $instpkgs->{$pkg}->{version};
|
||||
print "$pkg $version\n";
|
||||
} else {
|
||||
print "$pkg\n";
|
||||
}
|
||||
}
|
||||
|
||||
} elsif ($cmd eq 'task') {
|
||||
|
||||
my $task = shift @ARGV;
|
||||
|
||||
if (!$task) {
|
||||
print_usage ("no task specified");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
my $opts = {};
|
||||
|
||||
if ($task eq 'mysql') {
|
||||
|
||||
if (!GetOptions ($opts, 'password=s', 'start')) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->task_mysql ($opts);
|
||||
|
||||
} elsif ($task eq 'postgres') {
|
||||
|
||||
if (!GetOptions ($opts, 'version=s', 'start')) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->task_postgres ($opts);
|
||||
|
||||
} elsif ($task eq 'php') {
|
||||
|
||||
if (!GetOptions ($opts, 'memlimit=i')) {
|
||||
print_usage ();
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
die "task '$task' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->task_php ($opts);
|
||||
|
||||
} else {
|
||||
|
||||
print_usage ("unknown task '$task'");
|
||||
exit (-1);
|
||||
|
||||
}
|
||||
|
||||
} elsif ($cmd eq 'install' || $cmd eq 'unpack') {
|
||||
|
||||
my $required;
|
||||
foreach my $arg (@ARGV) {
|
||||
if ($arg =~ m/\.pkglist$/) {
|
||||
open (TMP, $arg) ||
|
||||
die "cant open package list '$arg' - $!";
|
||||
while (defined (my $line = <TMP>)) {
|
||||
chomp $line;
|
||||
next if $line =~ m/^\s*$/;
|
||||
next if $line =~ m/\#/;
|
||||
if ($line =~ m/^\s*(\S+)\s*$/) {
|
||||
push @$required, $1;
|
||||
} else {
|
||||
die "invalid package name in '$arg' - $line\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
push @$required, $arg;
|
||||
}
|
||||
|
||||
close (TMP);
|
||||
}
|
||||
|
||||
$dab->install ($required, $cmd eq 'unpack');
|
||||
|
||||
} elsif ($cmd eq 'exec') {
|
||||
|
||||
$dab->ve_exec (@ARGV);
|
||||
|
||||
} elsif ($cmd eq 'enter') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->enter();
|
||||
|
||||
} elsif ($cmd eq 'clean') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->cleanup (0);
|
||||
|
||||
} elsif ($cmd eq 'dist-clean') {
|
||||
|
||||
die "command '$cmd' expects no arguments.\n" if scalar (@ARGV) != 0;
|
||||
|
||||
$dab->cleanup (1);
|
||||
|
||||
} else {
|
||||
print_usage ("invalid command '$cmd'");
|
||||
exit (-1);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if (my $err = $@) {
|
||||
$dab->logmsg ($@);
|
||||
die ($@);
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dab - Debian OpenVZ Appliance Builder
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
=over
|
||||
|
||||
=item B<dab> I<command> I<[OPTIONS]>
|
||||
|
||||
=item B<dab init>
|
||||
|
||||
Downloads the package descriptions form the
|
||||
repository. Also truncates the C<logfile>.
|
||||
|
||||
=item B<dab bootstrap>
|
||||
|
||||
Bootstrap a debian system and allocate a
|
||||
temporary container (we use IDs 90000 and above).
|
||||
|
||||
=over
|
||||
|
||||
=item I<--exim>
|
||||
|
||||
Use exim as MTA (we use postfix by default)
|
||||
|
||||
=item I<--minimal>
|
||||
|
||||
Do not install standard packages.
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab veid>
|
||||
|
||||
Print used container ID.
|
||||
|
||||
=item B<dab basedir>
|
||||
|
||||
Print container private directory.
|
||||
|
||||
=item B<dab packagefile>
|
||||
|
||||
Print the appliance file name.
|
||||
|
||||
=item B<dab install I<pkg ...>>
|
||||
|
||||
Install one or more packages. I<pkg> can also refer to a file named
|
||||
C<xyz.pkglist> which contains a list of packages. All dependencies
|
||||
are automatically installed.
|
||||
|
||||
=item B<dab unpack I<pkg ...>>
|
||||
|
||||
Unpack one or more packages. I<pkg> can also refer to a file named
|
||||
C<xyz.pkglist> which contains a list of packages. All dependencies
|
||||
are automatically unpacked.
|
||||
|
||||
=item B<dab exec I<CMD> I<ARGS>>
|
||||
|
||||
Executes command CMD inside the container.
|
||||
|
||||
=item B<dab enter>
|
||||
|
||||
Calls C<vzctl enter CTID> - this is for debugging only.
|
||||
|
||||
=item B<dab task mysql>
|
||||
|
||||
Install a mysql database server. During appliance generation we use
|
||||
C<admin> as mysql root password (also stored in /root/.my.cnf).
|
||||
|
||||
=over
|
||||
|
||||
=item I<--password=XXX>
|
||||
|
||||
Specify the mysql root password. The special value C<random> can be
|
||||
use to generate a random root password when the appliance is started
|
||||
first time (stored in /root/.my.cnf)
|
||||
|
||||
=item I<--start>
|
||||
|
||||
Start the mysql server (if you want to execute sql commands during
|
||||
appliance generation).
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab task postgres>
|
||||
|
||||
Install a postgres database server.
|
||||
|
||||
=over
|
||||
|
||||
=item I<--version=XXX>
|
||||
|
||||
Select Postgres version. Posible values are C<7.4>, C<8.1> and C<8.3>
|
||||
(depends on the selected suite).
|
||||
|
||||
=item I<--start>
|
||||
|
||||
Start the postgres server (if you want to execute sql commands during
|
||||
appliance generation).
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab task php>
|
||||
|
||||
Install php5.
|
||||
|
||||
=over
|
||||
|
||||
=item I<--memlimit=i>
|
||||
|
||||
Set the php I<memory_limit>.
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab finalize>
|
||||
|
||||
Cleanup everything inside the container and generate the final
|
||||
appliance package.
|
||||
|
||||
=over
|
||||
|
||||
=item I<--keepmycnf>
|
||||
|
||||
Do not delete file C</root/.my.cfg> (mysql).
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab list>
|
||||
|
||||
List installed packages.
|
||||
|
||||
=over
|
||||
|
||||
=item I<--verbose>
|
||||
|
||||
Also print package versions.
|
||||
|
||||
=back
|
||||
|
||||
=item B<dab clean>
|
||||
|
||||
Remove all temporary file and destroy the used OpenVZ container.
|
||||
|
||||
=item B<dab dist-clean>
|
||||
|
||||
Like clean, but also removes the package cache (except when you
|
||||
specified your own cache directory in the config file)
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
dab is a script to automate the creation of OpenVZ appliances. It is
|
||||
basically a rewrite of debootstrap in perl, but uses OpenVZ instead of
|
||||
chroot and generates OpenVZ templates. Another difference is that it
|
||||
supports multi-stage building of templates. That way you can execute
|
||||
arbitrary scripts between to accomplish what you want.
|
||||
|
||||
Furthermore some common tasks are fully automated, like setting up a
|
||||
database server (mysql or postgres).
|
||||
|
||||
To accomplish minimal template creation time, packages are cached to a
|
||||
local directory, so you do not need a local debian mirror (although
|
||||
this would speed up the first run).
|
||||
|
||||
See http://pve.proxmox.com/wiki/Debian_Appliance_Builder for examples.
|
||||
|
||||
This script need to be run as root, so it is not recommended to start
|
||||
it on a production machine with running container. Proxmox VE
|
||||
(http://pve.proxmox.com) is the preferred environment, because it is
|
||||
able to log the console output when a container starts. You wont be
|
||||
able to detect errors during container startup when running on
|
||||
standard OpenVZ. So many people run Proxmox VE inside a KVM or VMWare
|
||||
64bit virtual machine to build appliances.
|
||||
|
||||
All generated templates includes an appliance description file. Those
|
||||
can be used to build appliance repositories.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
Configuration is read from the file C<dab.conf> inside the current working
|
||||
directory. The files contains key value pairs, separated by colon.
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<Suite:> I<etch|lenny|squeeze|hardy|intrepid|jaunty>
|
||||
|
||||
The Debian or Ubuntu suite.
|
||||
|
||||
=item B<Source:> I<URL [components]>
|
||||
|
||||
Defines a source location. By default we use the following for debian:
|
||||
|
||||
Source: http://ftp.debian.org/debian SUITE main contrib
|
||||
Source: http://security.debian.org SUITE/updates main contrib
|
||||
|
||||
Note: SUITE is a variable and will be substituted.
|
||||
|
||||
There are also reasonable defaults for Ubuntu. If you do not specify
|
||||
any source the defaults are used.
|
||||
|
||||
=item B<Depends:> I<dependencies>
|
||||
|
||||
Debian like package dependencies. This can be used to make sure that
|
||||
speific package versions are available.
|
||||
|
||||
=item B<CacheDir>: I<path>
|
||||
|
||||
Allows you to specify the directory where downloaded packages are
|
||||
cached.
|
||||
|
||||
=item B<Mirror:> I<SRCURL> => I<DSTURL>
|
||||
|
||||
Define a mirror location. for example:
|
||||
|
||||
Mirror: http://ftp.debian.org/debian => ftp://mirror/debian
|
||||
|
||||
=back
|
||||
|
||||
All other settings in this files are also included into the appliance
|
||||
description file.
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<Name:> I<name>
|
||||
|
||||
The name of the appliance.
|
||||
|
||||
Appliance names must consist only of lower case letters (a-z), digits
|
||||
(0-9), plus (+) and minus (-) signs, and periods (.). They must be at
|
||||
least two characters long and must start with an alphanumeric
|
||||
character.
|
||||
|
||||
=item B<Architecture:> I<i386|amd64>
|
||||
|
||||
Target architecture.
|
||||
|
||||
=item B<Version:> I<upstream_version[-build_revision]>
|
||||
|
||||
The version number of an appliance.
|
||||
|
||||
=item: B<Section:> I<section>
|
||||
|
||||
This field specifies an application area into which the appliance has
|
||||
been classified. Currently we use the following section names: system,
|
||||
admin, www
|
||||
|
||||
=item B<Maintainer:> I<name <email>>
|
||||
|
||||
The appliance maintainer's name and email address. The name should
|
||||
come first, then the email address inside angle brackets <> (in RFC822
|
||||
format).
|
||||
|
||||
=item B<Infopage:> I<URL>
|
||||
|
||||
Link to web page containing more informations about this appliance.
|
||||
|
||||
=item B<Description:> I<single line synopsis>
|
||||
|
||||
extended description over several lines (indended by space) may follow.
|
||||
|
||||
=back
|
||||
|
||||
=head1 Appliance description file
|
||||
|
||||
All generated templates includes an appliance description file called
|
||||
|
||||
/etc/appliance.info
|
||||
|
||||
this is the first file inside the tar archive. That way it can be
|
||||
easily exctracted without scanning the whole archive. The file itself
|
||||
contains informations like a debian C<control> file. It can be used to
|
||||
build appliance repositories.
|
||||
|
||||
Most fields are directly copied from the configuration file C<dab.conf>.
|
||||
|
||||
Additionally there are some auto-generated files:
|
||||
|
||||
=over
|
||||
|
||||
=item B<Installed-Size:> I<bytes>
|
||||
|
||||
It gives the total amount of disk space required to install the named
|
||||
appliance. The disk space is represented in megabytes as a simple
|
||||
decimal number.
|
||||
|
||||
=item B<Type:> I<type>
|
||||
|
||||
This is always C<openvz>.
|
||||
|
||||
=item B<OS:> I<[debian-4.0|debian-5.0|ubuntu-8.0]>
|
||||
|
||||
Operation system.
|
||||
|
||||
=back
|
||||
|
||||
Appliance repositories usually add additional fields:
|
||||
|
||||
=over
|
||||
|
||||
=item B<md5sum:> I<md5sum>
|
||||
|
||||
MD5 checksum
|
||||
|
||||
=back
|
||||
|
||||
=head1 FILES
|
||||
|
||||
The following files are created inside your working directory:
|
||||
|
||||
dab.conf appliance configuration file
|
||||
|
||||
logfile contains installation logs
|
||||
|
||||
.veid stores the used container ID
|
||||
|
||||
cache/* default package cache directory
|
||||
|
||||
info/* package information cache
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Dietmar Maurer <dietmar@proxmox.com>
|
||||
|
||||
Many thanks to Proxmox Server Solutions (www.proxmox.com) for sponsoring
|
||||
this work.
|
||||
|
||||
=head1 COPYRIGHT AND DISCLAIMER
|
||||
|
||||
Copyright (C) 2007-2009 Proxmox Server Solutions GmbH
|
||||
|
||||
Copyright: dab is under GNU GPL, the GNU General Public License.
|
||||
|
||||
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; version 2 dated June, 1991.
|
||||
|
||||
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.
|
BIN
devices.tar.gz
Normal file
BIN
devices.tar.gz
Normal file
Binary file not shown.
10
scripts/defenv
Executable file
10
scripts/defenv
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
export DEBCONF_NONINTERACTIVE_SEEN="true"
|
||||
|
||||
export HOME=/root
|
||||
export USER=root
|
||||
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
exec $@
|
80
scripts/init.pl
Normal file
80
scripts/init.pl
Normal file
@ -0,0 +1,80 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
use POSIX qw (:sys_wait_h strftime);
|
||||
use POSIX qw(EINTR);
|
||||
use IO::Socket::UNIX;
|
||||
|
||||
$SIG{CHLD} = sub {
|
||||
1 while waitpid(-1, WNOHANG) > 0;
|
||||
};
|
||||
$SIG{INT} = sub {
|
||||
print "stopping init\n";
|
||||
exit (0);
|
||||
};
|
||||
|
||||
mkdir "/dev";
|
||||
mkdir "/var/";
|
||||
mkdir "/var/log";
|
||||
|
||||
my $logfile = "/var/log/init.log";
|
||||
|
||||
close (STDOUT);
|
||||
open (STDOUT, ">>$logfile");
|
||||
close (STDERR);
|
||||
open STDERR, ">&STDOUT";
|
||||
|
||||
select STDERR; $| = 1; # make unbuffered
|
||||
select STDOUT; $| = 1; # make unbuffered
|
||||
|
||||
my $args = join (" ", @ARGV);
|
||||
|
||||
if ($$ != 1) {
|
||||
my $l = shift @ARGV;
|
||||
|
||||
if (defined ($l) && $l eq '0') {
|
||||
print "initctl $args\n";
|
||||
kill 2, 1;
|
||||
} else {
|
||||
print "initctl $args (ignored)\n";
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
print "starting init $args\n";
|
||||
|
||||
# only start once when pid == 1
|
||||
# ignore runlevel change requests
|
||||
exit (0) if $$ != 1;
|
||||
|
||||
if (! -d "/proc/$$") {
|
||||
system ("mount -t proc proc /proc") == 0 ||
|
||||
die "unable to mount proc filesystem\n";
|
||||
}
|
||||
|
||||
system ("hostname localhost") == 0 ||
|
||||
die "unable to set hostname\n";
|
||||
|
||||
|
||||
# provide simple syslog
|
||||
|
||||
my $sock = IO::Socket::UNIX->new (Local => "/dev/log", Listen => 5);
|
||||
|
||||
while ((my $fd = $sock->accept()) ||($! == EINTR)) {
|
||||
|
||||
next if !$fd; # EINTR
|
||||
|
||||
while (defined (my $line = <$fd>)) {
|
||||
$line =~ s/\0/\n/g;
|
||||
chomp $line;
|
||||
$line =~ s/^<\d+>//mg;
|
||||
next if $line =~ m/^\s*$/;
|
||||
print "$line\n";
|
||||
}
|
||||
|
||||
close ($fd);
|
||||
}
|
||||
|
||||
print "exit init\n";
|
||||
exit (0);
|
40
scripts/init_urandom
Executable file
40
scripts/init_urandom
Executable file
@ -0,0 +1,40 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: urandom
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: S
|
||||
# Default-Stop: 0 6
|
||||
# Short-Description: Save and restore random seed between restarts.
|
||||
# Description This script saves the random seed between restarts.
|
||||
# It is called from the boot, halt and reboot scripts.
|
||||
### END INIT INFO
|
||||
|
||||
[ -c /dev/urandom ] || exit 0
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
|
||||
. /lib/init/vars.sh
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Modified version for OpenVZ containers
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
# nothing to do inside container
|
||||
;;
|
||||
stop)
|
||||
# nothing to do inside container
|
||||
;;
|
||||
restart|reload|force-reload)
|
||||
echo "Error: argument '$1' not supported" >&2
|
||||
exit 3
|
||||
;;
|
||||
*)
|
||||
echo "Usage: urandom start|stop" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
44
scripts/mysql_randompw
Normal file
44
scripts/mysql_randompw
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: mysql_randompw
|
||||
# Required-Start: $local_fs mysql
|
||||
# Required-Stop:
|
||||
# X-Start-Before:
|
||||
# Default-Start: 2
|
||||
# Default-Stop:
|
||||
# Short-Description: Generate random MySQL root password
|
||||
# Description: Generate and set a random MySQL root password
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
HNAME=`head -n 1 /etc/hostname|awk '{ print $1; }'`
|
||||
|
||||
if [ "X${HNAME}" = "Xlocalhost" ] ; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "Generate random MySQL root password"
|
||||
|
||||
# set HOME dir (for .my.cfg)
|
||||
export HOME=/root
|
||||
export USER=root
|
||||
|
||||
UPASSWD=`openssl rand -base64 9`
|
||||
mysqladmin password "${UPASSWD}"
|
||||
|
||||
cat <<EOF > /root/.my.cnf
|
||||
[client]
|
||||
user=root
|
||||
password="${UPASSWD}"
|
||||
EOF
|
||||
|
||||
chmod 0600 /root/.my.cnf
|
||||
|
||||
if [ -x /sbin/insserv ] ; then
|
||||
/sbin/insserv -r mysql_randompw
|
||||
rm -f /etc/init.d/mysql_randompw
|
||||
else
|
||||
rm -f /etc/init.d/mysql_randompw
|
||||
update-rc.d -f mysql_randompw remove
|
||||
fi
|
35
scripts/ssh_gen_host_keys
Executable file
35
scripts/ssh_gen_host_keys
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ssh_gen_host_keys
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop:
|
||||
# X-Start-Before: sshd
|
||||
# Default-Start: 2
|
||||
# Default-Stop:
|
||||
# Short-Description: Regenerate SSH keys
|
||||
# Description: Regenerate container SSH keys for uniqueness.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
HNAME=`head -n 1 /etc/hostname|awk '{ print $1; }'`
|
||||
|
||||
if [ "X${HNAME}" = "Xlocalhost" ] ; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "generating ssh host keys"
|
||||
|
||||
rm -f /etc/ssh/ssh_host_rsa_key
|
||||
ssh-keygen -q -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
|
||||
|
||||
rm -f /etc/ssh/ssh_host_dsa_key
|
||||
ssh-keygen -q -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
|
||||
|
||||
if [ -x /sbin/insserv ] ; then
|
||||
/sbin/insserv -r ssh_gen_host_keys
|
||||
rm -f /etc/init.d/ssh_gen_host_keys
|
||||
else
|
||||
rm -f /etc/init.d/ssh_gen_host_keys
|
||||
update-rc.d -f ssh_gen_host_keys remove
|
||||
fi
|
Loading…
Reference in New Issue
Block a user