File: debian-cd

package info (click to toggle)
simple-cdd 0.6.9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 344 kB
  • sloc: python: 1,904; sh: 111; makefile: 13
file content (207 lines) | stat: -rw-r--r-- 6,069 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#= -*- Mode: shell-script -*-

find_files(){
  file="$1"
  for dir in $simple_cdd_dirs ; do
    f="$dir/$file"
    if [ -r "$f" ]; then
        echo "$f"
        break
    fi
  done
}

profile_files(){
  profile="$1"
  type="$2"
  find_files "profiles/$profile.$type"
}

export PATH="$debian_cd_dir/tools:$PATH"

# copy debian-cd files into working dir
rsync --delete -aWHr $debian_cd_dir/. $BASEDIR/

# Patch debian-cd apt configuration to allow unsigned repositories.
# https://bugs.debian.org/879642
if ! grep -q -i 'acquire::allowinsecurerepositories=true' $BASEDIR/tools/apt-selection ; then
    sed -i -e 's,^options=",options=" -o Acquire::AllowInsecureRepositories=true,g ' $BASEDIR/tools/apt-selection
fi

# Enable ARCHIVE_UNSIGNED=1 if debian-cd supports it
# https://bugs.debian.org/896638
if grep -q ARCHIVE_UNSIGNED $BASEDIR/tools/apt-selection ; then
    export ARCHIVE_UNSIGNED=1
fi

# update the tasks files
cd $BASEDIR/tasks
for a in generate_di_list generate_di+k_list ; do
  ../tools/$a || echo "WARNING: $a failed."
done

cd $BASEDIR

# if using non-official CODENAME, create links to emulate an existing codename.
# http://bugs.debian.org/542241
if [ -n "$debian_cd_emulate_codename" ]; then
    for x in data/ tools/ tools/boot/ ; do
        link="$x/$CODENAME"
        if [ ! -e "$link" ]; then
            echo "Creating link from $debian_cd_emulate_codename to $link"
            ln -s $debian_cd_emulate_codename $link
        fi
    done
fi

echo "simple-cdd: Running debian-cd makefile"
make distclean
make status

if [ -n "$EXCLUDE" ]; then
    mv $EXCLUDE $TDIR/$CODENAME/tasks/simple-cdd.exclude
    export EXCLUDE=simple-cdd.exclude
fi

# add include files to the task
test -r "$TASK" && mv -f $TASK $TASK.bak
for i in $includes ; do
  echo '#include <'"$i"'>'
  # ensure includes exist in the appropriate place
  if [ -f "$BASEDIR/tasks/$i" ]; then
    cp $BASEDIR/tasks/$i $TDIR/$CODENAME/tasks/
  fi
done | sort -u > $TASK

# add all desired packages to the task
for p in $all_packages ; do
  echo $p
done | sort -u >> $TASK

mv $TASK $TDIR/$CODENAME/tasks/simple-cdd.task
make packagelists TASK=simple-cdd.task

# Set wget variable, which is used to download d-i daily images.
export WGET=wget

make image-trees

isolinuxcfg="$TDIR/$CODENAME/boot1/isolinux/isolinux.cfg"
if [ -f "$isolinuxcfg" ]; then
    if [ "true" = "$use_serial_console" ] && [ -n "$serial_console_speed" ]; then
        echo "SERIAL 0 $serial_console_speed 0" >> $isolinuxcfg
    fi
    if [ -n "$BOOT_TIMEOUT" ]; then
        sed -r -i -e "s,(TIMEOUT|timeout).*,TIMEOUT $BOOT_TIMEOUT,g" $isolinuxcfg
    fi
fi

