]> git.ipfire.org Git - ipfire-2.x.git/blob - src/scripts/scanhd
suricata: Change midstream policy to "pass-flow"
[ipfire-2.x.git] / src / scripts / scanhd
1 #!/bin/bash
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 case "$1" in
23 ide)
24 rm -f /var/ipfire/extrahd/scan
25 for DEV in `find /sys/block/* -maxdepth 0 ! -name sr* ! -name ram* ! -name loop* -exec basename {} \; | sort | uniq`
26 do
27 VENDOR=`cat /sys/block/$DEV/device/vendor 2>/dev/null`
28 MODEL=`cat /sys/block/$DEV/device/model 2>/dev/null`
29 REV=`cat /sys/block/$DEV/device/rev 2>/dev/null`
30 echo "$DEV;$VENDOR $MODEL $REV" >> /var/ipfire/extrahd/scan
31 done
32 ;;
33 partitions)
34 cat /proc/partitions | awk '{print $4 " " $3 }' | grep -v name | grep -v "^[[:space:]]*$" | \
35 while read device size; do
36 [ -z "${device}" ] && continue
37 echo "${device};${size};$(blkid -c /dev/null -s UUID -o value /dev/${device});"
38 done > /var/ipfire/extrahd/partitions
39 ;;
40 *)
41 echo "Usage: $0 (ide|partitions)"
42 ;;
43 esac