@@ -8,7 +8,7 @@ function getConfigSection() {
88 grep -A64 -Ex " ^\[$1 \]$" ~ /.config/mnt/config.ini | grep -Ex " ^[^#;].*=.*$" | sed " s/ *= */=/g"
99 else
1010 grep -A64 -Ex " ^\[$1 \]$" ~ /.config/mnt/config.ini |
11- grep -B64 -Ex " ^\[[^${1: 0: 1} ].*\]$" | grep -Ex " ^[^#;].*=.*$" |
11+ grep -B64 -Ex " ^\[[^${1: 0: 1} ].*\]$" -m1 | grep -Ex " ^[^#;].*=.*$" |
1212 sed " s/ *= */=/g"
1313 fi
1414}
@@ -19,6 +19,7 @@ IFS=$'\n' # Only new-line charachter is separator
1919
2020declare -A assoc # Associative array with parts labels
2121declare -A parts # Array with disks parts
22+ declare ignore # Array with ignored disks
2223
2324# Create or touch config file
2425mkdir ~ /.config/mnt/ -p # Create config directory if it doesn't exists
@@ -27,11 +28,23 @@ touch ~/.config/mnt/config.ini # Create config file if it doesn't exists
2728# Get associations for part labels
2829for var in $( getConfigSection associations)
2930do
30- name1 =$( echo $var | awk -F ' =' ' {print $1}' )
31- name2 =$( echo $var | awk -F ' =' ' {print $2}' )
31+ label1 =$( echo $var | awk -F ' =' ' {print $1}' )
32+ label2 =$( echo $var | awk -F ' =' ' {print $2}' )
3233
3334 # Make asociations
34- assoc[$name1 ]=$name2
35+ assoc[$label1 ]=$label2
36+ done
37+
38+ # Get list of ignored disks
39+ for var in $( getConfigSection display)
40+ do
41+ label=$( echo $var | awk -F ' =' ' {print $1}' )
42+ state=$( echo $var | awk -F ' =' ' {print $2}' )
43+
44+ if [[ $state == " OFF" ]]
45+ then
46+ ignore+=($label )
47+ fi
3548done
3649
3750# Get /dev/name and label of parts
4053 dev=$( echo $var | awk ' {print $1}' )
4154 label=$( echo $var | awk ' {$1=""; print $0}' | sed -r ' s/^ *| *$//g' )
4255
43- parts[$label ]=$dev
56+ if [[ ${ignore[*]} != * $label * ]]
57+ then
58+ parts[$label ]=$dev
59+ fi
4460done
4561
4662# Get the list of disks in the required form
0 commit comments