2 # Makefile for building a Bacula Rescue CDROM or remastering
3 # a CDROM or ISO image adding the Bacula files.
8 CWD=@BUILD_DIR@/linux/cdrom
13 #-------------------------------------------------------------------------
15 # Make an iso boot image
18 mkisofs -A "Bacula Rescue Disk" -V "Bacula Rescue Disk" \
19 -J -R -T -o bootcd.iso \
20 -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
21 -no-emul-boot -boot-load-size 4 -boot-info-table cdtree
26 mkisofs -A "Bacula Rescue Disk" -V "Bacula Rescue Disk" \
27 -J -R -T -o bootcd.iso \
28 -b isolinux/isolinux.bin -c isolinux/boot.cat \
29 -no-emul-boot -boot-load-size 4 -boot-info-table cdimage
33 makecdimage --type=@type@ --where=@where@
36 # try booting it with qemu emulator
38 qemu -cdrom bootcd.iso
50 @(cd bacula; make copy-static-fd)
56 cp -a bacula/ cdimage/
60 # This will build the Bacula rescue
61 all: kernel binaries bacula initrd iso
64 copy-static-fd: kernel binaries static-bacula initrd iso
67 # This needs to be customized for your burner.
68 # Use either dev=ATA:x,y,z (as reported by cdrecord -scanbus)
69 # or dev=/dev/<device> (e.g. hdc)
71 cdrecord dev=@DEV@ gracetime=2 fs=4096k driveropts=burnfree -v \
72 -useinfo speed=48 -dao -eject -pad -data "bootcd.iso"
74 # Blank the CDROM assuming it is +rw
76 cdrecord dev=@DEV@ gracetime=2 -v blank=fast -useinfo speed=48
84 # Clean out files that are rebuilt
86 @rm -f bootcd.iso custom-rd.img.bz2
89 @rm -rf roottree/bin roottree/proc roottree/boot
90 @rm -rf roottree/lib roottree/sbin roottree/dev
91 @rm -rf roottree/dev roottree/sys roottree/sysroot
92 @rm -rf roottree/sys roottree/usr
93 @rm -rf roottree/initrd roottree/cdrom roottree/mnt
94 @rm -rf roottree/tmp roottree/var
95 @rm -f roottree/etc/services roottree/etc/exports
96 @rm -f roottree/etc/gshadow roottree/etc/shadow
97 @rm -f roottree/etc/passwd roottree/etc/group
98 @rm -f roottree/etc/hosts roottree/etc/bashrc
99 @rm -f roottree/etc/filesystems roottree/etc/fstab
100 @rm -f roottree/etc/protocols roottree/etc/localtime
101 @rm -f roottree/etc/ld.so.cache
102 @rm -f roottree/etc/modules.conf roottree/etc/syslog.conf
103 @rm -rf roottree/etc/pam.d roottree/etc/ssh
104 @rm -rf roottree/etc/security roottree/etc/init.d
105 @rm -rf roottree/etc/rc.d
106 @rm -rf roottree/etc/udev roottree/etc/modprobe.conf
107 @rm -rf roottree/etc/dev.d roottre/etc/hotplug roottree/etc/modprobe.d
108 @rm -rf roottree/etc/modprobe.conf.local roottree/etc/hotplug
109 @rm -rf roottree/etc/sysconfig roottree/etc/syslog-ng
110 @rm -rf roottree/bacula-*
111 @rm -f cdtree/boot/isolinux/initrd.img
112 @rm -f cdtree/boot/isolinux/isolinux.cfg
113 @rm -f cdtree/boot/isolinux/vmlinuz
114 @rm -f cdtree/boot/isolinux/map
115 @(cd bacula; make distclean)
116 # @(cd ${MKCDREC}; make clean)
117 # @(cd ${MKCDREC}/busybox; make distclean)
121 # This was the integration with mkcdrec, but I could never
122 # get it to work reliably.
124 MKCDREC=@BUILD_DIR@/mkcdrec
125 mkcdrec: kernel binaries bacula pre-mkcdrec main-mkcdrec post-mkcdrec
129 @echo "Patching mkcdrec Config.sh for Bacula"
131 @rm -f tmp/1 tmp/2 tmp/1
132 @cp ${MKCDREC}/Config.sh tmp/2
133 @echo "s%^BACULA_DIR.*$$%BACULA_DIR=${CWD}/bacula%g" >tmp/1
134 @sed -f tmp/1 tmp/2 >tmp/3
135 @echo "s%^BACULA_RESTORE.*$$%BACULA_RESTORE=\"y\"%g" >tmp/1
136 @sed -f tmp/1 tmp/3 >tmp/4
137 @echo "s%^DVD_Drive.*$$%DVD_Drive=0%g" >tmp/1
138 @sed -f tmp/1 tmp/4 >tmp/5
139 @echo "s%^USECOLOR.*$$%USECOLOR=n%g" >tmp/1
140 @sed -f tmp/1 tmp/5 >${MKCDREC}/Config.sh
142 @cp -f @BACULA_BIN@/bacula-fd bacula/bin
143 @cp -f @BACULA_SCRIPTS@/bacula-fd.conf bacula/bin
147 @echo "Doing make in mkcdrec directory. This may take some time and"
148 @echo " produce a good amount of output"
151 (cd ${MKCDREC}; make rescue)
155 cp /tmp/CDrec.iso bootcd.iso
158 rm -f custom-rd.img.bz2