|
157 | 157 | fi
|
158 | 158 | fi
|
159 | 159 |
|
| 160 | + # Extract SnapRAID info (content and parity files) from the config file |
| 161 | + extract_snapraid_info |
160 | 162 |
|
161 | 163 | # sanity check first to make sure we can access the content and parity files
|
162 | 164 | mklog "INFO: Checking SnapRAID disks"
|
@@ -1110,7 +1112,6 @@ result=$?
|
1110 | 1112 | if [ $result -eq 0 ]; then
|
1111 | 1113 | # Only one SnapRAID config file found, proceeding
|
1112 | 1114 | echo "Proceeding with the omv-snapraid-.conf file: $SNAPRAID_CONF"
|
1113 |
| - |
1114 | 1115 | elif [ $result -eq 2 ]; then
|
1115 | 1116 | # Multiple SnapRAID config files found, stopping the script
|
1116 | 1117 | echo "Stopping the script due to multiple SnapRAID configuration files. Please choose one config file and update your settings in the script-config file at ""$CONFIG_FILE"". Available SnapRAID config files:"
|
@@ -1163,6 +1164,25 @@ search_conf_files() {
|
1163 | 1164 | fi
|
1164 | 1165 | }
|
1165 | 1166 |
|
| 1167 | +# Extract SnapRAID info (content and parity files) from the config file |
| 1168 | + |
| 1169 | +extract_snapraid_info() { |
| 1170 | +# Extract info from SnapRAID config |
| 1171 | +SNAPRAID_CONF_LINES=$(grep -E '^[^#;]' $SNAPRAID_CONF) |
| 1172 | + |
| 1173 | +IFS=$'\n' |
| 1174 | +# Build an array of content files |
| 1175 | +CONTENT_FILES=( |
| 1176 | + $(echo "$SNAPRAID_CONF_LINES" | grep snapraid.content | cut -d ' ' -f2) |
| 1177 | +) |
| 1178 | + |
| 1179 | +# Build an array of parity all files... |
| 1180 | +PARITY_FILES=( |
| 1181 | + $(echo "$SNAPRAID_CONF_LINES" | grep -E '^([2-6z]-)*parity' | cut -d ' ' -f2- | tr ',' '\n') |
| 1182 | +) |
| 1183 | +unset IFS |
| 1184 | +} |
| 1185 | + |
1166 | 1186 | # Run SnapRAID status to check for the previous sync
|
1167 | 1187 | check_snapraid_status() {
|
1168 | 1188 | # Run snapraid status command and capture the output
|
|
0 commit comments