home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / lib / partman / auto.d / 99initial_auto
Encoding:
Text File  |  2006-08-30  |  1.2 KB  |  55 lines

  1. #!/bin/sh
  2.  
  3. . /usr/share/debconf/confmodule
  4. . /lib/partman/definitions.sh
  5.  
  6. dev_to_partman () {
  7.     local dev_name="$1"
  8.     
  9.     local mapped_dev_name="$(mapdevfs $dev_name)"
  10.     if [ -n "$mapped_dev_name" ]; then
  11.         dev_name="$mapped_dev_name"
  12.     fi
  13.  
  14.     for dev in $DEVICES/*; do
  15.         # mapdevfs both to allow for different ways to refer to the
  16.         # same device using devfs, and to allow user input in
  17.         # non-devfs form
  18.         if [ "$(mapdevfs $(cat $dev/device))" = "$dev_name" ]; then
  19.             echo $dev
  20.         fi
  21.     done
  22. }
  23.  
  24. # Do not run on S/390
  25. if [ "$(udpkg --print-architecture)" = s390 ]; then
  26.     exit 0
  27. fi
  28.  
  29. # Only run the first time
  30. if [ -f /var/lib/partman/initial_auto ]; then
  31.     exit 0
  32. fi
  33. [ -d /var/lib/partman ] || mkdir /var/lib/partman
  34. touch /var/lib/partman/initial_auto
  35.  
  36. # See if a disk to autopartition (either classic or LVM) has been set
  37. if db_get partman-auto/disk && [ -n "$RET" ]; then
  38.     disk="$RET"
  39.     id=$(dev_to_partman "$disk") || true
  40.     if [ -n "$id" ]; then
  41.         autopartition "$id"
  42.         exit 0
  43.     fi
  44. elif search-path autopartition-lvm && \
  45.      db_get partman-auto-lvm/disk && [ -n "$RET" ]; then
  46.     disk="$RET"
  47.     id=$(dev_to_partman "$disk") || true
  48.     if [ -n "$id" ]; then
  49.         autopartition-lvm "$id"
  50.         exit 0
  51.     fi
  52. fi
  53.  
  54. partman_newlayout
  55.