Temporarly move /etc/apt/sources.list.d/grml.list in instsoft.GRMLBASE
[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 # restore original grml sources.list file:
15 if [ -r $target/etc/apt/sources.list.d/grml.unused ] ; then
16    mv $target/etc/apt/sources.list.d/grml.unused $target/etc/apt/sources.list.d/grml.list
17 fi
18
19 GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list"
20 DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list"
21
22 [ -d $target/etc/apt/sources.list.d ] || mkdir $target/etc/apt/sources.list.d
23
24 # remove any existing sources.list and inform user about the new
25 # /etc/apt/sources.list.d/ setup:
26 cat > $target/etc/apt/sources.list << EOF
27 ##### IMPORTANT NOTE ##############################################
28 # The configuration file /etc/apt/sources.list has been split
29 # into structured files in /etc/apt/sources.list.d/ - check out:
30 #
31 #  /etc/apt/sources.list.d/grml.list   for the grml related repositories
32 #  /etc/apt/sources.list.d/debian.list for official Debian repositories
33 #
34 # If you're looking for the "old" /etc/apt/sources.list file or
35 # need some further repositories please take a look at the file
36 # /etc/apt/sources.list.grml
37 ##### IMPORTANT NOTE ##############################################
38 EOF
39
40 # retrieve build information ($SUITE):
41 if [ -r $target/etc/grml_live_version ] ; then
42   . $target/etc/grml_live_version
43 fi
44
45 # if we stil do not know which Debian suite we are building assume "stable"
46 [ -n "$SUITE" ] || SUITE="stable"
47
48 # configure official Debian repositories:
49 cat > "$DEBIAN_SOURCES_LIST" << EOF
50 # official debian repository:
51   deb     http://cdn.debian.net/debian/ $SUITE main contrib non-free
52   deb-src http://cdn.debian.net/debian/ $SUITE main contrib non-free
53 EOF
54
55 # configure grml-stable repository:
56 cat > "$GRML_SOURCES_LIST" << EOF
57 # stable grml repository:
58   deb     http://deb.grml.org/ grml-stable  main
59   deb-src http://deb.grml.org/ grml-stable  main
60 EOF
61
62 ENABLE_GRML_TESTING=false
63 # if we have a devel-version or a daily snapshot enable grml-testing by default:
64 if [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then
65    if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then
66       ENABLE_GRML_TESTING=true
67    fi
68 fi
69
70 if $ENABLE_GRML_TESTING ; then
71   cat >> "$GRML_SOURCES_LIST" << EOF
72 # testing/developer grml repository:
73   deb     http://deb.grml.org/ grml-testing main
74   deb-src http://deb.grml.org/ grml-testing main
75 EOF
76 else # no devel/daily build:
77   cat >> "$GRML_SOURCES_LIST" << EOF
78 # testing/developer grml repository:
79 #  deb     http://deb.grml.org/ grml-testing main
80 #  deb-src http://deb.grml.org/ grml-testing main
81 EOF
82 fi
83
84 ## END OF FILE #################################################################
85 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3