home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / lib / partman / update.d / 21efi_sync_flag < prev    next >
Encoding:
Text File  |  2009-04-19  |  1.4 KB  |  72 lines

  1. #!/bin/sh
  2.  
  3. # This script removes the efi flag for partitions whose method is not
  4. # efi and sets it for partition whose method is efi
  5.  
  6. [ -e /var/lib/partman/efi ] || exit 0
  7.  
  8. . /lib/partman/lib/base.sh
  9.  
  10. dev=$1
  11. num=$2
  12. id=$3
  13. size=$4
  14. type=$5
  15. fs=$6
  16. path=$7
  17. shift; shift; shift; shift; shift; shift; shift
  18. name=$*
  19.  
  20. cd $dev
  21.  
  22. if [ $fs = free ]; then
  23.     exit 0
  24. fi
  25.  
  26. method=
  27. if [ -f $id/method ]; then
  28.     method=$(cat $id/method)
  29. fi
  30.  
  31. flags=''
  32. open_dialog GET_FLAGS $id
  33. while { read_line flag; [ "$flag" ]; }; do
  34.     if [ "$flag" != boot ]; then
  35.         flags="${flags:+$flags$NL}$flag"
  36.     fi
  37. done
  38. close_dialog
  39.  
  40. open_dialog USES_NAMES
  41. read_line uses_names
  42. close_dialog
  43.  
  44. if [ "$method" = efi ] && [ ! -f $id/bootable ]; then
  45.     open_dialog SET_FLAGS $id
  46.     write_line "$flags"
  47.     write_line boot
  48.     write_line NO_MORE
  49.     close_dialog
  50.     >$id/bootable
  51.     >$id/efi_bootable
  52.     if [ "$uses_names" = yes ] && [ "$fs" = fat32 ]; then
  53.         open_dialog SET_NAME $id "EFI System Partition"
  54.         close_dialog
  55.     fi
  56.     RET=''
  57. elif [ "$method" != efi ] && [ -f $id/bootable ] && \
  58.      [ -f $id/efi_bootable ]; then
  59.     open_dialog SET_FLAGS $id
  60.     write_line "$flags"
  61.     write_line NO_MORE
  62.     close_dialog
  63.     rm $id/bootable
  64.     rm $id/efi_bootable
  65.     if [ "$uses_names" = yes ] && [ "$fs" = fat32 ] && \
  66.        [ "$name" = "EFI System Partition" ]; then
  67.         # should be empty, but see http://bugs.debian.org/268495
  68.         open_dialog SET_NAME "unnamed"
  69.         close_dialog
  70.     fi
  71. fi
  72.