Update sources.list handling.
[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 if [ -L "$target"/etc/apt/sources.list ] ; then
12    echo "Note: $target/etc/apt/sources.list seems to be the old sources.list setup."
13    echo "|->   Not modifying anything. If you want to switch to the new setup just"
14    echo "\`->   remove symlink $target/etc/apt/sources.list"
15    exit 0
16 fi
17
18 # remove leftover from /etc/grml/fai/config/hooks/instsoft.GRMLBASE:
19 rm -f $target/etc/apt/sources.list.d/grml-live.list
20
21 # restore original grml sources.list file:
22 if [ -r $target/etc/apt/sources.list.d/grml.unused ] ; then
23    mv $target/etc/apt/sources.list.d/grml.unused $target/etc/apt/sources.list.d/grml.list
24 fi
25
26 GRML_SOURCES_LIST="$target/etc/apt/sources.list.d/grml.list"
27 DEBIAN_SOURCES_LIST="$target/etc/apt/sources.list.d/debian.list"
28
29 [ -d $target/etc/apt/sources.list.d ] || mkdir $target/etc/apt/sources.list.d
30
31 # remove any existing sources.list and inform user about the new
32 # /etc/apt/sources.list.d/ setup:
33 cat > $target/etc/apt/sources.list << EOF
34 ##### IMPORTANT NOTE ##############################################
35 # The configuration file /etc/apt/sources.list has been split
36 # into structured files in /etc/apt/sources.list.d/ - check out:
37 #
38 #  /etc/apt/sources.list.d/grml.list   for the grml related repositories
39 #  /etc/apt/sources.list.d/debian.list for official Debian repositories
40 #
41 # If you're looking for the "old" /etc/apt/sources.list file or
42 # need some further repositories please take a look at the file
43 # /etc/apt/sources.list.grml
44 ##### IMPORTANT NOTE ##############################################
45 EOF
46
47 # retrieve build information ($SUITE):
48 if [ -r $target/etc/grml_live_version ] ; then
49   . $target/etc/grml_live_version
50 fi
51
52 # if we stil do not know which Debian suite we are building assume "stable"
53 [ -n "$SUITE" ] || SUITE="stable"
54
55 # configure official Debian repositories:
56 cat > "$DEBIAN_SOURCES_LIST" << EOF
57 # official debian repository (mirror selected via geo-ip):
58   deb     http://cdn.debian.net/debian/ $SUITE main contrib non-free
59 #  deb-src http://cdn.debian.net/debian/ $SUITE main contrib non-free
60
61 # official debian repository:
62 #  deb     http://ftp.debian.org/debian/ sid main contrib non-free
63 #  deb-src http://ftp.debian.org/debian/ sid main contrib non-free
64
65 # official debian DE repository:
66 #  deb     http://ftp.de.debian.org/debian/ sid main contrib non-free
67 #  deb-src http://ftp.de.debian.org/debian/ sid main contrib non-free
68
69 # official debian AT repository:
70 #  deb     http://ftp.at.debian.org/debian/ sid main contrib non-free
71 #  deb-src http://ftp.at.debian.org/debian/ sid main contrib non-free
72 EOF
73
74 # configure grml-stable repository:
75 cat > "$GRML_SOURCES_LIST" << EOF
76 # stable grml repository:
77   deb     http://deb.grml.org/ grml-stable  main
78 #  deb-src http://deb.grml.org/ grml-stable  main
79 EOF
80
81 ENABLE_GRML_TESTING=false
82 # if we have a devel-version or a daily snapshot enable grml-testing by default:
83 if [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then
84    if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then
85       ENABLE_GRML_TESTING=true
86    fi
87 fi
88
89 if $ENABLE_GRML_TESTING ; then
90   cat >> "$GRML_SOURCES_LIST" << EOF
91 # testing/developer grml repository:
92   deb     http://deb.grml.org/ grml-testing main
93 #  deb-src http://deb.grml.org/ grml-testing main
94 EOF
95 else # no devel/daily build:
96   cat >> "$GRML_SOURCES_LIST" << EOF
97 # testing/developer grml repository:
98 #  deb     http://deb.grml.org/ grml-testing main
99 #  deb-src http://deb.grml.org/ grml-testing main
100 EOF
101 fi
102
103 ## END OF FILE #################################################################
104 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3