Restore CD architecture ########################################################

the restore CD is based on a mdv rescue CD.
it typically contains:

  data/box.XXX/lst
  data/box.XXX/hda5
  isolinux/all.rdz
  isolinux/isolinux.bin
  isolinux/isolinux.cfg
  isolinux/vmlinuz
  install/stage2/rescue.sqfs


  data/box.XXX #######################################################
  
  - lst contains the partition table and the drive geometry 
    (the format is custom, read and generated by partimage_whole_disk)
  
  - hda5 is an imagefile, a mirror of /dev/hda5
    (the format is partimage only, the idea of partimage is same as dump(8))
  
  isolinux ###########################################################
  
  - kernel and stage1 (same as standard mdv rescue)
  
  - isolinux.cfg customized to call directly save_all or rest_all
    (with option keepmounted for rest_all)
  
  install/stage2/rescue.sqfs ##########################################
  
  - compressed loopback containing a iso9660 filesystem.
    it is mostly the same as the mdv rescue.sqfs, *plus* partimage_whole_disk
    (nb : use extract_compressed_fs/create_compressed_fs to expand/create rescue.sqfs)


Mastering process ##############################################################

1. install a distribution and customize it

   nb: it's better to leave an empty space on the disk after the /home
   partition (since the restore script grows it, it's no waste) to allow
   adapting to different disk geometry without failing

2. boot on part_save_all.iso
3. "partimage_whole_disk -s hostfoo save_all /data/box" is called
   3.1. it connects to partimaged server on hostfoo
   3.2. it fins the first free /data/box.XXX
   3.3. it saves the partition table and geometry in /data/box.XXX/lst calling
        partimage with action save_file (need a patched partimage)
   3.4. it saves the devices needing to be saved calling partimage with action save.
   nb: it doesn't save swap partitions (useless)
   nb: it doesn't save ntfs/fat partitions
   nb: with option save_home_directory, the last linux partition is not saved

4. a restore CD iso is built using the data from step (3.)
5. restore CD is burned

6. restore CD booted on the target computer
7. "partimage_whole_disk rest_all /data/box.XXX" is called
   7.1. it resizes main windows partition if wanted and needed
   7.2. it gets the partition table and geometry and creates partition table
   accordingly
   7.3. it creates swap partitions if needed
   7.4. it restores linux partitions
   7.5. it creates linux partitions if wanted (esp. for /home)
   7.6. it grows the last linux partition if wanted (esp. for /home)
   7.7. it installs the bootloader (calling rescue script "install_bootloader")


Build process ##################################################################

- patched partimaged must be installed and launched
  (one gets patched partimage rpm building with option "--with jail")

- the data gets to /var/lib/partimage/data/box.XXX (owned by user partimag)

- sudo chmod a+r /var/lib/partimage/data/*/*

- in gi/rescue, call
  ./make_partimage_save_rest_all partimage-0.6.4-7mdk.i586.rpm /var/lib/partimage /data/box.XXX

  => it calls ./make_rescue_img with special options to create a special rescue.sqfs
  => generates part_save_all.iso and part_rest_all.iso