home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / lib / partman / active_partition / 45ext3 / choices next >
Encoding:
Text File  |  2006-08-30  |  2.5 KB  |  109 lines

  1. #!/bin/sh
  2.  
  3. . /usr/share/debconf/confmodule
  4.  
  5. set -e
  6.  
  7. dev=$1
  8. id=$2
  9. part=$dev/$id
  10.  
  11. cd $dev
  12.  
  13. [ -f $part/method -a -f $part/acting_filesystem ] || exit 0
  14.  
  15. filesystem=$(cat $part/acting_filesystem)
  16.  
  17. case "$filesystem" in
  18.     ext3)
  19.     :
  20.     ;;
  21.     *)
  22.     exit 0
  23.     ;;
  24. esac
  25.  
  26. choice_mountpoint () {
  27.     if [ -f $part/mountpoint ]; then
  28.     mp=$(cat $part/mountpoint)
  29.     else
  30.     db_metaget partman-basicfilesystems/text/no_mountpoint description
  31.     mp="$RET"
  32.     fi
  33.     db_metaget partman-ext3/text/specify_mountpoint description
  34.     RET=$(stralign -25 "$RET")
  35.     printf "mountpoint\t%s%s\n" "$RET" "$mp"
  36. }
  37.  
  38. choice_options () {
  39.     db_metaget partman-basicfilesystems/text/options description
  40.     RET=$(stralign -25 "$RET")
  41.     printf "options\t%s%.45s\n" "$RET" "$(get_mountoptions $dev $id)"
  42. }
  43.  
  44. choice_label () {
  45.     # allow to set label only if the partition is to be formatted
  46.     [ -f $part/format ] || return 0
  47.     [ ! -f $part/formatted \
  48.       -o $part/formatted -ot $part/method \
  49.       -o $part/formatted -ot $part/filesystem ] || return 0
  50.     case "$filesystem" in
  51.     ext3)
  52.         if [ -f $part/label ]; then
  53.         label=$(cat $part/label)
  54.         else
  55.         db_metaget partman-basicfilesystems/text/none description
  56.         label=$RET
  57.         fi
  58.         db_metaget partman-basicfilesystems/text/specify_label description
  59.         RET=$(stralign -25 "$RET")
  60.         printf "label\t%s%s\n" "$RET" "$label"
  61.         ;;
  62.     esac
  63. }
  64.  
  65. choice_reserved () {
  66.     local reserved
  67.     # allow to set reserved space only if the partition is to be formatted
  68.     [ -f $part/format ] || return 0
  69.     [ ! -f $part/formatted \
  70.       -o $part/formatted -ot $part/method \
  71.       -o $part/formatted -ot $part/filesystem ] || return 0
  72.     if [ -f $part/reserved_for_root ]; then
  73.     reserved=$(cat $part/reserved_for_root)
  74.     else
  75.     reserved=5
  76.     fi
  77.     db_metaget partman-basicfilesystems/text/reserved_for_root description
  78.     RET=$(stralign -25 "$RET")
  79.     printf "reserved_for_root\t%s%s\n" "$RET" "$reserved%"
  80. }
  81.  
  82. choice_usage () {
  83.     local usage
  84.     # allow to set usage only if the partition is to be formatted
  85.     [ -f $part/format ] || return 0
  86.     [ ! -f $part/formatted \
  87.       -o $part/formatted -ot $part/method \
  88.       -o $part/formatted -ot $part/filesystem ] || return 0
  89.     if [ -f $part/usage ]; then
  90.     usage=$(cat $part/usage)
  91.     else
  92.     db_metaget partman-basicfilesystems/text/typical_usage description
  93.     usage=$RET
  94.     fi
  95.     db_metaget partman-basicfilesystems/text/usage description
  96.     RET=$(stralign -25 "$RET")
  97.     printf "usage\t%s%s\n" "$RET" "$usage"
  98. }
  99.  
  100. choice_mountpoint
  101.  
  102. choice_options
  103.  
  104. choice_label
  105.  
  106. choice_reserved
  107.  
  108. choice_usage
  109.