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