home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Linux / Ubuntu_64-bit / ubuntu-11.04-desktop-amd64.iso / casper / filesystem.squashfs / bin / autopartition next >
Text File  |  2011-01-19  |  1KB  |  46 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4. . /lib/partman/lib/recipes.sh
  5. . /lib/partman/lib/auto-shared.sh
  6.  
  7. devs="$1"
  8.  
  9. clean_method
  10.  
  11. for dev in $devs; do
  12.     cd $dev
  13.  
  14.     [ -f size ] || exit 1
  15.     size=$(cat size)
  16.     target="$(humandev $(cat device)) - $(cat model)"
  17.  
  18.     if [ -z "$2" ]; then
  19.         # Only one parameter. Being run for initial autopartitioning.
  20.         target="$target: $(longint2human $size)"
  21.         free_size=$(convert_to_megabytes $size)
  22.  
  23.         choose_recipe default "$target" "$free_size" || exit $?
  24.  
  25.         auto_init_disks "$dev" || exit $?
  26.         get_last_free_partition_infos $dev
  27.     else
  28.         # Two parameters, being run on selected free space.
  29.         free_space=$2
  30.  
  31.         open_dialog PARTITION_INFO $free_space
  32.         read_line x1 x2 free_size x3 x4 x5 x6
  33.         close_dialog
  34.  
  35.         target="$target: $(longint2human $free_size) ($(longint2human $size))"
  36.         free_size=$(convert_to_megabytes $free_size)
  37.  
  38.         choose_recipe default "$target" "$free_size" || exit $?
  39.     fi
  40.  
  41.     perform_recipe $dev $free_space $recipe || exit $?
  42. done
  43.  
  44. # default to accepting the autopartitioning
  45. menudir_default_choice /lib/partman/choose_partition finish finish || true
  46.