From 512657ad7fb3d479786af83f6ab7e4e551c24d1f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 29 Apr 2020 22:32:07 +0000 Subject: [PATCH 1/2] Restyled by shellharden --- install-dev-dependencies.sh | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/install-dev-dependencies.sh b/install-dev-dependencies.sh index db3a50063790..8ae841578c34 100755 --- a/install-dev-dependencies.sh +++ b/install-dev-dependencies.sh @@ -11,18 +11,18 @@ if [ "$1" != "--no-prompt" ]; then echo echo -n "Are you sure you want to continue? [y/N]: " read CONTINUE - CONTINUE=`echo $CONTINUE | xargs | head -c 1 | awk '{print tolower($0)}'` + CONTINUE=`echo "$CONTINUE" | xargs | head -c 1 | awk '{print tolower($0)}'` if [ "$CONTINUE" != "y" ]; then exit fi echo fi -if [ $UID != 0 ]; then +if [ "$UID" != 0 ]; then SUDO_SHIM=sudo fi -if [ "`uname -m`" == "x86_64" ]; then +if [ "$(uname -m)" == "x86_64" ]; then ARCH=64 else ARCH=32 @@ -30,8 +30,8 @@ fi # debian based installation if type apt-get>/dev/null 2>&1; then - $SUDO_SHIM apt-get update - $SUDO_SHIM apt-get install -y lsb-release + "$SUDO_SHIM" apt-get update + "$SUDO_SHIM" apt-get install -y lsb-release BROWSERS="firefox chromium-browser" CHROMEDRIVER="chromium-chromedriver" if [[ "$(lsb_release -is)" == "Debian" ]]; then @@ -41,19 +41,19 @@ if type apt-get>/dev/null 2>&1; then BROWSERS="iceweasel chromium" CHROMEDRIVER="chromedriver" fi - $SUDO_SHIM apt-get install -y libxml2-dev libxml2-utils libxslt1-dev \ - python3.6-dev $BROWSERS zip sqlite3 python3-pip libcurl4-openssl-dev xvfb \ - libssl-dev git curl $CHROMEDRIVER + "$SUDO_SHIM" apt-get install -y libxml2-dev libxml2-utils libxslt1-dev \ + python3.6-dev "$BROWSERS" zip sqlite3 python3-pip libcurl4-openssl-dev xvfb \ + libssl-dev git curl "$CHROMEDRIVER" if ! type geckodriver >/dev/null 2>&1; then curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux$ARCH.tar.gz" tar -zxvf "geckodriver-v0.24.0-linux$ARCH.tar.gz" rm -f "geckodriver-v0.24.0-linux$ARCH.tar.gz" - $SUDO_SHIM mv geckodriver /usr/bin/geckodriver - $SUDO_SHIM chown root /usr/bin/geckodriver - $SUDO_SHIM chmod 755 /usr/bin/geckodriver + "$SUDO_SHIM" mv geckodriver /usr/bin/geckodriver + "$SUDO_SHIM" chown root /usr/bin/geckodriver + "$SUDO_SHIM" chmod 755 /usr/bin/geckodriver fi - if [ ! -f /usr/lib/chromium-browser/chromedriver ] && [ -f `which chromedriver` ]; then - $SUDO_SHIM ln -s `which chromedriver` /usr/lib/chromium-browser/chromedriver + if [ ! -f /usr/lib/chromium-browser/chromedriver ] && [ -f "$(which chromedriver)" ]; then + "$SUDO_SHIM" ln -s "$(which chromedriver)" /usr/lib/chromium-browser/chromedriver fi # macOS installation @@ -61,35 +61,35 @@ elif type brew >/dev/null 2>&1; then brew list python &>/dev/null || brew install python brew cask install chromedriver brew install libxml2 gnu-sed - if ! echo $PATH | grep -ql /usr/local/bin ; then + if ! echo "$PATH" | grep -ql /usr/local/bin ; then echo '/usr/local/bin not found in $PATH, please add it.' fi # distros that use rpm (Fedora, Suse, CentOS) installation elif type dnf >/dev/null 2>&1; then - $SUDO_SHIM dnf install -y firefox gcc git libcurl-devel libxml2-devel \ + "$SUDO_SHIM" dnf install -y firefox gcc git libcurl-devel libxml2-devel \ libxslt-devel python3-devel redhat-rpm-config xorg-x11-server-Xvfb which \ findutils procps openssl openssl-devel chromium GConf2 if ! type chromedriver >/dev/null; then curl -O "https://chromedriver.storage.googleapis.com/2.23/chromedriver_linux$ARCH.zip" unzip "chromedriver_linux$ARCH.zip" rm -f "chromedriver_linux$ARCH.zip" - $SUDO_SHIM mv chromedriver /usr/bin/chromedriver - $SUDO_SHIM chown root /usr/bin/chromedriver - $SUDO_SHIM chmod 755 /usr/bin/chromedriver + "$SUDO_SHIM" mv chromedriver /usr/bin/chromedriver + "$SUDO_SHIM" chown root /usr/bin/chromedriver + "$SUDO_SHIM" chmod 755 /usr/bin/chromedriver fi if ! type geckodriver >/dev/null 2>&1; then curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz" tar -zxvf "geckodriver-v0.24.0-macos.tar.gz" rm -f "geckodriver-v0.24.0-macos.tar.gz" - $SUDO_SHIM mv geckodriver /usr/bin/geckodriver - $SUDO_SHIM chown root /usr/bin/geckodriver - $SUDO_SHIM chmod 755 /usr/bin/geckodriver + "$SUDO_SHIM" mv geckodriver /usr/bin/geckodriver + "$SUDO_SHIM" chown root /usr/bin/geckodriver + "$SUDO_SHIM" chmod 755 /usr/bin/geckodriver fi # This is needed for Firefox on some systems. See here for more information: # https://github.com/EFForg/https-everywhere/pull/5584#issuecomment-238655443 if [ ! -f /var/lib/dbus/machine-id ]; then - $SUDO_SHIM sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id' + "$SUDO_SHIM" sh -c 'dbus-uuidgen > /var/lib/dbus/machine-id' fi export PYCURL_SSL_LIBRARY=openssl else From cf0b12b364261adace37ec82f19dc4a4b7538285 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 29 Apr 2020 22:32:08 +0000 Subject: [PATCH 2/2] Restyled by shfmt --- install-dev-dependencies.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/install-dev-dependencies.sh b/install-dev-dependencies.sh index 8ae841578c34..767dbae82d75 100755 --- a/install-dev-dependencies.sh +++ b/install-dev-dependencies.sh @@ -11,7 +11,7 @@ if [ "$1" != "--no-prompt" ]; then echo echo -n "Are you sure you want to continue? [y/N]: " read CONTINUE - CONTINUE=`echo "$CONTINUE" | xargs | head -c 1 | awk '{print tolower($0)}'` + CONTINUE=$(echo "$CONTINUE" | xargs | head -c 1 | awk '{print tolower($0)}') if [ "$CONTINUE" != "y" ]; then exit fi @@ -29,7 +29,7 @@ else fi # debian based installation -if type apt-get>/dev/null 2>&1; then +if type apt-get >/dev/null 2>&1; then "$SUDO_SHIM" apt-get update "$SUDO_SHIM" apt-get install -y lsb-release BROWSERS="firefox chromium-browser" @@ -44,7 +44,7 @@ if type apt-get>/dev/null 2>&1; then "$SUDO_SHIM" apt-get install -y libxml2-dev libxml2-utils libxslt1-dev \ python3.6-dev "$BROWSERS" zip sqlite3 python3-pip libcurl4-openssl-dev xvfb \ libssl-dev git curl "$CHROMEDRIVER" - if ! type geckodriver >/dev/null 2>&1; then + if ! type geckodriver >/dev/null 2>&1; then curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux$ARCH.tar.gz" tar -zxvf "geckodriver-v0.24.0-linux$ARCH.tar.gz" rm -f "geckodriver-v0.24.0-linux$ARCH.tar.gz" @@ -61,7 +61,7 @@ elif type brew >/dev/null 2>&1; then brew list python &>/dev/null || brew install python brew cask install chromedriver brew install libxml2 gnu-sed - if ! echo "$PATH" | grep -ql /usr/local/bin ; then + if ! echo "$PATH" | grep -ql /usr/local/bin; then echo '/usr/local/bin not found in $PATH, please add it.' fi @@ -78,7 +78,7 @@ elif type dnf >/dev/null 2>&1; then "$SUDO_SHIM" chown root /usr/bin/chromedriver "$SUDO_SHIM" chmod 755 /usr/bin/chromedriver fi - if ! type geckodriver >/dev/null 2>&1; then + if ! type geckodriver >/dev/null 2>&1; then curl -LO "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-macos.tar.gz" tar -zxvf "geckodriver-v0.24.0-macos.tar.gz" rm -f "geckodriver-v0.24.0-macos.tar.gz" @@ -93,10 +93,10 @@ elif type dnf >/dev/null 2>&1; then fi export PYCURL_SSL_LIBRARY=openssl else - echo \ - "Your distro isn't supported by this script yet!"\ + echo \ + "Your distro isn't supported by this script yet!" \ "Please install dependencies manually." - exit + exit fi # Get the addon SDK submodule and rule checker