diff options
author | Kim <kim.sidney@gmail.com> | 2021-08-06 12:16:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 17:16:36 +0700 |
commit | 3cc31793d57ce05421300ce4e8a1a1352291db85 (patch) | |
tree | bfb82acb97b584ea1f7585e953fbdf8cbe019d28 /scripts/install/install-functions | |
parent | f9fa7becc1d537e459849298818f84325e701702 (diff) | |
download | vyatta-cfg-system-3cc31793d57ce05421300ce4e8a1a1352291db85.tar.gz vyatta-cfg-system-3cc31793d57ce05421300ce4e8a1a1352291db85.zip |
T1153: VyOS 1.2.0RC10, RAID-1, fresh install, unable to save configEquuleus (#159)
* add search for same drive size if more than 2 drives are installed
* add ability to configure RAID-1 by selecting 2 drives
* cleaning up sysconf/filecaps rights
* cleaning up sysconf/filecaps rights xtables-monitor
Diffstat (limited to 'scripts/install/install-functions')
-rwxr-xr-x | scripts/install/install-functions | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/scripts/install/install-functions b/scripts/install/install-functions index e319b84d..458d2e63 100755 --- a/scripts/install/install-functions +++ b/scripts/install/install-functions @@ -177,7 +177,7 @@ select_drive () { drives=$(cat /proc/partitions | \ awk '{ if ($4!="name") { print $4 } }' | \ egrep "c[0-9]d[0-9]$|[hsv]d[a-z]$|nvme[0-9]n[0-9]|mmcblk[0-9]" | \ - egrep -v "^$") + egrep -v "^$" | sort) #this needs more testing to decide if better than above #drives=$(lsblk -dn -o name -I8) @@ -370,3 +370,59 @@ EOF return 1 } +# Find 2 drives of the same size. +get_size_raid () +{ + x=0 + declare -i x + for drive in "${driveName[@]}" + do + drivesize=${driveSize[$x]} + y=0 + declare -i y + for size in ${driveSize[@]} + do + if [ $drivesize -eq $size ] && [ $drive != ${driveName[$y]} ]; then + raiddrives="${driveName[$y]} $drive" + fi + y+=1 + done + x+=1 + done + if [ -n "$raiddrives" ]; then + echo $raiddrives + fi +} + +# Manually select 2 items for use in RAID-1 +get_manual_raid () +{ + PS3="Select the first drive: " + IFS=$'\n' s_driveNameSize=($(sort <<<"${driveNameSize[*]}")) + unset IFS + select drive1 in "${s_driveNameSize[@]}" + do + break + done + + driveNameSize=() + for drive in "${driveName[@]}" + do + if ! echo $drive1 | grep -q $drive; then + driveNameSize+=("$drive $(get_drive_size $drive) MB") + fi + done + + PS3="Select the second drive: " + IFS=$'\n' s_driveNameSize=($(sort <<<"${driveNameSize[*]}")) + unset IFS + select drive2 in "${s_driveNameSize[@]}" + do + break + done + + drive1=`echo $drive1 | awk '{ print $1 }'` + drive2=`echo $drive2 | awk '{ print $1 }'` + + echo $drive1 $drive2 +} |