a35de272f79323acd030fd7a17c59c624a1ba146
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 33-aptsetup
1 #!/bin/sh
2 # Filename:      /etc/grml/fai/config/scripts/GRMLBASE/33-aptsetup
3 # Purpose:       configure Debian package management of live-system
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -e
10
11 # remove leftover from /etc/grml/fai/config/hooks/instsoft.GRMLBASE:
12 rm -f $target/etc/apt/sources.list.d/grml-live.list
13
14 GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list"
15 DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list"
16
17 [ -d $target/etc/apt/sources.list.d ] || mkdir $target/etc/apt/sources.list.d
18
19 # remove any existing sources.list and inform user about the new
20 # /etc/apt/sources.list.d/ setup:
21 cat > $target/etc/apt/sources.list << EOF
22 ##### IMPORTANT NOTE ##############################################
23 # The configuration file /etc/apt/sources.list has been split
24 # into structured files in /etc/apt/sources.list.d/ - check out:
25 #
26 #  /etc/apt/sources.list.d/grml.list   for the grml related repositories
27 #  /etc/apt/sources.list.d/debian.list for official Debian repositories
28 #
29 # If you're looking for the "old" /etc/apt/sources.list file or
30 # need some further repositories please take a look at the file
31 # /etc/apt/sources.list.grml
32 ##### IMPORTANT NOTE ##############################################
33 EOF
34
35 # retrieve build information ($SUITE):
36 if [ -r $target/etc/grml_live_version ] ; then
37   . $target/etc/grml_live_version
38 fi
39
40 # if we stil do not know which Debian suite we are building assume "stable"
41 [ -n "$SUITE" ] || SUITE="stable"
42
43 # configure official Debian repositories:
44 cat > "$DEBIAN_SOURCES_LIST" << EOF
45 # official debian repository:
46   deb     http://cdn.debian.net/debian/ $SUITE main contrib non-free
47   deb-src http://cdn.debian.net/debian/ $SUITE main contrib non-free
48 EOF
49
50 # configure grml-stable repository:
51 cat > "$GRML_SOURCES_LIST" << EOF
52 # stable grml repository:
53   deb     http://deb.grml.org/ grml-stable  main
54   deb-src http://deb.grml.org/ grml-stable  main
55 EOF
56
57 ENABLE_GRML_TESTING=false
58 # if we have a devel-version or a daily snapshot enable grml-testing by default:
59 if [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then
60    if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then
61       ENABLE_GRML_TESTING=true
62    fi
63 fi
64
65 if $ENABLE_GRML_TESTING ; then
66   cat >> "$GRML_SOURCES_LIST" << EOF
67 # testing/developer grml repository:
68   deb     http://deb.grml.org/ grml-testing main
69   deb-src http://deb.grml.org/ grml-testing main
70 EOF
71 else # no devel/daily build:
72   cat >> "$GRML_SOURCES_LIST" << EOF
73 # testing/developer grml repository:
74 #  deb     http://deb.grml.org/ grml-testing main
75 #  deb-src http://deb.grml.org/ grml-testing main
76 EOF
77 fi
78
79 ## END OF FILE #################################################################
80 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3