Move some of the porterbox schroot logic to the schroot module that is shared with...
[mirror/dsa-puppet.git] / modules / schroot / files / schroot-setup.d / 99porterbox-extra-sources
1 #!/bin/bash
2
3 ##
4 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
5 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
6 ##
7
8 # by weasel
9
10 set -e
11
12 [ "$CHROOT_PROFILE" = "dsa" ] || exit 0
13
14 . "$SETUP_DATA_DIR/common-data"
15 . "$SETUP_DATA_DIR/common-functions"
16
17 if [ -f "${CHROOT_SCRIPT_CONFIG:-}" ]; then
18     . "$CHROOT_SCRIPT_CONFIG"
19 elif [ -f "$CHROOT_PROFILE_DIR/config" ]; then
20     . "$CHROOT_PROFILE_DIR/config"
21 else
22     fatal "Cannot find config script"
23 fi
24
25
26 if [ "$1" = "setup-start" ] || [ "$1" = "setup-recover" ]; then
27   SRCL="${CHROOT_PATH}/etc/apt/sources.list.d/auto.list"
28   rm -f "$SRCL"
29   mirror=${MIRROR:-http://cdn.debian.net/debian}
30
31   case "${SUITE_BASE:-}" in
32     experimental)
33       echo "deb     $mirror sid main" >> "$SRCL"
34       echo "deb-src $mirror sid main" >> "$SRCL"
35       ;;
36     sid|jessie)
37       ;;
38     *)
39       echo "deb     http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
40       echo "deb-src http://security.debian.org/ ${SUITE_BASE}/updates main" >> "$SRCL"
41       ;;
42   esac
43   echo "deb     $mirror ${SUITE_BASE} main" >> "$SRCL"
44   echo "deb-src $mirror ${SUITE_BASE} main" >> "$SRCL"
45
46   case "${SUITE_VARIANT:-}" in
47     backports)
48       case "${SUITE_BASE:-}" in
49         squeeze)
50           echo "deb     http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
51           echo "deb-src http://backports.debian.org/debian-backports/ ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
52           ;;
53         *)
54           echo "deb     $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
55           echo "deb-src $mirror ${SUITE_BASE}-${SUITE_VARIANT} main" >> "$SRCL"
56           ;;
57       esac
58       ;;
59   esac
60   echo "o To install build dependencies run"
61   echo "  dd-schroot-cmd -c ${SESSION_ID} apt-get update"
62   echo "  followed by build-dep/install as appropriate in the host system."
63   echo "o If you started this session with schroot -b, please do not forget to run"
64   echo "  schroot --end-session -c ${SESSION_ID}"
65   echo "  when you no longer need this environment."
66 fi