From b5a80f2f1781b702ac15181d1ddbe4cc4c1af3e9 Mon Sep 17 00:00:00 2001 From: asmeron Date: Fri, 2 Feb 2024 16:22:05 +0600 Subject: [PATCH] Fix egrep --- ublinux/functions | 10 ++--- ublinux/rc.desktop/all/xss_heartbeat | 6 +-- .../rc.desktop/deonly/xfce4-screensaver-fix | 2 +- ublinux/rc.local.d/41-x11vnc | 2 +- ublinux/rc.post.d/01-system | 2 +- ublinux/rc.post.d/10-brand-backgrounds | 2 +- ublinux/rc.post.d/11-xorg | 38 +++++++++---------- ublinux/rc.post.d/30-network | 2 +- ublinux/rc.post.d/51-theme | 2 +- ublinux/rc.post.d/60-blacklistdkms | 2 +- ublinux/rc.preinit.d/11-partitions | 2 +- ublinux/rc.preinit.d/50-xorg-old | 2 +- ublinux/rc.xorg/02-xrandr | 32 ++++++++-------- 13 files changed, 52 insertions(+), 52 deletions(-) diff --git a/ublinux/functions b/ublinux/functions index d11aa0d..6cdfb36 100755 --- a/ublinux/functions +++ b/ublinux/functions @@ -269,7 +269,7 @@ create_module(){ . /usr/lib/ublinux/default . /etc/ublinux/config 2>/dev/null . /etc/ublinux/system 2>/dev/null - echo " $@ " | egrep -q ' -comp | -noD ' && MKSQFS_OPTS= + echo " $@ " | grep -Eq ' -comp | -noD ' && MKSQFS_OPTS= mksquashfs "$1" "$2" $MKSQFS_OPTS $3 $4 $5 $6 $7 $8 $9 -noappend >/dev/null || return 1 chmod 444 "$2" } @@ -278,14 +278,14 @@ create_module(){ # $1 = value name, case sensitive, for example 'debug' cmdline_parameter(){ . /etc/ublinux/config 2>/dev/null || . etc/ublinux/config 2>/dev/null - echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | egrep -m1 -o "(^|[[:space:]])$1([[:space:]]|\$)" | head -1 | tr -d " " + echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | grep -Em1 -o "(^|[[:space:]])$1([[:space:]]|\$)" | head -1 | tr -d " " } # look into cmdline and echo value of $1 option # $1 = value name, case sensitive, for example 'changes' cmdline_value(){ . /etc/ublinux/config 2>/dev/null || . etc/ublinux/config 2>/dev/null - echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | egrep -m1 -o "(^|[[:space:]])$1=[^[:space:]]+" | head -1 | cut -d "=" -f 2- + echo -n " $CMDLINE " | cat /proc/cmdline - 2>/dev/null | tr "[:cntrl:]" " " | grep -Em1 -o "(^|[[:space:]])$1=[^[:space:]]+" | head -1 | cut -d "=" -f 2- } # Find and run all scripts from the given module @@ -308,7 +308,7 @@ find_n_run_scripts(){ RUNSCRIPTS="$MOD$RCPATH|$MOD/usr/lib/ublinux/rc.local|$MOD/usr/lib/ublinux/rc.post" echo $@ | grep -q start || RUNSCRIPTS="$MOD$RCPATH" - find "$MOD" | egrep "$RUNSCRIPTS" | cut -b "${#MOD}"- | cut -b 2- | xargs -n 1 -r readlink -f | sort -u | \ + find "$MOD" | grep -E "$RUNSCRIPTS" | cut -b "${#MOD}"- | cut -b 2- | xargs -n 1 -r readlink -f | sort -u | \ while read SCRIPT; do if [ "$SCRIPT" != "" -a -x "$SCRIPT" -a ! -d "$SCRIPT" ]; then # call the script by real path, not from the module @@ -370,7 +370,7 @@ xss_heartbeat(){ . /usr/lib/ublinux/default . /etc/ublinux/config 2>/dev/null SSAVERBLOCKAPPS="$(echo "$SSAVERBLOCKAPPS"| tr ',; ' '|' )" - bash -c "while true ;do top -bn1 -u $(id -un) | awk '{ print \$7 FS \$NF }' | grep ^[1-9] | egrep -q \"$SSAVERBLOCKAPPS\" && xscreensaver-command -deactivate >/dev/null ; sleep 20s ; done " & + bash -c "while true ;do top -bn1 -u $(id -un) | awk '{ print \$7 FS \$NF }' | grep ^[1-9] | grep -Eq \"$SSAVERBLOCKAPPS\" && xscreensaver-command -deactivate >/dev/null ; sleep 20s ; done " & } diff --git a/ublinux/rc.desktop/all/xss_heartbeat b/ublinux/rc.desktop/all/xss_heartbeat index 65a564d..090ee65 100755 --- a/ublinux/rc.desktop/all/xss_heartbeat +++ b/ublinux/rc.desktop/all/xss_heartbeat @@ -23,7 +23,7 @@ DE=$(detectDE) [ "$XSSDEIGNORE" = "all" ] && exit 0 echo " $XSSDEIGNORE " | tr ',;' ' ' | grep -q " $DE " && exit 0 XSSEXIT="$(echo "$XSSEXIT" | tr ',; ' '|' )" -ps -U $(id -un) -o comm | egrep -q "$XSSEXIT" && exit 0 +ps -U $(id -un) -o comm | grep -Eq "$XSSEXIT" && exit 0 xscreensaver -no-splash & sleep 1s @@ -31,7 +31,7 @@ sleep 1s while true ;do XSSBLRUNED="$(echo "$XSSBLRUNED" | tr ',; ' '|' )" XSSBLLOADED="$(echo "$XSSBLLOADED" | tr ',; ' '|' )" - ps -U $(id -un) -o comm | egrep -q "$XSSBLRUNED" && xscreensaver-command -deactivate >/dev/null 2>&1 - top -bn1 -u $(id -un) | awk '{ print $7 FS $NF }' | grep ^[1-9] | egrep -q "$XSSBLLOADED" && xscreensaver-command -deactivate >/dev/null 2>&1 + ps -U $(id -un) -o comm | grep -Eq "$XSSBLRUNED" && xscreensaver-command -deactivate >/dev/null 2>&1 + top -bn1 -u $(id -un) | awk '{ print $7 FS $NF }' | grep ^[1-9] | grep -Eq "$XSSBLLOADED" && xscreensaver-command -deactivate >/dev/null 2>&1 sleep $XSSHBTM done diff --git a/ublinux/rc.desktop/deonly/xfce4-screensaver-fix b/ublinux/rc.desktop/deonly/xfce4-screensaver-fix index 95eb34c..afc5001 100755 --- a/ublinux/rc.desktop/deonly/xfce4-screensaver-fix +++ b/ublinux/rc.desktop/deonly/xfce4-screensaver-fix @@ -9,7 +9,7 @@ ENABLED=yes sleep 5 if pidof -qx xfce4-screensaver; then - if ! lspci -k | egrep -i -A 3 'VGA|3D' | grep -q 'Kernel driver in use:'; then + if ! lspci -k | grep -Ei -A 3 'VGA|3D' | grep -q 'Kernel driver in use:'; then BLOBPS=$(ps -u $(id -u) -o pid= | xargs -I{} cat /proc/{}/environ 2>/dev/null | tr '\0' '\n') DISPLAY=$(grep -m1 '^DISPLAY=' <<< "${BLOBPS}") # XAUTHORITY=$(grep -m1 '^XAUTHORITY=' <<< "${BLOBPS}") diff --git a/ublinux/rc.local.d/41-x11vnc b/ublinux/rc.local.d/41-x11vnc index 6c2d042..19cb381 100755 --- a/ublinux/rc.local.d/41-x11vnc +++ b/ublinux/rc.local.d/41-x11vnc @@ -70,7 +70,7 @@ EOF FILE_X11VNC_SERVICE="/usr/lib/systemd/system/x11vnc-ublinux-${X11VNC_NEW}.service" OPTION_LOG="-o /var/log/x11vnc-ublinux-${X11VNC_NEW}.log" OPTION_PORT="-autoport 5900" - if NUM_TTY=$(egrep --only-matching -- "-rawfb vt[0-9]{1,2}" <<< ${X11VNC[${X11VNC_NEW}]} | head -1 | sed "s/-rawfb vt//") && [[ -n ${NUM_TTY} ]]; then + if NUM_TTY=$(grep -E --only-matching -- "-rawfb vt[0-9]{1,2}" <<< ${X11VNC[${X11VNC_NEW}]} | head -1 | sed "s/-rawfb vt//") && [[ -n ${NUM_TTY} ]]; then systemctl start getty@tty${NUM_TTY}.service fi if grep --quiet -- "-display" <<< ${X11VNC[${X11VNC_NEW}]}; then diff --git a/ublinux/rc.post.d/01-system b/ublinux/rc.post.d/01-system index f6182ad..753332f 100755 --- a/ublinux/rc.post.d/01-system +++ b/ublinux/rc.post.d/01-system @@ -13,7 +13,7 @@ debug_mode "$0" "$@" [ -f /etc/sysctl.d/ublinux.conf ] && sysctl -p /etc/sysctl.d/ublinux.conf # If Linux installed on n[t]fs we have to omit killing rootfilesystem mounter when system halt -ps -A | egrep 'ntfsmount|rpciod|nfsiod|httpfs|curlftpfs' | awk '{ print $1 }' >> /var/run/sendsigs.omit +ps -A | grep -E 'ntfsmount|rpciod|nfsiod|httpfs|curlftpfs' | awk '{ print $1 }' >> /var/run/sendsigs.omit # Creating /etc/mtab #rm -f /etc/mtab diff --git a/ublinux/rc.post.d/10-brand-backgrounds b/ublinux/rc.post.d/10-brand-backgrounds index 62f2e49..91b8930 100755 --- a/ublinux/rc.post.d/10-brand-backgrounds +++ b/ublinux/rc.post.d/10-brand-backgrounds @@ -141,7 +141,7 @@ get_max_resolution() { if [[ -n "${MONITOR[@]}" ]]; then for VIDEO_PORT in "${!MONITOR[@]}"; do while read VIDEO_PORT_PARAM; do - if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + if grep -Eiq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then RESOLUTION="$(sed 's/\([0-9]*\*[0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/*})" # fix 1440x900 > 1280x1024 [[ "${RESOLUTION}" == "1440*900" ]] && pixel_line_mode=$(bc <<< "${RESOLUTION}+14721") || pixel_line_mode=$(bc <<< ${RESOLUTION}) diff --git a/ublinux/rc.post.d/11-xorg b/ublinux/rc.post.d/11-xorg index ebe596b..45c79cb 100755 --- a/ublinux/rc.post.d/11-xorg +++ b/ublinux/rc.post.d/11-xorg @@ -28,7 +28,7 @@ SOURCE=${SYSCONF}/keyboard; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null while read KERNEL_MODULE; do [[ ${KERNEL_MODULE} != "nouveau" ]] && modprobe ${KERNEL_MODULE} 2>/dev/null && break done < <(lspci -ks ${LSPCI_DEVICE%% *} | grep 'Kernel modules:' | cut -d: -f2 | tr ',' '\n' | tac) - done < <(lspci | egrep -i 'vga|3d') + done < <(lspci | grep -Ei 'vga|3d') if lsmod | grep nvidia &>/dev/null; then #[[ -f /usr/bin/nvidia-xconfig ]] && nvidia-xconfig -s --no-logo --no-composite --no-dynamic-twinview --force-generate --output-xconfig=/etc/X11/xorg.conf [[ -e /etc/X11/xorg.conf.d/20-nvidia-ubconfig.conf ]] || ln -sf /usr/lib/ublinux/xorg.conf.d/20-nvidia-ubconfig.conf /etc/X11/xorg.conf.d/ @@ -53,7 +53,7 @@ SOURCE=${SYSCONF}/keyboard; [[ -f ${SOURCE} ]] && . ${SOURCE} 2>/dev/null if [[ -n ${XORG_EXT} ]]; then while read I_EXT; do XORG_FILE_EXT="/etc/X11/xorg.conf.d/110-${I_EXT}-ubconfig.conf" - if egrep -iq "^nodpms$" <<< "${I_EXT}"; then + if grep -Eiq "^nodpms$" <<< "${I_EXT}"; then cat > ${XORG_FILE_EXT} < ${XORG_FILE_EXT} <> /etc/xdg/kdeglobals + grep -Ev "^\[General\]|^Name=|^\[KDE\]|^colorScheme=|^contrast=|^shadeSortColumn=" "/usr/share/color-schemes/$THEMEPLASMACOLORS.colors" >> /etc/xdg/kdeglobals fi if [ "$THEMEPLASMA" != "" -a -d "/usr/share/plasma/look-and-feel/$THEMEPLASMA" -a -f /etc/xdg/kdeglobals ] ;then sed -i s/^LookAndFeelPackage=.*/"LookAndFeelPackage=$THEMEPLASMA"/ /etc/xdg/kdeglobals diff --git a/ublinux/rc.post.d/60-blacklistdkms b/ublinux/rc.post.d/60-blacklistdkms index 7051adb..8001804 100755 --- a/ublinux/rc.post.d/60-blacklistdkms +++ b/ublinux/rc.post.d/60-blacklistdkms @@ -14,7 +14,7 @@ SOURCE=${SYSCONF}/config; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null echo -n > /etc/modprobe.d/blacklist-ublinux-dkms.conf LC_ALL=C lspci -k | grep "Kernel modules: " | grep ", " | sed s/.*"Kernel modules: "// | sed s/", "/"\n"/g > /tmp/kernel_mods_lspci -find /var/lib/dkms-binary -type f | egrep -v "nvidia|virtualbox|vbox" | egrep .ko$"|".ko.xz | gawk -F/ '{print $NF}' | sed s/[.]ko.*// | sort -u | grep -f /tmp/kernel_mods_lspci | while read a ;do +find /var/lib/dkms-binary -type f | grep -Ev "nvidia|virtualbox|vbox" | egrep .ko$"|".ko.xz | gawk -F/ '{print $NF}' | sed s/[.]ko.*// | sort -u | grep -f /tmp/kernel_mods_lspci | while read a ;do lspci -nn | grep -q -f /usr/share/ublinux/hwdata/dkms/$a 2>/dev/null && continue echo "$WHITELISTMODULES" | grep -q "$a" && continue modprobe -r "$a" 2>/dev/null diff --git a/ublinux/rc.preinit.d/11-partitions b/ublinux/rc.preinit.d/11-partitions index cb13df5..802fb49 100755 --- a/ublinux/rc.preinit.d/11-partitions +++ b/ublinux/rc.preinit.d/11-partitions @@ -74,7 +74,7 @@ grep -q "tmpfs /media tmpfs" etc/fstab || echo "tmpfs /media tmpfs size=1M 0 0 # if [ "$PARTITIONSAUTOMOUNT" = "yes" ] ;then sed -i /PARTITIONSAUTOMOUNT/d etc/fstab - blkid | egrep -v "loop|/dev/ram" | grep /dev/ | awk -F: '{ print $1 }' | while read a ; do + blkid | grep -Ev "loop|/dev/ram" | grep /dev/ | awk -F: '{ print $1 }' | while read a ; do grep -q "^$a " etc/fstab && continue if grep -q "^$a " /proc/mounts ;then grep -m1 "^$a " /proc/mounts | grep /memory | sed s/$/" #PARTITIONSAUTOMOUNT=yes"/ >> etc/fstab diff --git a/ublinux/rc.preinit.d/50-xorg-old b/ublinux/rc.preinit.d/50-xorg-old index f31555b..c5c3f45 100755 --- a/ublinux/rc.preinit.d/50-xorg-old +++ b/ublinux/rc.preinit.d/50-xorg-old @@ -228,7 +228,7 @@ if [ -f $XFILE -a "$VGABUSID" ] ;then fi #preloading kernel module to help xorg (all nvidia* modules are using one name 'nvidia') -if echo "$XDRIVER" | egrep -q 'nvidia|nouveau' ;then +if echo "$XDRIVER" | grep -Eq 'nvidia|nouveau' ;then sed -i /^nvidia/d etc/modprobe.preload sed -i /^nouveau/d etc/modprobe.preload echo "$XDRIVER" >> etc/modprobe.preload diff --git a/ublinux/rc.xorg/02-xrandr b/ublinux/rc.xorg/02-xrandr index cabe624..7f832f8 100755 --- a/ublinux/rc.xorg/02-xrandr +++ b/ublinux/rc.xorg/02-xrandr @@ -22,46 +22,46 @@ SOURCE=${SYSCONF}/desktop; [ -f ${SOURCE} ] && . ${SOURCE} 2>/dev/null SOFT_MODELINE_R= while read VIDEO_PORT_PARAM; do MODELINE= - if egrep -iq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + if grep -Eiq "^[0-9]*x[0-9]*$|^[0-9]*x[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then if [[ -n ${SOFT_MODELINE_R} ]]; then MODELINE=$(cvt -r $(sed 's/\([0-9]* [0-9]*\) .*/\1/' <<< ${VIDEO_PORT_PARAM//x/ }) | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') SOFT_MODELINE_R= elif [[ ${SOFT_MODELINE} == "cvt" ]]; then MODELINE=$(cvt ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') else - if egrep -iq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + if grep -Eiq "^[0-9]*x[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } 60 | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') else MODELINE=$(gtf ${VIDEO_PORT_PARAM//x/ } | sed '/^\s*$/d ; /^\s*#/d ; s/\s*Modeline //') fi fi - elif egrep -iq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^cvt$" <<< "${VIDEO_PORT_PARAM}"; then SOFT_MODELINE="cvt" - elif egrep -iq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^gtf$" <<< "${VIDEO_PORT_PARAM}"; then SOFT_MODELINE="gtf" - elif egrep -iq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^reduced|r$" <<< "${VIDEO_PORT_PARAM}"; then SOFT_MODELINE_R="reduced" - elif egrep -iq "^auto$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^auto$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --auto - elif egrep -iq "^preferred$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^preferred$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --preferred - elif egrep -iq "^off$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^off$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --off - elif egrep -iq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^primary$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --primary - elif egrep -iq "^mode:[0-9x_]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^mode:[0-9x_]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) - elif egrep -iq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^mode:[0-9x_]*:[0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --mode $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM}) --rate $(cut -d: -f3 <<< ${VIDEO_PORT_PARAM}) - elif egrep -iq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^lo:[A-z0-9]*$|^LeftOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --left-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif egrep -iq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ro:[A-z0-9]*$|^RightOf:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --right-of $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif egrep -iq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^ab:[A-z0-9]*$|^Above:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --above $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif egrep -iq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^be:[A-z0-9]*$|^Below:[A-z0-9]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --below $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) - elif egrep -iq "^Rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then + elif grep -Eiq "^Rotate:[A-z]*$" <<< "${VIDEO_PORT_PARAM}"; then xrandr --output ${VIDEO_PORT^^} --rotate $(cut -d: -f2 <<< ${VIDEO_PORT_PARAM^^}) fi if [[ -n ${MODELINE} ]]; then