]> git.ipfire.org Git - ipfire-2.x.git/blame - src/scripts/scanhd
suricata: Change midstream policy to "pass-flow"
[ipfire-2.x.git] / src / scripts / scanhd
CommitLineData
aa2870e6 1#!/bin/bash
66c36198
PM
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
aa2870e6
MT
22case "$1" in
23 ide)
44fb4038
AF
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
aa2870e6
MT
32 ;;
33 partitions)
2e67687f 34 cat /proc/partitions | awk '{print $4 " " $3 }' | grep -v name | grep -v "^[[:space:]]*$" | \
784d72a2
MT
35 while read device size; do
36 [ -z "${device}" ] && continue
15834b62 37 echo "${device};${size};$(blkid -c /dev/null -s UUID -o value /dev/${device});"
784d72a2 38 done > /var/ipfire/extrahd/partitions
aa2870e6
MT
39 ;;
40 *)
41 echo "Usage: $0 (ide|partitions)"
42 ;;
43esac