# hack to ensure that vga=normal in KERNEL_PARAMS is respected, which may be
# needed to use -curses with qemu/kvm.
if [ "true" = "$vga_normal" ]; then
    sed -i -e 's,vga=788,vga=normal,g' $TDIR/$CODENAME/boot1/isolinux/*.cfg
fi

for dir in etc install ; do
    yabootconf="$TDIR/$CODENAME/CD1/$dir/yaboot.conf"
    if [ -f "$yabootconf" ]; then
        if [ -n "$KERNEL_PARAMS" ]; then
            # workaround for http://bugs.debian.org/416230
            sed -i -e "s|append=\"|append=\"$KERNEL_PARAMS |g" $yabootconf
        fi
        if [ -n "$BOOT_TIMEOUT" ]; then
            echo timeout=$BOOT_TIMEOUT >> $yabootconf
        fi
    fi
done

grubcfg="$TDIR/$CODENAME/CD1/boot/grub/grub.cfg"
if [ -f "$grubcfg" ]; then
    if [ -n "$BOOT_TIMEOUT" ]; then
        SEC_TIMEOUT=$(( $BOOT_TIMEOUT / 10 ))
        echo "set timeout=$SEC_TIMEOUT" >> $grubcfg
    fi
    # workaround for https://bugs.debian.org/884552
    if [ -n "$KERNEL_PARAMS" ]; then
        if ! grep -q "$KERNEL_PARAMS" $grubcfg ; then
            sed -i -e "s|/vmlinuz |/vmlinuz $KERNEL_PARAMS" $grubcfg
        fi
    fi
fi

extras_base_dir="$simple_cdd_temp/extras"

if [ -n "$extras_base_dir" ] && [ -d "$extras_base_dir" ]; then
  echo "purging $extras_base_dir"
  rm -rf $extras_base_dir
fi

extras_dir="$extras_base_dir/simple-cdd"
mkdir -p "$extras_dir"

# copy some build information onto the CD
mkdir -p "$extras_dir/.build-info/"
echo $commandline_opts > $extras_dir/.build-info/commandline
# TODO: copy configuration files in
for p in $profiles $build_profiles ; do
  file="$(profile_files $p conf)"
  if [ -f "$file" ]; then
    cp $file $extras_dir/.build-info/
  fi
done

all_extras="$all_extras $package_files $preseed_files $exclude_files"
# copy files to extras directory
for file in $all_extras ; do
  test -r "$file" && cp -f $file $extras_dir/
done

# FIXME: include extra mirror in extras dir.

# populate the choices file.
for p in $profiles ; do
  if [ -z "$choices" ]; then
    choices="$p"
  else
    choices="$choices,$p"
  fi
done

for p in $default_profiles ; do
  if [ -z "$default_choices" ]; then
    default_choices="$p"
  else
    default_choices="$default_choices,$p"
  fi
done

if [ -n "$profiles" ]; then
  simple_cdd_template="$(find_files simple-cdd.templates)"
  if [ ! -f "$simple_cdd_template" ]; then
    echo "ERROR: cannot find simple-cdd.templates"
    exit 1
  fi
  cat $simple_cdd_template | sed s/CHOICES/$choices/g | sed s/DEFAULTS/$default_choices/g | sed -e 's/,/, /g' > $extras_dir/simple-cdd.templates
  for p in $profiles ; do
    file="$(profile_files $p description)"
    if [ -f "$file" ]; then
      echo "including description: $file"
      echo " ." >> $extras_dir/simple-cdd.templates
      echo " $p: $(egrep -v ^# $file)" >> $extras_dir/simple-cdd.templates
    fi
  done
fi

echo simple-cdd: extra files for simple-cdd

# TODO: use the hook mechanism of debian-cd to first indicate the
# size that must be reserved and then copy the files at the appropriate time in
# the process (see RESERVED_BLOCKS_HOOK and DISC_START_HOOK).  The current
# approach can overflow the media.
cp -a $extras_base_dir/. $TDIR/$CODENAME/CD1

# check to make sure all the packages we want are present.
CHECK_MIRROR="$TDIR/$CODENAME/CD1/pool" profiles="default $build_profiles $profiles" simple_cdd_dir="$simple_cdd_dir" check_not_requested="$check_not_requested" checkpackages || exit $?

echo simple-cdd: image
make image CD=1