Skip to content

Commit

Permalink
replaced some perl regexp with grep native extended regexp (issue 1376)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmeix committed Jun 8, 2017
1 parent 85acf6c commit 9875ba3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions usr/share/rear/layout/save/default/310_autoexclude_usb.sh
Expand Up @@ -22,7 +22,7 @@ do
esac
else
continue # check next one
fi
fi

# Return a proper short device name using udev
REAL_USB_DEVICE=$(readlink -f $USB_DEVICE)
Expand All @@ -36,7 +36,7 @@ do

grep -q "^$REAL_USB_DEVICE " /proc/mounts
if [[ $? -eq 0 ]]; then
local usb_mntpt=$(grep -E "^$REAL_USB_DEVICE\s" /proc/mounts | cut -d" " -f2 | tail -1)
local usb_mntpt=$( grep "^$REAL_USB_DEVICE " /proc/mounts | cut -d" " -f2 | tail -1 )
if ! IsInArray "$usb_mntpt" "${AUTOEXCLUDE_USB_PATH[@]}" ; then
AUTOEXCLUDE_USB_PATH=( ${AUTOEXCLUDE_USB_PATH[@]} $usb_mntpt )
Log "Auto-excluding USB path $usb_mntpt [device $REAL_USB_DEVICE]"
Expand Down
Expand Up @@ -22,7 +22,7 @@ if [[ "$usb_syslinux_version" ]] && version_newer "$usb_syslinux_version" "$sysl
fi

# Make the USB bootable
usb_filesystem=$(grep -E "^($USB_DEVICE|$REAL_USB_DEVICE)\\s" /proc/mounts | cut -d' ' -f3 | tail -1)
usb_filesystem=$( grep -E "^$USB_DEVICE |^$REAL_USB_DEVICE " /proc/mounts | cut -d' ' -f3 | tail -1 )
case "$usb_filesystem" in
(ext?)
if [[ "$FEATURE_SYSLINUX_EXTLINUX_INSTALL" ]]; then
Expand Down
5 changes: 3 additions & 2 deletions usr/share/rear/prep/USB/Linux-i386/350_check_usb_disk.sh
Expand Up @@ -8,8 +8,9 @@ REAL_USB_DEVICE=$(readlink -f $USB_DEVICE)
[ -b "$REAL_USB_DEVICE" ]
StopIfError "USB device '$USB_DEVICE' is not a block device"

! grep -q "^$REAL_USB_DEVICE " /proc/mounts
StopIfError "USB device '$USB_DEVICE' is already mounted on $(grep -E "^$REAL_USB_DEVICE\\s" /proc/mounts | cut -d' ' -f2 |tail -1)"
if grep -q "^$REAL_USB_DEVICE " /proc/mounts ; then
Error "USB device '$USB_DEVICE' is already mounted on $( grep "^$REAL_USB_DEVICE " /proc/mounts | cut -d' ' -f2 | tail -1 )"
fi

# We cannot use the layout dependency code in the backup phase (yet)
#RAW_USB_DEVICE=$(find_disk $REAL_USB_DEVICE)
Expand Down

0 comments on commit 9875ba3

Please sign in to comment.