home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / lib / partman / commit.d / 50format_reiserfs < prev    next >
Encoding:
Text File  |  2006-08-30  |  2.5 KB  |  99 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.         reiserfs)
  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.         status=failed
  52.         # Trying to use parted will probably fail; parted doesn't
  53.         # support reiser currently.
  54.          name_progress_bar $template
  55.          open_dialog CREATE_FILE_SYSTEM $id reiserfs
  56.          read_line status
  57.          close_dialog
  58.         sync
  59.         if [ "$status" != OK ]; then
  60.             db_progress START 0 3 partman/text/formatting
  61.             db_progress INFO $template
  62.             db_progress SET 1
  63.  
  64.             if [ -f $id/label ]; then
  65.             label=$(cat $id/label|sed 's/\(................\).*/\1/g')
  66.             else
  67.             label=''
  68.             fi
  69.             if [ "$label" ]; then
  70.             log-output -t partman --pass-stdout mkfs.reiserfs -l "$label" -f -q $device >/dev/null
  71.             code=$?
  72.             else
  73.             log-output -t partman --pass-stdout mkfs.reiserfs -f -q $device >/dev/null
  74.             code=$?
  75.             fi
  76.             if [ "$code" = 0 ]; then
  77.             sync
  78.             status=OK
  79.             else
  80.             status=failed
  81.             fi
  82.             db_progress STOP
  83.         fi
  84.         if [ "$status" != OK ]; then
  85.             db_subst partman-reiserfs/create_failed PARTITION "$num"
  86.             db_subst partman-reiserfs/create_failed DEVICE $(humandev $(cat device))
  87.             db_input critical partman-reiserfs/create_failed || true
  88.             db_go || true
  89.             #disable_swap
  90.             exit 1
  91.         fi
  92.         >$id/formatted
  93.         ;;
  94.     esac
  95.     done
  96. done
  97.  
  98. #disable_swap
  99.