Created
May 6, 2023 20:22
-
-
Save rnek0/04ac9dcf804d9a9b8b02dd78bebd5a39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -u Comprueba, descarga actualizaciones. | |
function updateFiles(){ | |
tput civis | |
if [ ! -f bundle.js ]; then | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} Descargando archivos necesarios...${endColour}" | |
curl -s $main_url > bundle.js | |
js-beautify bundle.js | sponge bundle.js | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} Todos los archivos han sido descargados.${endColour}\n" | |
else | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} Comprobando si hay actualizaciones.${endColour}" | |
curl -s $main_url > bundle_temp.js | |
js-beautify bundle_temp.js | sponge bundle_temp.js | |
md5_temp_value="$(md5sum bundle_temp.js| awk '{print $1}')" | |
md5_original_value="$(md5sum bundle.js| awk '{print $1}')" | |
if [ "$md5_temp_value" == "$md5_original_value" ]; then | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} No se han detectado actualizaciones, lo tienes todo al dia.${endColour}\n" | |
rm bundle_temp.js | |
else | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} Se han encontrado actualizaciones disponibles.${endColour}" | |
sleep 2 | |
cp bundle_temp.js bundle.js | |
rm bundle_temp.js | |
echo -e "\n${yellowColour}[+]${endColour}${grayColour} Actualizaciones terminadas.${endColour}\n" | |
fi | |
fi | |
tput cnorm | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment