]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - src/install+setup/install/mountdest.sh
Merge branch 'iptables-upnpfw' into core67-merge
[ipfire-2.x.git] / src / install+setup / install / mountdest.sh
index 749d4fa5e8df8ee10280eae4d7f07dcb1756d031..e28a0689bd1c5a98e3bd8c81a1478bedb2fa17d0 100644 (file)
@@ -1,7 +1,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2012  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2013  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -72,34 +72,63 @@ for path in /sys/block/*; do
                fd*)
                        continue
                        ;;
+               # Cd/Tape.
+               sr*)
+                       continue
+                       ;;
        esac
 
        # Replace any exclamation marks (e.g. cciss!c0d0).
-       device=${device//!/\/}
+       device_=${device//!/\/}
 
        # Guess if this could be a raid device.
-       for dev in ${device} ${device}p1; do
+       for dev in ${device_} ${device_}p1; do
                if [ -e "/dev/${dev}" ]; then
                        device=${dev}
                        break
                fi
        done
 
-       echo "Checking ${device}"
-       if check_source_drive ${device}; then
+       # Check if user want skip by commandline
+       if [ "$(grep "skipdst=${device_}" /proc/cmdline)" ]; then
+               echo "${device_} was skipped via cmdline."
+               continue
+       fi
+
+       echo "Checking ${device_}"
+       if check_source_drive ${device_}; then
                echo "  is source drive - skipping"
                continue
        fi
 
+       device_size=$(cat /sys/block/${device}/size)
+       if [ "${device_size}" = "0" ]; then
+               echo "  is empty - skipping"
+               continue
+       fi
+
        # Found it.
        echo "  OK, this is it..."
-       echo -n "${device}" > /tmp/dest_device
+       echo -n "${device_}" > /tmp/dest_device
+
+       # Disk size to GiB.
+       device_size=$(( ${device_size} / 2097152 ))
+
+       # Build string with drive details
+       device_str="/dev/${device_} - ${device_size} GiB -"
+       device_str="${device_str} $(cat /sys/block/${device}/device/vendor)"
+       device_str="${device_str} $(cat /sys/block/${device}/device/model)"
+
+       # Remove all whitespace.
+       device_str=$(echo ${device_str})
+
+       echo -n "${device_str}" > /tmp/dest_device_info
 
        # Exit code table:
        #  1: sda
        #  2: RAID
        # 10: nothing found
-       case "${device}" in
+       case "${device_}" in
                *p1|*c0d0)
                        exit 2
                        ;;