home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / lib / partman / check.d / 05proper_mountpoints < prev    next >
Encoding:
Text File  |  2007-04-12  |  1.2 KB  |  64 lines

  1. #!/bin/sh
  2.  
  3. . /lib/partman/definitions.sh
  4.  
  5. # At least one file system to mount on /
  6. no_root () {
  7.     mountpoints=$(
  8.     for i in /lib/partman/fstab.d/*; do
  9.         [ -x "$i" ] || continue
  10.         $i
  11.     done | 
  12.     while read fs mp type options dump pass; do
  13.         echo $mp
  14.     done
  15.     )
  16.     
  17.     for mp in $mountpoints; do
  18.     if [ "$mp" = / ]; then
  19.         return 0
  20.     fi
  21.     done
  22.     
  23.     db_input critical partman-target/no_root || true
  24.     db_go || true
  25.     exit 1
  26. }
  27.  
  28. # No two file systems with one and the same mount point
  29. same_mountpoints () {
  30.     mountpoints=$(
  31.     for i in /lib/partman/fstab.d/*; do
  32.         [ -x "$i" ] || continue
  33.         $i
  34.     done | 
  35.     while read fs mp type options dump pass; do
  36.         case "$mp" in
  37.         (/*)
  38.             echo $mp,$fs;;
  39.         esac
  40.     done |
  41.     sort
  42.     )
  43.     
  44.     oldmp=' '
  45.     for x in $mountpoints; do
  46.     mp=${x%,*}
  47.     fs=${x#*,}
  48.     if [ "$mp" = "$oldmp" ]; then
  49.         db_subst partman-target/same_mountpoint PART1 $(humandev $oldfs)
  50.         db_subst partman-target/same_mountpoint PART2 $(humandev $fs)
  51.         db_subst partman-target/same_mountpoint MOUNTPOINT "$mp"
  52.         db_input critical partman-target/same_mountpoint || true
  53.         db_go || true
  54.         exit 1
  55.     else
  56.         oldmp="$mp"
  57.         oldfs="$fs"
  58.     fi
  59.     done
  60. }
  61.  
  62. no_root
  63. same_mountpoints
  64.