make getpeername() return the original socket address which before it was intercepted
[hband-tools.git] / user-tools / override / lsblk
blob0e14282027058e725fa38881dbd6c6be8d84aa08
1 #!/bin/bash
3 declare -a args=()
4 declare columns=,NAME,LABEL,MOUNTPOINT,RM,SIZE,TYPE,FSTYPE,UUID,
6 while [ $# -gt 0 ]
7 do
8 arg=$1
10 if [[ $arg =~ ^(-o|--output)$ ]]
11 then
12 shift
13 arg="$arg=$1"
16 if [[ $arg =~ ^(-o|--output=?)([-+])(.+)$ ]]
17 then
18 addremove=${BASH_REMATCH[2]}
19 cols=${BASH_REMATCH[3]}
20 for col in ${cols//,/ }
22 if [ $addremove = + ]
23 then
24 columns="$columns,$col,"
25 else
26 columns=${columns/,$col,/,}
28 done
29 elif [[ $arg =~ ^(-o|--output)=(.*)$ ]]
30 then
31 columns=${BASH_REMATCH[2]}
32 else
33 args+=("$arg")
36 shift
37 done
39 arg_o=''
40 for col in ${columns//,/ }
42 if ! grep -q ",$col," <<< "$arg_o"
43 then
44 arg_o="$arg_o,$col,"
46 done
48 arg_o=${arg_o//,,/,}
49 arg_o=${arg_o/#,}
50 arg_o=${arg_o/%,}
52 exec /bin/lsblk -o "$arg_o" "${args[@]}"