#!/usr/bin/env bash italic="\033[3m" underline="\033[4m" ita_under="\033[3;4m" bgd="\033[1;4;31m" red="\033[1;31m" bold="\033[1m" box="\033[1;41m" reset="\033[0m" echo -e "${bold}🐍 Update apps in Python virtuals environments ${reset}\n" ########################################################### # # Configuration # ########################################################### mkdocs_ext=("mkdocs-material" "mkdocs-material-extensions" "mkdocs-git-revision-date-localized-plugin" "mkdocs-minify-plugin" "fontawesome_markdown" "mkdocs-pdf-export-plugin") sound="Glass" image="$BKP_BASE_DIR/success.png" # macos: silverbook if [[ "$OSTYPE" == "darwin"* ]]; then v=$HOME/Documents/venv # Listes des apps: declare -a apps=("soco-cli" "mkdocs") # solus: linux-gnu elif [[ "$OSTYPE" == "linux-gnu" ]]; then v=$HOME/Applications # Listes des apps: declare -a apps=("soco-cli" "mkdocs") # rpi4: linux_gnueabihf # rpi3: elif [[ "$OSTYPE" == "linux_gnueabihf" ]]; then v=$HOME/venv # Listes des apps: declare -a apps=("soco-cli" "mkdocs") fi ########################################################### # # Script # ########################################################### for app in ${apps[*]} do echo -e "${bold}Update $app${reset}"; cd "$v/$app" source bin/activate python3 -V pip3 install -U pip setuptools echo "" info=$(pip3 show "$app") l1=$(echo "$info" | sed -n '1p') l1="\\\033[4m$l1\\\033[0m" info=$(echo "$info" | sed "1s/.*/$l1/") echo -e "$info" upd=$(pip3 install -U "$app") a=$(grep "Successfully installed" <<< "$upd") if [ -n "$a" ]; then if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then terminal-notifier -title "Update $app package" -message "" -sound "$sound" -contentImage "$image" elif [[ "$OSTYPE" == "linux-gnu" ]] && [ -x "$(command -v notify-send)" ]; then notify-send -i "/usr/share/icons/Adwaita/48x48/legacy/face-laugh.png" "Update $app package" "" fi fi <