home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / lib / partman / commit.d / 50format_efi < prev    next >
Encoding:
Text File  |  2009-04-19  |  1.6 KB  |  70 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/lib/base.sh
  4.  
  5. ARCH="$(archdetect)"
  6. case $ARCH in
  7.     i386/*|amd64/*|lpia/*)
  8.     new_efi_fs=fat32
  9.     ;;
  10.     *)
  11.     new_efi_fs=fat16
  12.     ;;
  13. esac
  14.  
  15. enable_swap
  16. for dev in $DEVICES/*; do
  17.     [ -d "$dev" ] || continue
  18.     cd $dev
  19.     partitions=
  20.     open_dialog PARTITIONS
  21.     while { read_line num id size type fs path name; [ "$id" ]; }; do
  22.         [ "$fs" != free ] || continue
  23.         partitions="$partitions $id,$num"
  24.     done
  25.     close_dialog
  26.  
  27.     for part in $partitions; do
  28.         id=${part%,*}
  29.         num=${part#*,}
  30.         [ -f $id/method -a -f $id/format ] || continue
  31.         method=$(cat $id/method)
  32.         if [ "$method" = efi ]; then
  33.             if [ -f $id/formatted ] && \
  34.                [ $id/formatted -nt $id/method ]; then
  35.                 continue
  36.             fi
  37.             log "Try to format EFI $new_efi_fs fs in $dev/$id"
  38.             template=partman-basicfilesystems/progress_formatting
  39.             open_dialog PARTITION_INFO $id
  40.             read_line x1 x2 x3 x4 x5 device x6
  41.             close_dialog
  42.  
  43.             RET=''
  44.             db_metaget  partman/filesystem_short/efi description || RET=''
  45.             [ "$RET" ] || RET=efi
  46.             db_subst $template TYPE "$RET"
  47.             db_subst $template PARTITION "$num"
  48.             db_subst $template DEVICE $(humandev $(cat device))
  49.             name_progress_bar $template
  50.             open_dialog CREATE_FILE_SYSTEM $id $new_efi_fs
  51.             read_line status
  52.             close_dialog
  53.             sync
  54.  
  55.             if [ "$status" != OK ]; then
  56.                 db_subst partman-basicfilesystems/create_failed TYPE efi
  57.                 db_subst partman-basicfilesystems/create_failed PARTITION "$num"
  58.                 db_subst partman-basicfilesystems/create_failed DEVICE $(humandev $(cat device))
  59.                 db_input critical partman-basicfilesystems/create_failed || true
  60.                 db_go || true
  61.                 #disable_swap
  62.                 exit 1
  63.             fi
  64.             >$id/formatted
  65.         fi
  66.     done
  67. done
  68.  
  69. #disable_swap
  70.