home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / lib / partman / commit.d / 50format_xfs < prev   
Encoding:
Text File  |  2006-08-30  |  2.1 KB  |  84 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/definitions.sh
  4.  
  5. enable_swap
  6.  
  7. for dev in $DEVICES/*; do
  8.     [ -d "$dev" ] || continue
  9.     cd $dev
  10.     partitions=
  11.     open_dialog PARTITIONS
  12.     while { read_line num id size type fs path name; [ "$id" ]; }; do
  13.     [ "$fs" != free ] || continue
  14.         partitions="$partitions $id,$num"
  15.     done
  16.     close_dialog
  17.     
  18.     for part in $partitions; do
  19.         id=${part%,*}
  20.         num=${part#*,}
  21.     [ -f $id/method -a -f $id/format \
  22.         -a -f $id/acting_filesystem ] || continue
  23.     filesystem=$(cat $id/acting_filesystem)
  24.     case $filesystem in
  25.         xfs)
  26.         if 
  27.             [ -f $id/formatted -a $id/formatted -nt $id/method ] \
  28.             && [ ! -f $id/filesystem \
  29.                  -o $id/formatted -nt $id/filesystem ]
  30.         then
  31.             continue
  32.         fi
  33.         log "Try to create file system for $dev/$id"
  34.         if [ -f $id/mountpoint ]; then
  35.             template=partman-basicfilesystems/progress_formatting_mountable
  36.             db_subst $template MOUNT_POINT "$(cat $id/mountpoint)"
  37.         else
  38.             template=partman-basicfilesystems/progress_formatting
  39.         fi
  40.         open_dialog PARTITION_INFO $id
  41.         read_line x1 x2 x3 x4 x5 device x6
  42.         close_dialog
  43.  
  44.         RET=''
  45.         db_metaget  partman/filesystem_short/"$filesystem" description || RET=''
  46.         [ "$RET" ] || RET="$filesystem"
  47.         db_subst $template TYPE "$RET"
  48.         db_subst $template PARTITION "$num"
  49.         db_subst $template DEVICE $(humandev $(cat device))
  50.  
  51.         db_progress START 0 3 partman/text/formatting
  52.         db_progress INFO $template
  53.         db_progress SET 1
  54.         if [ -f $id/label ]; then
  55.             label=$(cat $id/label|sed 's/\(............\).*/\1/g')
  56.         else
  57.             label=''
  58.         fi
  59.         if [ "$label" ]; then
  60.             log-output -t partman --pass-stdout mkfs.xfs -L "$label" -f $device >/dev/null
  61.             code=$?
  62.         else
  63.             log-output -t partman --pass-stdout mkfs.xfs -f $device >/dev/null
  64.             code=$?
  65.         fi
  66.         sync
  67.         db_progress STOP
  68.  
  69.         if [ "$code" != 0 ]; then
  70.             db_subst partman-xfs/create_failed PARTITION "$num"
  71.             db_subst partman-xfs/create_failed DEVICE $(humandev $(cat device))
  72.             db_input critical partman-xfs/create_failed || true
  73.             db_go || true
  74.             #disable_swap
  75.             exit 1
  76.         fi
  77.         >$id/formatted
  78.         ;;
  79.     esac
  80.     done
  81. done
  82.  
  83. #disable_swap
  84.