nand-sata-install: deprecated egrep -> grep -E

This commit is contained in:
Anton-Latukha 2019-03-02 20:30:54 +02:00
parent cf0b95aa95
commit fcd95f997e

View File

@ -16,7 +16,7 @@
# script configuration
CWD="/usr/lib/nand-sata-install"
EX_LIST="${CWD}/exclude.txt"
[ -f /etc/default/openmediavault ] && echo '/srv/*' >>"${EX_LIST}"
[ -f /etc/default/openmediavault ] && echo '/srv/*' >> "${EX_LIST}"
logfile="/var/log/nand-sata-install.log"
# read in board info
@ -46,7 +46,7 @@ root_partition_device="${root_partition::-2}"
# find targets: NAND, EMMC, SATA, SPI flash, NVMe
[[ -b /dev/nand ]] && nandcheck=$(ls -d -1 /dev/nand* | grep -w 'nand' | awk '{print $NF}');
emmccheck=$(ls -d -1 /dev/mmcblk* | grep -w 'mmcblk[0-9]' | grep -v "$root_partition_device");
diskcheck=$(lsblk -l | awk -F" " '/ disk / {print $1}' | egrep '^sd|^nvme')
diskcheck=$(lsblk -l | awk -F" " '/ disk / {print $1}' | grep -E '^sd|^nvme')
spicheck=$(grep 'mtd' /proc/partitions | awk '{print $NF}')
# define makefs and mount options
@ -121,7 +121,7 @@ create_armbian()
echo -e "Dest: $DEST\n\n/etc/fstab:" >> $logfile
cat /etc/fstab >> $logfile
echo -e "\n/etc/mtab:" >> $logfile
grep '^/dev/' /etc/mtab | egrep -v "log2ram|folder2ram" | sort >> $logfile
grep '^/dev/' /etc/mtab | grep -E -v "log2ram|folder2ram" | sort >> $logfile
# stop running services
echo -e "\nFiles currently open for writing:" >> $logfile
@ -530,7 +530,7 @@ format_disk()
check_partitions()
{
IFS=" "
AvailablePartitions=$(lsblk -l | awk -F" " '/ part | raid..? / {print $1}' | egrep '^sd|^nvme|^md')
AvailablePartitions=$(lsblk -l | awk -F" " '/ part | raid..? / {print $1}' | grep -E '^sd|^nvme|^md')
if [[ -z $AvailablePartitions ]]; then
dialog --title "$title" --backtitle "$backtitle" --colors --msgbox \
"\n\Z1There are no avaliable partitions. Please create them.\Zn" 7 60
@ -538,7 +538,7 @@ check_partitions()
apt-get -y -q install gdisk >/dev/null 2>&1
gdisk /dev/$diskcheck
fi
AvailablePartitions=$(lsblk -l | awk -F" " '/ part | raid..? / {print $1}' | egrep '^sd|^nvme|^md' | uniq | sed 's|^|/dev/|' | nl | xargs echo -n)
AvailablePartitions=$(lsblk -l | awk -F" " '/ part | raid..? / {print $1}' | grep -E '^sd|^nvme|^md' | uniq | sed 's|^|/dev/|' | nl | xargs echo -n)
PartitionOptions=($AvailablePartitions)
PartitionCmd=(dialog --title 'Select destination:' --backtitle "$backtitle" --menu "\n$infos" 10 60 16)
@ -596,7 +596,7 @@ show_warning()
stop_running_services()
{
systemctl --state=running | awk -F" " '/.service/ {print $1}' | sort -r | \
egrep -e "$1" | while read ; do
grep -E -e "$1" | while read ; do
echo -e "\nStopping ${REPLY} \c"
systemctl stop ${REPLY} 2>&1
done