Yet again another standarize effort

This commit is contained in:
Luis Guzmán 2021-02-18 02:21:59 -06:00
parent 96a3845a84
commit efb8552ec7
3 changed files with 14 additions and 11 deletions

View File

@ -44,8 +44,8 @@ fi
if [ -z $CHDB ]; then if [ -z $CHDB ]; then
echo "Seems no chromedriver installed" echo "Seems no chromedriver installed"
else else
CHD_AVB="$($CHDB -v | awk '{print $2}')" CHD_VER_LOCAL="$($CHDB -v | awk '{print $2}')"
CHD_AVB_2D="$(echo $CHD_AVB|cut -d "." -f 1,2)" CHD_VER_2D="$(echo $CHD_VER_LOCAL|cut -d "." -f 1,2)"
fi fi
# True if $1 is greater than $2 # True if $1 is greater than $2
@ -90,16 +90,17 @@ upgrade_cd() {
if [ ! -z $GOOGL_VER_2D ]; then if [ ! -z $GOOGL_VER_2D ]; then
if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ if version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \
[ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
then
echo "Upgrading Chromedriver to Google Chromes version" echo "Upgrading Chromedriver to Google Chromes version"
wget https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \
unzip chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip
sudo cp chromedriver $CHDB unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/
rm -rf chromedriver chromedriver_linux64.zip chown root:root $CHDB
chmod 0755 $CHDB
rm -rf /tpm/chromedriver_linux64.zip
chromedriver -v chromedriver -v
else else
echo "No need to upgrade Chromedriver" echo "No need to upgrade Chromedriver"
printf "Current version: ${Green} $CHD_AVB_2D ${Color_Off}\n" printf "Current version: ${Green} $CHD_VER_2D ${Color_Off}\n"
fi fi
else else
printf "${Yellow} -> No Google Chrome versión to match, leaving untouched.${Color_Off}\n" printf "${Yellow} -> No Google Chrome versión to match, leaving untouched.${Color_Off}\n"
@ -109,7 +110,7 @@ fi
check_lst_cd() { check_lst_cd() {
printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n" printf "${Purple}Checking for the latest Chromedriver${Color_Off}\n"
if [ -f $CHDB ]; then if [ -f $CHDB ]; then
printf "Current installed Chromedriver: ${Yellow} $CHD_AVB_2D ${Color_Off}\n" printf "Current installed Chromedriver: ${Yellow} $CHD_VER_2D ${Color_Off}\n"
printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n" printf "Current installed Google Chrome: ${Green} $GOOGL_VER_2D ${Color_Off}\n"
upgrade_cd upgrade_cd
else else

View File

@ -379,7 +379,8 @@ if [ -f /usr/local/bin/chromedriver ]; then
echo "Chromedriver already installed." echo "Chromedriver already installed."
else else
echo "Installing Chromedriver" echo "Installing Chromedriver"
wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \
-O /tmp/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/ unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/
chown root:root /usr/local/bin/chromedriver chown root:root /usr/local/bin/chromedriver
chmod 0755 /usr/local/bin/chromedriver chmod 0755 /usr/local/bin/chromedriver

View File

@ -117,7 +117,8 @@ if [ ! -z "$CHD_VER_LOCAL" ] && [ ! -z "$GOOGL_VER_LOCAL" ]; then
elif version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \ elif version_gt "$GOOGL_VER_2D" "$CHD_VER_2D" && \
[ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then [ "$GOOGL_VER_2D" = "$CHD_LTST_2D" ]; then
echo -e "\nAttempting Chromedriver update!" echo -e "\nAttempting Chromedriver update!"
wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip -O /tmp/chromedriver_linux64.zip wget -q https://chromedriver.storage.googleapis.com/$CHD_LTST/chromedriver_linux64.zip \
-O /tmp/chromedriver_linux64.zip
unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/ unzip /tmp/chromedriver_linux64.zip -d /usr/local/bin/
chown root:root $CHDB chown root:root $CHDB
chmod 0755 $CHDB chmod 0755 $CHDB