

--------------HOW TO CREATE A NEW USB KEY (CHANGE DISTRIB)----------------

mkdir /tmp/distrib
mount -o loop distrib.iso /tmp/distrib
umount /tmp/distrib

mkdir /tmp/squash
mount -o loop -t squashfs /tmp/distrib/casper/filesystem.squashfs /tmp/squash

mkdir sqfs
rsync -avx -P /tmp/squash/. sqfs/.

chroot sqfs
####################################carefull execute this in the chroot


mount -t sysfs none /sys/
mount -t proc none /proc/
export HOME=/root

nano /etc/apt/sources.list ###include universe multiverse

cat >/etc/resolv.conf <<EOF
search sibbald.com
nameserver 192.168.68.254
nameserver 208.67.222.222
nameserver 208.67.220.220
EOF

apt-get update

apt-get remove --purge `dpkg-query -W --showformat '${Package}\n' | grep language-pack | egrep -v '\-en'`

apt-get remove --purge `dpkg-query -W --showformat '${Package}\n' | grep openoffice\.org-`

apt-get remove --purge amarok dictionaries-common

apt-get upgrade

apt-get install lvm2 qemu mdadm mbr xfsprogs jfsutils hfsplus hfsutils\
 gparted xdialog dialog reiserfsprogs reiser4progs ntfsprogs ntfs-3g e2fsprogs dosfstools

apt-get install bind9-host dnsutils  linux-generic linux-headers-generic linux-image-generic   ssl-cert


apt-get install sshfs gedit lsscsi m4 mtx nfs-common   nfs-kernel-server patch \
  squashfs-tools strace sg3-utils screen scsiadd system-tools-backends   telnet dpkg \
traceroute usbutils whois autofs busybox   chkrootkit clamav dmidecode unrar

apt-get install flashplugin-nonfree aircrack-ng g++ nvidia-glx-180   gfxboot syslinux mtools

apt-get install openssh-server subversion  gftp firefox sg3-utils

apt-get remove linux-headers-2.6.28-11 linux-headers-2.6.28-11-generic \
  linux-image-2.6.28-11-generic linux-restricted-modules-2.6.28-11-generic \
  linux-restricted-modules-2.6.28-11-generic ###change kernel version 

apt-get clean

dpkg-query -W --showformat='${Package} ${Version}\n' >filesystem.manifest

rm -rf /tmp/*
rm -f /etc/hosts /etc/resolv.conf
umount /proc/
umount /sys/
history -c
exit


###reboot if proc didn't unmount
cp sqfs/boot/vmlinuz-blabla vmlinuz
cp sqfs/boot/initrd-img-blabla  initrd-img (or gz)
cp sqfs/filesystem.manifest .
rm sqfs/filesystem.manifest 
mksquashfs sqfs filesystem.squashfs
  
apt-get install isomaster ## if you don't have it

--point it to your distrib.iso

--extract /isolinux

mv isolinux syslinux
mv syslinux/isolinux.cfg syslinux/syslinux.cfg ## you can edit it to set a lower timeout (30)

--edit syslinux/text.cfg so it looks like

default live
label live
  menu label ^Bacula-rescue
  kernel /casper/vmlinuz
  append  noprompt cdrom-detect/try-usb=true persistent file=/cdrom/preseed/xubuntu.seed boot=casper initrd=/casper/initrd.img  quiet nosplash --


--note that the important bit is

 cdrom-detect/try-usb=true persistent

 --and that the initrd have the good extension

--and if your cd doesnt have casper but live change accordingly

###

--in isomaster delete the isolinux dir
--put in your new syslinux dir

--in isomaster delete everything in casper and replace with your own vmlinuz initrd filesystem.squashfs
               and filesystem.manifest

--save your work as bs-rescue-bla-bla.iso

--change the copy_bacula_to usb_stick script so it points to your iso


et voilà





