[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Dak bug report



On 09/01/2012 10:30 PM, Travis L. Bean wrote:
I am currently using Dak in a shell script that installs GOsa (Dak is
used for the gosa-client-dak plugin).

I am using the attached dak.sh script (incorporated into a larger GOsa
installer script) to automate the Dak installation from Git. I wrote
this script based on the notes found in /opt/dak/setup/README.

I just noticed in the Dak README "don't set a passphrase as dak will not pass one through to gpg", so I updated this in the following dak.installer for clarity sake:

#!/bin/bash

# This script installs Dak on Debian Squeeze 6.x.

# Adjust variables to match your configuration:
ARCH="amd64"
NAME="John Doe"
EMAIL="jdoe@example.com"

# Install Dak:
echo "deb http://www.backports.org/debian squeeze-backports main contrib non-free" \
  > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get -t squeeze-backports -y install postgresql-doc-9.1 postgresql-9.1 postgresql-client-9.1 postgresql-plperl-9.1 \ postgresql-plpython-9.1 postgresql-9.1-debversion python-psycopg2 python-sqlalchemy python-apt \ binutils-multiarch python-yaml python-ldap python-pyrss2gen python-rrdtool rng-tools git gnupg
git clone http://ftp-master.debian.org/git/dak.git /opt/dak

# Set up the Dak user:
addgroup --system ftpmaster
adduser --system dak --ingroup ftpmaster --shell /bin/bash

# Create postgres roles and database:
su -l postgres -c psql << EOF.postgres
CREATE USER dak CREATEROLE;
CREATE ROLE ftpmaster;
CREATE ROLE ftpteam WITH ROLE ftpmaster;
CREATE ROLE ftptrainee WITH ROLE ftpmaster, ftpteam;

CREATE DATABASE projectb WITH OWNER dak TEMPLATE template0 ENCODING 'SQL_ASCII';
\c projectb
CREATE EXTENSION IF NOT EXISTS plpgsql;
CREATE EXTENSION IF NOT EXISTS debversion;
EOF.postgres

# Set up the Dak directory:
mkdir -p /etc/dak
mkdir -p /srv/dak
chown dak:ftpmaster /srv/dak
chmod 2775 /srv/dak

# Create a symlink to /srv/dak/dak.conf in /etc/dak:
ln -fs /srv/dak/dak.conf /etc/dak/dak.conf

# Import the schema:
su dak -c "psql -1 -f /opt/dak/setup/current_schema.sql -d projectb >/dev/null"

# Set up some core data in projectb to get started (read the init_vars
# file if you wish to customize various aspects):
cd /opt/dak/setup
su dak -c "sh init_core"

# Create a minimal dak.conf:
su dak -c "sh init_minimal_conf > /srv/dak/dak.conf"

# Set up a symlink for dak.py:
su dak -c "mkdir -p ~dak/bin"
su dak -c "ln -fs /opt/dak/dak/dak.py ~dak/bin/dak"

# Test that the database schema is up-to-date:
su dak -c "~dak/bin/dak update-db"

# Run dak init-dirs to set up the initial /srv/dak tree:
su dak -c "~dak/bin/dak init-dirs"

# Copy the email templates into the /srv/dak tree:
cp -u /opt/dak/templates/* /srv/dak/templates/

# Create GnuPG private key to sign APT repositories:
rngd -r /dev/urandom
su dak -c "gpg --no-default-keyring --secret-keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/secring.gpg \ --keyring /srv/dak/keyrings/s3kr1t/dot-gnupg/pubring.gpg --gen-key --batch" << EOF.gpg
Key-Type: RSA
Key-Length: 2048
Expire-Date: 0
Name-Real: $NAME
Name-Email: $EMAIL
EOF.gpg
killall rngd

# Add the architecture you care about:
su dak -c '~dak/bin/dak admin architecture add $ARCH "$ARCH port"'

# Add a suite (origin=, label= and codename= are optional)
# signingkey= will ensure that Release files are signed:
GPG_KEY=$(echo $(su dak -c "gpg --list-secret-keys | awk '{ print $2 }' | cut -d'/' -f2 | cut -d'<' -f1") | tr -d '[:space:]') su dak -c "~dak/bin/dak admin suite add-all-arches stable $(cat /etc/debian_version) codename=squeeze signingkey=${GPG_KEY}"

# Re-run Dak init-dirs to add new suite directories to /srv/dak:
su dak -c "~dak/bin/dak init-dirs"

--
Travis L. Bean
http://www.AssureTech.net
AssureTech - Your source for FREE Open Source


Reply to: