For the purposes of this document, we'll be working in /srv/dak
Set up the dak user on both the system and in postgres:
-sudo adduser dak
-sudo addgroup ftpmaster
-sudo addgroup dak ftpmaster
-sudo -u postgres createuser -s dak
+# sudo adduser dak
+# sudo addgroup ftpmaster
+# sudo addgroup dak ftpmaster
+# sudo -u postgres createuser -s dak
Set up the dak directory:
-sudo mkdir /srv/dak
-sudo chown dak:ftpmaster /srv/dak
-sudo chmod 2775 /srv/dak
+# sudo mkdir /srv/dak
+# sudo chown dak:ftpmaster /srv/dak
+# sudo chmod 2775 /srv/dak
Become the dak user:
-sudo -u dak -s -H
+# sudo -u dak -s -H
Create the additional roles:
-createuser -S -R -D ftpmaster
-createuser -S -R -D ftpteam
-createuser -S -R -D ftptrainee
+# createuser -S -R -D ftpmaster
+# createuser -S -R -D ftpteam
+# createuser -S -R -D ftptrainee
Create an empty database with SQL_ASCII encoding:
-createdb -T template0 -E SQL_ASCII -O dak projectb
+# createdb -T template0 -E SQL_ASCII -O dak projectb
Import the schema:
-psql -f current_schema.sql -d projectb
+# psql -f current_schema.sql -d projectb
+
+Set up some core data in projectb to get started (read the init_vars file if
+you wish to customise various aspects):
+# ./init_core
+
+Add some architectures you care about:
+# dak admin architecture add i386 "Intel x86 port"
+# dak admin architecture add amd64 "AMD64 port"
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Creating components"
+
+psql -c "INSERT INTO component (name, description, meets_dfsg)
+ VALUES ('main', 'Main', TRUE)" >/dev/null
+
+psql -c "INSERT INTO component (name, description, meets_dfsg)
+ VALUES ('contrib', 'Contrib', TRUE)" >/dev/null
+
+psql -c "INSERT INTO component (name, description, meets_dfsg)
+ VALUES ('non-free', 'Software that fails to meet the DFSG', FALSE)" >/dev/null
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Creating core queues"
+
+QUEUEBASE="${DAKBASE}/queue"
+
+psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
+ generate_metadata, stay_of_execution, send_to_build_queues)
+ VALUES ('unchecked', '${QUEUEBASE}/unchecked', '0660', '0660',
+ FALSE, 86400, FALSE)" >/dev/null
+
+psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
+ generate_metadata, stay_of_execution, send_to_build_queues)
+ VALUES ('new', '${QUEUEBASE}/new', '0660', '0660',
+ FALSE, 86400, FALSE)" >/dev/null
+
+psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
+ generate_metadata, stay_of_execution, send_to_build_queues)
+ VALUES ('newstage', '${QUEUEBASE}/newstage', '0660', '0660',
+ FALSE, 86400, FALSE)" >/dev/null
+
+psql -c "INSERT INTO policy_queue (queue_name, path, perms, change_perms,
+ generate_metadata, stay_of_execution, send_to_build_queues)
+ VALUES ('byhand', '${QUEUEBASE}/byhand', '0660', '0660',
+ FALSE, 86400, FALSE)" >/dev/null
--- /dev/null
+#!/bin/sh
+
+echo "Creating default sections"
+
+set -e
+set -u
+
+SECTIONS="admin
+cli-mono
+comm
+database
+debian-installer
+debug
+devel
+doc
+editors
+electronics
+embedded
+fonts
+games
+gnome
+gnu-r
+gnustep
+graphics
+hamradio
+haskell
+httpd
+interpreters
+java
+kde
+kernel
+libdevel
+libs
+lisp
+localization
+mail
+math
+misc
+net
+news
+ocaml
+oldlibs
+otherosfs
+perl
+php
+python
+ruby
+science
+shells
+sound
+tasks
+tex
+text
+utils
+vcs
+video
+web
+x11
+xfce
+zope"
+
+for prefix in "" "contrib/" "non-free/"; do
+ for section in ${SECTIONS}; do
+ psql -c "INSERT INTO section (section) VALUES ('$prefix$section')" >/dev/null
+ done
+done
--- /dev/null
+#!/bin/sh
+
+echo "Creating default priorities"
+
+set -e
+set -u
+
+psql -c "INSERT INTO priority (priority, level) VALUES ('required', 1)" >/dev/null
+psql -c "INSERT INTO priority (priority, level) VALUES ('important', 2)" >/dev/null
+psql -c "INSERT INTO priority (priority, level) VALUES ('standard', 3)" >/dev/null
+psql -c "INSERT INTO priority (priority, level) VALUES ('optional', 4)" >/dev/null
+psql -c "INSERT INTO priority (priority, level) VALUES ('extra', 5)" >/dev/null
+psql -c "INSERT INTO priority (priority, level) VALUES ('source', 0)" >/dev/null
+
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Setting up source and all architectures"
+
+psql -c "INSERT INTO architecture (arch_string, description)
+ VALUES ('source', 'Source')" >/dev/null
+
+psql -c "INSERT INTO architecture (arch_string, description)
+ VALUES ('all', 'Architecture Independent')" >/dev/null
+
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Setting up default keyrings"
+
+psql -c "INSERT INTO binary_acl (access_level) VALUES ('full')" >/dev/null
+psql -c "INSERT INTO binary_acl (access_level) VALUES ('map')" >/dev/null
+
+psql -c "INSERT INTO source_acl (access_level) VALUES ('full')" >/dev/null
+psql -c "INSERT INTO source_acl (access_level) VALUES ('dm')" >/dev/null
+
+psql -c "INSERT INTO keyrings (name, default_source_acl_id, default_binary_acl_id)
+ VALUES ('${DAKBASE}/keyrings/upload-keyring.gpg',
+ (SELECT id FROM binary_acl WHERE access_level = 'full'),
+ (SELECT id FROM source_acl WHERE access_level = 'full'))" >/dev/null
+
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Creating override types"
+
+psql -c "INSERT INTO override_type (type) VALUES ('deb')" >/dev/null
+psql -c "INSERT INTO override_type (type) VALUES ('udeb')" >/dev/null
+psql -c "INSERT INTO override_type (type) VALUES ('dsc')" >/dev/null
+
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+POOLPATH="${DAKBASE}/ftp/pool"
+
+echo "Setting up archive and locations"
+psql -c "INSERT INTO archive (name, origin_server, description)
+ VALUES ('${DAKHOST}', '${DAKFQDN}', 'Master server')" >/dev/null
+
+for component in main contrib non-free; do
+ psql -c "INSERT INTO location (path, type, component, archive)
+ VALUES ('${POOLPATH}', 'pool',
+ (SELECT id FROM component WHERE name = '${component}'),
+ (SELECT id FROM archive WHERE name = '${DAKHOST}'))" >/dev/null
+done
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Setting up source formats"
+
+psql -c "INSERT INTO src_format (format_name) VALUES ('1.0')" >/dev/null
+psql -c "INSERT INTO src_format (format_name) VALUES ('3.0 (quilt)')" >/dev/null
+psql -c "INSERT INTO src_format (format_name) VALUES ('3.0 (native)')" >/dev/null
--- /dev/null
+#!/bin/sh
+
+set -e
+set -u
+
+echo "Setting up metadata key ordering"
+
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Package', -2600)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Source', -2500)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Binary', -2400)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Version', -2300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Essential', -2250)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Installed-Size', -2200)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Maintainer', -2100)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Uploaders', -2090)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Original-Maintainer', -2080)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Depends', -2000)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Depends-Indep', -1990)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Conflicts', -1980)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Build-Conflicts-Indep', -1970)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Architecture', -1800)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Standards-Version', -1700)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Format', -1600)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Files', -1500)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Dm-Upload-Allowed', -1400)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Browse', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Hg', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Darcs', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Svn', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Git', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Browser', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Arch', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Bzr', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Mtn', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Vcs-Cvs', -1300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Checksums-Sha256', -1200)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Checksums-Sha1', -1200)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Replaces', -1100)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Provides', -1000)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Depends', -900)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Pre-Depends', -850)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Recommends', -800)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Suggests', -700)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Enhances', -650)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Conflicts', -600)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Breaks', -500)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Description', -400)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Origin', -300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Bugs', -200)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Multi-Arch', -150)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Homepage', -100)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Tag', 300)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Package-Type', 400)" >/dev/null
+psql -c "INSERT INTO metadata_keys (key, ordering) VALUES ('Installer-Menu-Item', 500)" >/dev/null
--- /dev/null
+#!/bin/sh
+
+. init_vars
+
+run-parts --exit-on-error core-init.d/
--- /dev/null
+#!/bin/sh
+
+# The following variables are required by these scripts:
+
+## DAKBASE: The directory in which the dak install is to exist
+DAKBASE=${DAKBASE:-/srv/dak}
+export DAKBASE
+
+## DAKFQDN: The fqdn of the dak host
+DAKFQDN=${DAKFQDN:-$(hostname -f)}
+export DAKFQDN
+
+## DAKHOST: The short name used for the dak host
+DAKHOST=${DAKHOST:-$(hostname)}
+export DAKHOST
+
+## PGDATABASE: The postgresql database to use
+## (other PG* variables can also be exported by the user if needed)
+PGDATABASE=${PGDATABASE:-projectb}
+export PGDATABASE