Advertisement
Guest User

check_disk.sh

a guest
Jul 9th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.07 KB | None | 0 0
  1. #!/bin/sh
  2. #
  3. # This is run by d-i before the partman step (e.g. d-i partman/early_command)
  4.  
  5. #MIN_DISK_SIZE=20000000
  6.  
  7. youlose() {  
  8.   echo ""
  9.   echo "****************************"
  10.   echo "ERROR: $@"
  11.   echo "Installation cannot proceed. Press any key to reboot."
  12.   read foo
  13.   echo "Rebooting, please wait..."
  14.   reboot
  15. }
  16.  
  17. # Unmount partitions because partman and d-i are incompetent.
  18. # http://ubuntuforums.org/showthread.php?t=2215103&p=12977473
  19. # LP: 1355845
  20. for p in $(list-devices partition); do
  21.   umount "$p" || true
  22. done
  23.  
  24.  
  25. disks=$(list-devices disk)
  26.  
  27. if ! echo "$disks" | grep -q ^/dev; then
  28.   youlose "No disks found."
  29. fi
  30.  
  31. for dsk in $disks
  32. do
  33.     echo $dsk  "$(sfdisk -s "$dsk")"
  34.     #if [ "$(sfdisk -s "$dsk")" -lt $MIN_DISK_SIZE ]; then
  35.     #  youlose "Your disk is too small ($(( $MIN_DISK_SIZE / 1000000)) GB required)."
  36.     #fi
  37. done
  38.  
  39. read -p "Ingrese el disco a usar: " opt
  40.  
  41. #chvt 5
  42. # Steal STDIN and STDOUT back from the installer
  43. exec < /dev/tty1 > /dev/tty1 2>&1
  44.  
  45. # Tell partman which disk to use
  46. debconf-set partman-auto/disk "$opt"
  47.  
  48. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement