Verified Commit e2ab5538 authored by Max Ferrer's avatar Max Ferrer 💡
Browse files

Remove duplicate part_menu function

parent 7d245e93
......@@ -123,63 +123,6 @@ auto_part() {
rm /tmp/ex_status.var
}
part_menu() {
op_title="${manual_op_msg}"
unset part
dev_menu="| Device: | Size: | Used: | FS: | Mount: | Type: |"
device_list=$(lsblk -no NAME,SIZE,TYPE,FSTYPE | egrep -v "${USB}|loop[0-9]+|sr[0-9]+|fd[0-9]+" |
sed 's/[^[:alnum:]_., -]//g' | column -t | sort -k 1,1 | uniq)
device_count=$(wc <<<"${device_list}" -l)
if "${screen_h}"; then
echo "dialog --extra-button --extra-label \"${write}\" --colors --backtitle \"${backtitle}\" --title \"${op_title}\" --ok-button \"${edit}\" --cancel-button \"${cancel}\" --menu \"${manual_part_msg} \n\n ${dev_menu}\" 21 68 9 \\" >"${tmp_menu}"
else
echo "dialog --extra-button --extra-label \"${write}\" --colors --title \"${title}\" --ok-button \"${edit}\" --cancel-button \"${cancel}\" --menu \"${manual_part_msg} \n\n ${dev_menu}\" 20 68 8 \\" >"${tmp_menu}"
fi
int=1
empty_value="----"
until [ "${int}" -gt "${device_count}" ]; do
device=$(awk <<<"${device_list}" '{print $1}' | awk "NR==${int}")
dev_size=$(grep <<<"${device_list}" -w "${device}" | awk '{print $2}')
dev_type=$(grep <<<"${device_list}" -w "${device}" | awk '{print $3}')
dev_fs=$(grep <<<"${device_list}" -w "${device}" | awk '{print $4}')
dev_mnt=$(df | grep -w "${device}" | awk '{print $6}' | sed 's/mnt\/\?//')
if (grep <<<"${dev_mnt}" "/" &>/dev/null); then
dev_used=$(df -T | grep -w "${device}" | awk '{print $6}')
else
dev_used=$(swapon -s | grep -w "${device}" | awk '{print $4}')
if [ -n "${dev_used}" ]; then
dev_used=${dev_used}%
fi
fi
test -z "${dev_fs}" || test "${dev_fs}" == "linux_raid_member" && dev_fs=${empty_value}
test -z "${dev_used}" && dev_used=${empty_value}
test -z "${dev_mnt}" && dev_mnt=${empty_value}
parent_device=$(lsblk -dnro PKNAME /dev/"${device/-//}")
if [ -z "${parent_device}" ]; then
dev_type=$(grep <<<"${device_list}" -w "${device}" | awk '{print $3}')
else
dev_type=$(fdisk -lo Device,Type /dev/"${parent_device}" | grep -w "${device}" | cut -d ' ' -f 2- | sed -e 's/^[[:space:]]*//;s/[[:space:]]*$//;s/ /_/g')
fi
echo "\"${device}\" \"${dev_size} ${dev_used} ${dev_fs} ${dev_mnt} ${dev_type}\" \\" >>"${tmp_list}"
int=$((int + 1))
done
column <"${tmp_list}" -t >>"${tmp_menu}"
echo "\"${done_msg}\" \"${write}\" 3>&1 1>&2 2>&3" >>"${tmp_menu}"
echo "if [ \"\$?\" -eq \"3\" ]; then clear ; echo \"${done_msg}\" ; fi" >>"${tmp_menu}"
part=$(bash "${tmp_menu}" | sed 's/^\s\+//g;s/\s\+$//g')
if (grep <<<"${part}" "${done_msg}" &>/dev/null); then part="${done_msg}"; fi
rm "${tmp_menu}" "${tmp_list}"
part_class
}
part_menu() {
op_title="${manual_op_msg}"
unset part
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment