2 == HOWTO set up a porting dchroot on a debian.org machine ==
4 This example is for setting up a $DIST dchroot on paer.debian.org,
7 Do the following as root:
10 echo -n 'Dist: ' && read DIST && export DIST &&
11 echo -n 'Mirror: ' && read MIRROR && export MIRROR
19 debootstrap --keyring /usr/share/keyrings/debian-archive-keyring.gpg --include="apt" --variant=buildd $DIST ./$DIST http://$MIRROR/debian &&
20 cp /etc/hosts $DIST/etc/
23 * enter the chroot and create the chroot tag:
26 echo $DIST > /etc/debian_chroot
28 # change root's .bashrc:
29 grep -q debian.chroot /etc/bash.bashrc || patch /root/.bashrc << 'EOF'
32 +if [ -e /etc/debian_chroot ]; then
33 + debian_chroot=$(cat /etc/debian_chroot)
34 + PS1="[$debian_chroot] $PS1"
40 echo 'Acquire::PDiffs "false";' > /etc/apt/apt.conf.d/local-pdiff
41 echo 'APT::Install-Recommends 0;' > /etc/apt/apt.conf.d/local-recommends
42 # # not sure this one's a good idea, -- weasel 20080829
43 # ##echo 'DPkg::Post-Invoke { "(sleep 1; apt-get clean) &"; };' > /etc/apt/apt.conf.d/local-cleanup
45 #*) deploy a policy-rc.d script:
47 apt-get install policyrcd-script-zg2 &&
48 cat > /usr/local/sbin/policy-rc.d << EOF &&
51 # policy-rc.d script for chroots.
52 # Copyright (c) 2007 Peter Palfrader <peter@palfrader.org>
59 echo "Not running services in chroot."
65 chmod +x /usr/local/sbin/policy-rc.d
67 #*) install and setup locales and install libnss-db
68 apt-get install locales-all
70 # (if locales-all is not feasible on the machine because of say
71 # disk constraints then install just locales and enable at
72 # least "en_US.UTF-8 UTF-8" and "en_US ISO-8859-1".)
74 #*) setup nsswitch.conf to properly use the ldap stuff
75 apt-get install libnss-db &&
76 sed -i -e 's/^passwd:\[[:space:]]\+compat$/passwd: compat db/;
77 s/^group:\[[:space:]]\+compat$/group: db compat/;
78 s/^shadow:\[[:space:]]\+compat$/shadow: compat db/' \
83 apt-get install vim fakeroot devscripts gdb zsh dialog tcsh debfoster
84 # edit the sources.list in the chroot and add contrib/non-free to the
85 # primary source, a security updates source, and deb-src entries for both.
86 # It should end up looking something like
88 echo "deb http://$MIRROR/debian $DIST main contrib non-free"
89 echo "deb-src http://$MIRROR/debian $DIST main contrib non-free"
90 if [ "$DIST" != "sid" ] ; then
91 echo "deb http://security.debian.org $DIST/updates main contrib non-free"
92 echo "deb-src http://security.debian.org $DIST/updates main contrib non-free"
94 ) > /etc/apt/sources.list
95 apt-get update && apt-get upgrade
98 mount /proc && debfoster && umount /proc
105 * edit /etc/fstab on the system root and add entries to mount /proc and /home
106 in the chroot, there will be existing ones for the other chroots, just copy and
107 adjust. Then mount them (from the system root).
110 : proc-etch /srv/albeniz.debian.org/chroot/etch/proc proc defaults,nosuid,nodev,noexec 0 0
111 : proc-lenny /srv/albeniz.debian.org/chroot/lenny/proc proc defaults,nosuid,nodev,noexec 0 0
112 : proc-sid /srv/albeniz.debian.org/chroot/sid/proc proc defaults,nosuid,nodev,noexec 0 0
114 : home /srv/albeniz.debian.org/chroot/etch/home none bind,defaults
115 : home /srv/albeniz.debian.org/chroot/lenny/home none bind,defaults
116 : home /srv/albeniz.debian.org/chroot/sid/home none bind,defaults
118 : devpts-etch /srv/albeniz.debian.org/chroot/etch/dev/pts devpts defaults,noexec,nosuid 0 0
119 : devpts-lenny /srv/albeniz.debian.org/chroot/lenny/dev/pts devpts defaults,noexec,nosuid 0 0
120 : devpts-sid /srv/albeniz.debian.org/chroot/sid/dev/pts devpts defaults,noexec,nosuid 0 0
122 : shm-etch /srv/albeniz.debian.org/chroot/etch/dev/shm tmpfs defaults,nosuid,nodev 0 0
123 : shm-lenny /srv/albeniz.debian.org/chroot/lenny/dev/shm tmpfs defaults,nosuid,nodev 0 0
124 : shm-sid /srv/albeniz.debian.org/chroot/sid/dev/shm tmpfs defaults,nosuid,nodev 0 0
126 : tmp /srv/albeniz.debian.org/chroot/etch/tmp none bind,defaults
127 : tmp /srv/albeniz.debian.org/chroot/lenny/tmp none bind,defaults
128 : tmp /srv/albeniz.debian.org/chroot/sid/tmp none bind,defaults
131 * edit /etc/dchroot.conf in the system root, add an entry for $DIST, and
132 update the stable and testing pointers
134 * run ud-replicate so the new chroot is setup (this would happen via cron eventually, this is just to speed things up)
139 * as a normal user, test that the new chroot works: "dchroot $DIST", test that the stable and testing pointers work.
141 -- taggart 2007, slightly modified by weasel 2007, 2008, ported to wiki 2010.