d78584f0669736dfe05341acab483531f712d907
[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:
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 EOF
61
62 # configure grml-stable repository:
63 cat > "$GRML_SOURCES_LIST" << EOF
64 # stable grml repository:
65   deb     http://deb.grml.org/ grml-stable  main
66   deb-src http://deb.grml.org/ grml-stable  main
67 EOF
68
69 ENABLE_GRML_TESTING=false
70 # if we have a devel-version or a daily snapshot enable grml-testing by default:
71 if [ -n "$GRML_NAME" -o -n "$RELEASENAME" ] ; then
72    if echo "$GRML_NAME" "$RELEASENAME" | grep -e devel -e autobuild 1>/dev/null ; then
73       ENABLE_GRML_TESTING=true
74    fi
75 fi
76
77 if $ENABLE_GRML_TESTING ; then
78   cat >> "$GRML_SOURCES_LIST" << EOF
79 # testing/developer grml repository:
80   deb     http://deb.grml.org/ grml-testing main
81   deb-src http://deb.grml.org/ grml-testing main
82 EOF
83 else # no devel/daily build:
84   cat >> "$GRML_SOURCES_LIST" << EOF
85 # testing/developer grml repository:
86 #  deb     http://deb.grml.org/ grml-testing main
87 #  deb-src http://deb.grml.org/ grml-testing main
88 EOF
89 fi
90
91 ## END OF FILE #################################################################
92 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=3