Debian Codegraph @

tools/boot/bookworm/boot-kfreebsd-common

raw
1 # This script gets sourced from boot-kfreebsd-i386 and boot-kfreebsd-amd64.
2 #
3 # Do install stuff for kfreebsd, including making bootable CDs
4 # Works with debian-installer
5 #
6 # $1 is the CD number
7 # $2 is the temporary CD build dir
8
9 . $BASEDIR/tools/boot/$DI_CODENAME/common.sh
10 . $BASEDIR/tools/boot/$DI_CODENAME/x86-desktop.sh
11
12 set -e
13 #set -x
14
15 N=$1
16 CDDIR=$2
17 INSTALLDIR="install"
18
19 # Common options for all disks
20 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
21 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
22 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l"
23
24 # Exit if this is not CD#1/DVD#1
25 if [ $N != "1" ]; then
26 exit 0
27 fi
28
29 if [ "$DI_WWW_HOME" = "default" ]; then
30 # Tempting as it might be to merge these two definitions using $ARCH,
31 # do *not* do that - these defs are parsed out by other scripts that
32 # won't cope with that
33 if [ "$ARCH" = kfreebsd-i386 ]; then
34 DI_WWW_HOME="https://d-i.debian.org/daily-images/kfreebsd-i386/daily/"
35 elif [ "$ARCH" = kfreebsd-amd64 ]; then
36 DI_WWW_HOME="https://d-i.debian.org/daily-images/kfreebsd-amd64/daily/"
37 else
38 echo "$0: unknown arch $ARCH; abort"
39 exit 1
40 fi
41 try_di_image_cache
42 else
43 DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,")
44 fi
45
46 case "$MKISOFS" in
47 *xorriso*)
48 XORRISO_VER=$(xorriso_version)
49 ;;
50 *)
51 echo "ERROR: debian-cd now depends on xorriso for making x86 bootable CDs."
52 exit 1;
53 ;;
54 esac
55
56 cd $CDDIR/..
57
58 # Download boot images.
59 BOOT_IMAGES="cdrom/debian-cd_info.tar.gz cdrom/kfreebsd-10.gz cdrom/initrd.gz"
60
61 if [ "$ARCH" = kfreebsd-amd64 ]; then
62 BOOT_IMAGES="$BOOT_IMAGES cdrom/gtk/initrd.gz"
63 fi
64
65 for image in $BOOT_IMAGES; do
66 if [ ! -e "$image" ]; then
67 dir=$(dirname $image)
68 mkdir -p $dir
69 if [ ! "$DI_WWW_HOME" ];then
70 if [ ! "$DI_DIR" ];then
71 DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
72 fi
73 cp "$DI_DIR/$image" $image || true
74 else
75 $WGET "$DI_WWW_HOME/$image" -O $image
76 fi
77 fi
78 done
79
80 # Install kernel and initrd
81 mkdir -p $CDDIR/boot/kernel/
82 if [ -f cdrom/kfreebsd-10.gz ] ; then
83 cp "cdrom/kfreebsd-10.gz" "$CDDIR/boot/kernel/kfreebsd-10.gz"
84 fi
85 cp "cdrom/initrd.gz" "$CDDIR/boot/mfsroot.gz"
86
87 if [ "$ARCH" = kfreebsd-amd64 ] && [ -f cdrom/gtk/initrd.gz ] ; then
88 mkdir -p $CDDIR/boot/gtk/
89 cp "cdrom/gtk/initrd.gz" "$CDDIR/boot/gtk/mfsroot.gz"
90 fi
91
92 # Install bootloader
93 mkdir -p boot$N
94 tar -C boot$N -zxf cdrom/debian-cd_info.tar.gz
95 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-b boot/grub/grub_eltorito"
96 [ -f boot$N/boot/grub/grub_embed ] && add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "--embedded-boot boot$N/boot/grub/grub_embed"
97 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-c boot/boot.cat"
98 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-no-emul-boot"
99
100 bls=4 # Specify 4 for BIOS boot, don't calculate it
101 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-load-size $bls"
102 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-info-table"
103 add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
104 add_mkisofs_opt $CDDIR/../$N.mkisofs_dirs "boot$N"
105
106 # Add autorun
107 if [ -f $CDDIR/README.html ]; then
108 todos > $CDDIR/autorun.inf <<EOF
109 [autorun]
110 open=autorun.bat
111 label=Install Debian GNU/kFreeBSD
112 EOF
113 todos > $CDDIR/autorun.bat <<EOF
114 @echo Starting "README.html"...
115 @start README.html
116 @exit
117 EOF
118 fi
119
120 # Cleanup
121 rm -rf cdrom
122
123 # done