Skip to content

Commit

Permalink
egrep->grep
Browse files Browse the repository at this point in the history
  • Loading branch information
kiorky committed Sep 12, 2022
1 parent 1b19cdf commit 28b2921
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .ansible/scripts/download_corpusops.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
readlinkf() {
if ( uname | egrep -iq "linux|darwin|bsd" );then
if ( uname | grep -E -iq "linux|darwin|bsd" );then
if ( which greadlink 2>&1 >/dev/null );then
greadlink -f "$@"
elif ( which perl 2>&1 >/dev/null );then
Expand Down
2 changes: 1 addition & 1 deletion helpers/add_confd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ install() {
&& urls="$(do_curl -s -H "Authorization: token $GITHUB_PAT" \
"https://api.github.com/repos/kelseyhightower/confd/releases/$CONFD_RELEASE" \
| grep browser_download_url | cut -d "\"" -f 4\
| egrep -i "($(uname -s).*$arch|sha)" )" \
| grep -E -i "($(uname -s).*$arch|sha)" )" \
&& : :: confd: download and unpack artefacts \
&& for u in $urls;do do_curl -sLO $u;done \
&& mv -vf confd* /usr/bin/confd \
Expand Down
2 changes: 1 addition & 1 deletion helpers/add_dockerize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install() {
"https://api.github.com/repos/jwilder/dockerize/releases/$DOCKERIZE_RELEASE" \
| grep browser_download_url | cut -d "\"" -f 4\
| ( if [ -e /etc/alpine-release ];then grep alpine;else grep -v alpine;fi; ) \
| egrep -i "($(uname -s).*$arch|sha)" )" \
| grep -E -i "($(uname -s).*$arch|sha)" )" \
&& : :: dockerize: download and unpack artefacts \
&& for u in $urls;do do_curl -sLO $u && tar -xzf $(basename $u);done \
&& mv -vf dockerize /usr/bin/dockerize \
Expand Down
2 changes: 1 addition & 1 deletion helpers/add_frep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install() {
&& urls="$(do_curl -s -H "Authorization: token $GITHUB_PAT" \
"https://api.github.com/repos/$PKG/releases/$REMCO_RELEASE" \
| grep browser_download_url | cut -d "\"" -f 4\
| egrep -i "($(uname -s).*$arch|sha)" )" \
| grep -E -i "($(uname -s).*$arch|sha)" )" \
&& : :: frep: download and unpack artefacts \
&& for u in $urls;do do_curl -sLO $u;done \
&& sha256sum -c frep-*-linux-$arch.sha256 >/dev/nulm 2>&1 \
Expand Down
2 changes: 1 addition & 1 deletion helpers/add_gosu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ install() {
&& urls="$(do_curl -s -H "Authorization: token $GITHUB_PAT" \
"https://api.github.com/repos/tianon/gosu/releases/$GOSU_RELEASE" \
| grep browser_download_url | cut -d "\"" -f 4\
| egrep -i "sha|$arch"; )" \
| grep -E -i "sha|$arch"; )" \
&& : :: gosu: download artefacts \
&& for u in $urls;do do_curl -sLO $u;done \
&& : :: gosu: integrity check \
Expand Down
2 changes: 1 addition & 1 deletion helpers/add_remco.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ install() {
&& urls="$(do_curl -s -H "Authorization: token $GITHUB_PAT" \
"https://api.github.com/repos/$PKG/releases/$REMCO_RELEASE" \
| grep browser_download_url | cut -d "\"" -f 4\
| egrep -i "($(uname -s).*$arch|sha)" )" \
| grep -E -i "($(uname -s).*$arch|sha)" )" \
&& : :: remco: download and unpack artefacts \
&& for u in $urls;do do_curl -sLO $u;done \
&& 7z x -y remco_*_linux_amd64.zip >/dev/null \
Expand Down
32 changes: 16 additions & 16 deletions helpers/cops_pkgmgr_install.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
# BEGIN: corpusops common glue
readlinkf() {
if ( uname | egrep -iq "darwin|bsd" );then
if ( uname | grep -E -iq "darwin|bsd" );then
if ( which greadlink 2>&1 >/dev/null );then
greadlink -f "$@"
elif ( which perl 2>&1 >/dev/null );then
Expand Down Expand Up @@ -247,12 +247,12 @@ version_lte() { [ "$1" = "$(printf "$1\n$2" | sort -V | head -n1)" ]; }
version_lt() { [ "$1" = "$2" ] && return 1 || version_lte $1 $2; }
version_gte() { [ "$2" = "$(printf "$1\n$2" | sort -V | head -n1)" ]; }
version_gt() { [ "$1" = "$2" ] && return 1 || version_gte $1 $2; }
is_archlinux_like() { echo $DISTRIB_ID | egrep -iq "archlinux|arch"; }
is_debian_like() { echo $DISTRIB_ID | egrep -iq "debian|ubuntu|mint"; }
is_suse_like() { echo $DISTRIB_ID | egrep -iq "suse"; }
is_alpine_like() { echo $DISTRIB_ID | egrep -iq "alpine" || test -e /etc/alpine-release; }
is_archlinux_like() { echo $DISTRIB_ID | grep -E -iq "archlinux|arch"; }
is_debian_like() { echo $DISTRIB_ID | grep -E -iq "debian|ubuntu|mint"; }
is_suse_like() { echo $DISTRIB_ID | grep -E -iq "suse"; }
is_alpine_like() { echo $DISTRIB_ID | grep -E -iq "alpine" || test -e /etc/alpine-release; }
is_redhat_like() { echo $DISTRIB_ID \
| egrep -iq "((^ol$)|rhel|redhat|red-hat|centos|fedora)"; }
| grep -E -iq "((^ol$)|rhel|redhat|red-hat|centos|fedora)"; }
set_lang() { locale=${1:-C};export LANG=${locale};export LC_ALL=${locale}; }
detect_os() {
# this function should be copiable in other scripts, dont use adjacent functions
Expand Down Expand Up @@ -376,8 +376,8 @@ may_sudo() {
get_ancestor_from_dockerfile() {
local dockerfile=${1}
local ancestor=
if [ -e "${dockerfile}" ] && egrep -q ^FROM "${dockerfile}"; then
ancestor=$(egrep ^FROM "${dockerfile}"\
if [ -e "${dockerfile}" ] && grep -E -q ^FROM "${dockerfile}"; then
ancestor=$(grep -E ^FROM "${dockerfile}"\
| head -n1 | awk '{print $2}' | xargs -n1| sort -u )
fi
echo ${ancestor}
Expand Down Expand Up @@ -434,7 +434,7 @@ upgrade_wd_to_br() {
if [ "x${test_branch}" != "x${up_branch}" ];then
warn "Upgrading $wd to branch: $up_branch"
git fetch --all || die "git fetch in $wd failed"
if get_git_branchs | egrep -q "^${up_branch}$";then
if get_git_branchs | grep -E -q "^${up_branch}$";then
vv git checkout ${up_branch} &&\
vv git reset --hard origin/${up_branch}
else
Expand Down Expand Up @@ -464,7 +464,7 @@ get_python2() {
local py2=
for i in python2.7 python2.6 python-2.7 python-2.6 python-2;do
local lpy=$(get_command $i 2>/dev/null)
if [ "x$lpy" != "x" ] && ( ${lpy} -V 2>&1| egrep -qi 'python 2' );then
if [ "x$lpy" != "x" ] && ( ${lpy} -V 2>&1| grep -E -qi 'python 2' );then
py2=${lpy}
break
fi
Expand Down Expand Up @@ -713,7 +713,7 @@ pacman_install() {
pacman_setup() {
ensure_command awk core/gawk
ensure_command sort core/coreutils
ensure_command egrep core/grep
ensure_command grep -E core/grep
ensure_command which core/which
}

Expand Down Expand Up @@ -742,7 +742,7 @@ is_dnf_installed() {
dnf_update() {
vvv dnf check-update $(i_y)
ret=$?
if echo ${ret} | egrep -q '^(0|100)$'; then
if echo ${ret} | grep -E -q '^(0|100)$'; then
return 0
fi
return 1
Expand Down Expand Up @@ -793,7 +793,7 @@ is_yum_installed() {
yum_update() {
vvv yum check-update $(i_y)
ret=$?
if echo ${ret} | egrep -q '^(0|100)$'; then
if echo ${ret} | grep -E -q '^(0|100)$'; then
return 0
fi
return 1
Expand Down Expand Up @@ -845,7 +845,7 @@ rh_setup() {
ensure_command xargs findutils
ensure_command awk gawk
ensure_command sort coreutils
ensure_command egrep grep
ensure_command grep -E grep
ensure_command which which
}

Expand All @@ -864,7 +864,7 @@ is_aptget_available() {
}

is_aptget_installed() {
if ! dpkg-query -s ${@} 2>/dev/null|egrep "^Status:"|grep -q installed; then
if ! dpkg-query -s ${@} 2>/dev/null|grep -E "^Status:"|grep -q installed; then
return 1
fi
}
Expand Down Expand Up @@ -958,7 +958,7 @@ is_zypper_available() {
}

is_zypper_installed() {
if ( $(zyppern) info $@|egrep -iq "installed:?\s.*no" ); then
if ( $(zyppern) info $@|grep -E -iq "installed:?\s.*no" ); then
return 1
fi
return 0
Expand Down
16 changes: 8 additions & 8 deletions helpers/setup_locales.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ log() { echo "$@">&2; }
debug() { if [ "x$DEBUG" = "x" ];then log "$@";fi }
vv() { log "$@"; if [ "x${DRYRUN}" = "x" ];then "$@";fi; }
dvv() { debug "$@"; if [ "x${DRYRUN}" = "x" ];then "$@";fi; }
is_debian() { cat /etc/*release 2>/dev/null| egrep -iq "debian|ubuntu|mint"; }
is_debian() { cat /etc/*release 2>/dev/null| grep -E -iq "debian|ubuntu|mint"; }
is_suse() { test -e /etc/SuSE-brand || test -e /etc/SuSE-release; }
is_redhat() { cat /etc/*release 2>/dev/null| egrep -iq "centos|red|fedora|oracle|olinux|oh|rhel"; }
is_alpine() { echo $DISTRIB_ID | egrep -iq "alpine" || test -e /etc/alpine-release; }
is_archlinux() { cat /etc/*release 2>/dev/null| egrep -iq "arch"; }
is_redhat() { cat /etc/*release 2>/dev/null| grep -E -iq "centos|red|fedora|oracle|olinux|oh|rhel"; }
is_alpine() { echo $DISTRIB_ID | grep -E -iq "alpine" || test -e /etc/alpine-release; }
is_archlinux() { cat /etc/*release 2>/dev/null| grep -E -iq "arch"; }
if [ "x${SDEBUG}" != "x" ];then set -x;fi
INSTALL_LOCALES="${INSTALL_LOCALES-"
fr_FR.UTF-8 fr_FR.ISO-8859-15 fr_FR.ISO-8859-1 [email protected] [email protected] \
Expand Down Expand Up @@ -59,7 +59,7 @@ lazy_localedef() {
lazylocale=$1
ilazylocale=$(sanitize_locale $lazylocale)
shift
if ( sanitize_locale "$(locale -a)"|egrep -q "^$ilazylocale$" );then
if ( sanitize_locale "$(locale -a)"|grep -E -q "^$ilazylocale$" );then
log "Already generated: $lazylocale"
else
vv localedef $@ $lazylocale
Expand All @@ -79,7 +79,7 @@ for item in $INSTALL_LOCALES;do if [ "x$item" != "x" ] ;then
fi
if ( is_debian );then
vv touch /etc/locale.gen
if ! ( egrep -iq "^${lang}.*${variant}.*${cp}" /etc/locale.gen );then
if ! ( grep -E -iq "^${lang}.*${variant}.*${cp}" /etc/locale.gen );then
log "Adding $lang $cp $variant to gen"
cps="";if ( echo "$cp" | grep -ivq 'iso' );then cps=".${cp}";fi
echo "${lang}${variant} ${cp}" >> /etc/locale.gen
Expand All @@ -98,7 +98,7 @@ if [ "x${INSTALL_DEFAULT_LOCALE}" != "x" ];then
# some OS has case sensitive locale spelling,
# try to autodetect it
AUTODETECTED_LOCALE=$(locale -a\
|egrep -i "^$( echo $INSTALL_DEFAULT_LOCALE \
|grep -E -i "^$( echo $INSTALL_DEFAULT_LOCALE \
| awk '{print tolower($0)}' \
|sed -re "s/([-_.])/\1?/g" )$" \
|head -n1)
Expand All @@ -110,7 +110,7 @@ if [ "x${INSTALL_DEFAULT_LOCALE}" != "x" ];then
if [ -e "$localesenv" ];then
log "Verifying $localesenv ($INSTALL_DEFAULT_LOCALE)"
for knob in $ALL_DEFAULT_LANG;do
if ! ( egrep -q "^(export +)?$knob=" "$localesenv" );then
if ! ( grep -E -q "^(export +)?$knob=" "$localesenv" );then
log "Installing $knob in $localesenv"
if [ "x$localesenv" = "x/etc/environment" ];then
echo "$knob=$INSTALL_DEFAULT_LOCALE" >> "$localesenv"
Expand Down
6 changes: 3 additions & 3 deletions helpers/system_detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ if [ -e /etc/arch-release ];then
system=archlinux
elif [ -e /etc/alpine-release ];then
system=alpine
elif ( egrep -iq "suse" $(find /etc/ImageVersion /etc/*-release 2>/dev/null||/bin/true 2>/dev/null) 2>/dev/null);then
elif ( grep -E -iq "suse" $(find /etc/ImageVersion /etc/*-release 2>/dev/null||/bin/true 2>/dev/null) 2>/dev/null);then
system=suse
elif ( egrep -iq "debian|mint|ubuntu" /etc/*-release 2>/dev/null);then
elif ( grep -E -iq "debian|mint|ubuntu" /etc/*-release 2>/dev/null);then
system=apt
elif ( egrep -iq "fedora|centos|ol|oracle|red.?hat" /etc/*-release 2>/dev/null);then
elif ( grep -E -iq "fedora|centos|ol|oracle|red.?hat" /etc/*-release 2>/dev/null);then
system=redhat
fi
echo $system
Expand Down
40 changes: 20 additions & 20 deletions helpers/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,66 +47,66 @@ done
if ( grep -q "release 6" /etc/redhat-release >/dev/null 2>&1 );then
NOSOCAT=1
fi
if (echo $DISTRIB_ID | egrep -iq "debian");then
if (echo $DISTRIB_ID | grep -E -iq "debian");then
if [ "x$DISTRIB_RELEASE" = "x" ];then
if [ -e /etc/debian_version ];then
DISTRIB_RELEASE=$(cat /etc/debian_version|sed -re "s!/sid!!")
fi
if (echo $DISTRIB_RELEASE | egrep -iq squeeze );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="6" ;fi
if (echo $DISTRIB_RELEASE | egrep -iq wheezy );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="7" ;fi
if (echo $DISTRIB_RELEASE | egrep -iq jessie );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="8" ;fi
if (echo $DISTRIB_RELEASE | egrep -iq stretch );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="9" ;fi
if (echo $DISTRIB_RELEASE | egrep -iq buster );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="10";fi
if (echo $DISTRIB_RELEASE | egrep -iq bullseye );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="11";fi
if (echo $DISTRIB_RELEASE | grep -E -iq squeeze );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="6" ;fi
if (echo $DISTRIB_RELEASE | grep -E -iq wheezy );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="7" ;fi
if (echo $DISTRIB_RELEASE | grep -E -iq jessie );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="8" ;fi
if (echo $DISTRIB_RELEASE | grep -E -iq stretch );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="9" ;fi
if (echo $DISTRIB_RELEASE | grep -E -iq buster );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="10";fi
if (echo $DISTRIB_RELEASE | grep -E -iq bullseye );then DISTRIB_CODENAME="$DISTRIB_RELEASE";DISTRIB_RELEASE="11";fi
fi
sed -i -re "s/(old)?oldstable/$DISTRIB_CODENAME/g" $(find /etc/apt/sources.list* -type f)
NAPTMIRROR="http.debian.net|httpredir.debian.org|deb.debian.org"
elif ( echo $DISTRIB_ID | egrep -iq "mint|ubuntu" );then
elif ( echo $DISTRIB_ID | grep -E -iq "mint|ubuntu" );then
NAPTMIRROR="archive.ubuntu.com|security.ubuntu.com"
fi
DEBIAN_LTS_SOURCELIST="
deb http://security.debian.org/ $DISTRIB_CODENAME/updates main contrib non-free
deb-src http://security.debian.org/ $DISTRIB_CODENAME/updates main contrib non-free
"
if ( echo $_cops_SYSTEM | egrep -iq "red.?hat" ) \
if ( echo $_cops_SYSTEM | grep -E -iq "red.?hat" ) \
&& (yum list installed fakesystemd >/dev/null 2>&1);then
yum swap -y fakesystemd systemd
fi
fix_epel() {
if ( echo $DISTRIB_RELEASE | egrep -iq "^(6|7)(\.|$)" ) &&\
if ( echo $DISTRIB_RELEASE | grep -E -iq "^(6|7)(\.|$)" ) &&\
[ "x$(find /etc/*repos* -name '*epel*.repo' 2>/dev/null | wc -l)" != "x0" ];then
log "Patching epel repo to use http"
sed -i "s/https/http/" /etc/*repos*/*epel*.repo
fi
}
PRE_PACKAGES="ca-certificates epel-release"
if ( echo $DISTRIB_ID | egrep -iq "centos|red|fedora" ) && ! ( echo $DISTRIB_ID | egrep -iq fedora );then
if ( echo $DISTRIB_ID | grep -E -iq "centos|red|fedora" ) && ! ( echo $DISTRIB_ID | grep -E -iq fedora );then
fix_epel
for pkg in $PRE_PACKAGES;do
( vv yum -y install $pkg || vv yum --disablerepo=epel -y install $pkg ) || /bin/true
( vv yum -y update $pkg || vv yum --disablerepo=epel -y update $pkg )
done
fix_epel
fi
if ( echo $DISTRIB_ID | egrep -iq "debian|mint|ubuntu" );then
if (echo $DISTRIB_ID|egrep -iq debian);then
if ( echo $DISTRIB_ID | grep -E -iq "debian|mint|ubuntu" );then
if (echo $DISTRIB_ID|grep -E -iq debian);then
sed -i -r -e '/(((squeeze)-(lts))|testing-backports)/d' \
$( find /etc/apt/sources.list* -type f; )
fi
if (echo $DISTRIB_ID|egrep -iq debian) && [ $DISTRIB_RELEASE -le $DEBIAN_OLDSTABLE ];then
if (echo $DISTRIB_ID|grep -E -iq debian) && [ $DISTRIB_RELEASE -le $DEBIAN_OLDSTABLE ];then
# fix old debian unstable images
sed -i -re "s!sid(/)?!$DISTRIB_CODENAME\1!" $(find /etc/apt/sources.list* -type f)
OAPTMIRROR="archive.debian.org"
sed -i -r -e '/-updates|security.debian.org/d' \
$( find /etc/apt/sources.list* -type f; )
if (echo $DISTRIB_ID|egrep -iq debian) && [ $DISTRIB_RELEASE -eq $DEBIAN_OLDSTABLE ];then
if (echo $DISTRIB_ID|grep -E -iq debian) && [ $DISTRIB_RELEASE -eq $DEBIAN_OLDSTABLE ];then
log "Using debian LTS packages"
echo "$DEBIAN_LTS_SOURCELIST" >> /etc/apt/sources.list
rm -rvf /var/lib/apt/*
fi
fi
if ( echo $DISTRIB_ID | egrep -iq "mint|ubuntu" ) && \
( echo $DISTRIB_RELEASE |egrep -iq $oldubuntu);then
if ( echo $DISTRIB_ID | grep -E -iq "mint|ubuntu" ) && \
( echo $DISTRIB_RELEASE |grep -E -iq $oldubuntu);then
OAPTMIRROR="old-releases.ubuntu.com"
sed -i -r \
-e 's/^(deb.*ubuntu)\/?(.*-(security|backport|updates).*)/#\1\/\2/g' \
Expand All @@ -124,7 +124,7 @@ if [ "x$OAPTMIRROR" != "x" ];then
fi
# fix broken curl if needed
curl_updated=
if ( echo $DISTRIB_ID | egrep -iq "debian|mint|ubuntu" );then
if ( echo $DISTRIB_ID | grep -E -iq "debian|mint|ubuntu" );then
if ( dpkg -l libcurl3 );then
set -x
for i in curl libcurl3;do
Expand Down Expand Up @@ -163,14 +163,14 @@ if [ -e /etc/fedora-release ];then
yumopts="$yumopts --$opt"
fi
done
if ( echo "$DISTRIB_ID $DISTRIB_RELEASE $DISTRIB_CODENAME"|egrep -iq "20|heisenbug" );then
if ( echo "$DISTRIB_ID $DISTRIB_RELEASE $DISTRIB_CODENAME"|grep -E -iq "20|heisenbug" );then
DISTRO_SYNC=1
fi
if [ "x$DISTRO_SYNC" != "x" ];then vv yum -y distro-sync;fi
# be sure to install locales
yum install $yumopts -y glibc-common
fi
if ( echo "$DISTRIB_ID $DISTRIB_RELEASE $DISTRIB_CODENAME" | egrep -iq alpine );then
if ( echo "$DISTRIB_ID $DISTRIB_RELEASE $DISTRIB_CODENAME" | grep -E -iq alpine );then
log "Upgrading alpine"
apk upgrade --update-cache --available
fi
Expand Down
Loading

0 comments on commit 28b2921

Please sign in to comment.