~tsimonq2/debian-cd/lubuntu-cosmic-changes

709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
1
#!/bin/sh
2
3
# This script tries to get good estimations into the .calc files at
1049 by Colin Watson
Add subarchitecture support
4
# boot/$CODENAME/boot-$FULLARCH.calc, so you can use it whenever you want to
709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
5
# update these .calc files with more recent estimations.
6
1049 by Colin Watson
Add subarchitecture support
7
# It uses info taken from the temporary dir of a previous build for $FULLARCH,
709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
8
# $CODENAME. This doesn't need to be a full build, you can get the needed
9
# stuff by running a build.sh with something like:
10
# IMAGETARGET="ok bootable upgrade bin-infos bin-list"
11
12
# Temporary directory of the previous build.
1049 by Colin Watson
Add subarchitecture support
13
BDIR="$TDIR/$CODENAME-$FULLARCH"
709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
14
15
#Get info from older build if it exists
16
if [ -d "$BDIR" ];
17
then
18
  echo Estimated sizes:
1049 by Colin Watson
Add subarchitecture support
19
  rm -f "boot/$CODENAME/boot-$FULLARCH.calc"
709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
20
  for i in `du -sm "$BDIR"/CD[0123456789]* |
21
              sed -n 's/^\([0-9]\+\).*CD\([0-9]\+\)/\2=\1/p'`
22
  do
23
    #space used by boot images in megs (this has an error of up to a mega)
24
    if [ -d "$BDIR/boot${i%=*}" ]
25
    then
26
      imgdu=`du -sm "$BDIR/boot${i%=*}" |
27
               sed -n 's/^\([0-9]\+\).*/\1/p'`
28
    else
29
      imgdu=1
30
    fi
31
    #add it all up and write it to the .calc file
32
    echo BOOT_SIZE_${i%=*}=${i#*=}+$imgdu
1049 by Colin Watson
Add subarchitecture support
33
    echo BOOT_SIZE_${i%=*}=$((${i#*=}+$imgdu)) >> "boot/$CODENAME/boot-$FULLARCH.calc"
34
    case "$FULLARCH" in
35
      m68k)	echo SIZE_MULT_${i%=*}=97 >> "boot/$CODENAME/boot-$FULLARCH.calc";;
709 by Arch Librarian
Add tools/calc script to update .calc files with up to ...
36
    esac
37
  done
38
fi
721 by Arch Librarian
- Update debian-installer's tasks.
39
40
#Use different corrections depending on the size of the ISO
41
if [ -n "$SIZELIMIT1" ] && [ "$SIZELIMIT1" -gt 1000000000 ] || 
42
   [ -n "$SIZELIMIT" ] && [ "$SIZELIMIT" -gt 1000000000 ] ||
43
   [ -n "$DEFBINSIZE" ] && [ "$DEFBINSIZE" -gt 1000 ]
44
then
1049 by Colin Watson
Add subarchitecture support
45
  case "$FULLARCH" in
46
    powerpc)     echo SIZE_MULT_1=92 >> "boot/$CODENAME/boot-$FULLARCH.calc";;
721 by Arch Librarian
- Update debian-installer's tasks.
47
  esac
48
else
1049 by Colin Watson
Add subarchitecture support
49
  case "$FULLARCH" in
50
    powerpc)     echo SIZE_MULT_1=96 >> "boot/$CODENAME/boot-$FULLARCH.calc";;
721 by Arch Librarian
- Update debian-installer's tasks.
51
  esac
52
fi