diff --git a/README.md b/README.md index 4bb2df3..50d9c90 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,20 @@ curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/ma | bash -s -- /your/tdarr/plugins/FlowPlugins ``` +By default, the installer downloads only the latest version of every plugin. +Use `--all` to download every version retained in the repository: + +```bash +# Latest versions of all plugins +./install.sh /your/tdarr/plugins/FlowPlugins --latest + +# All available versions of all plugins +./install.sh /your/tdarr/plugins/FlowPlugins --all + +# All available versions of selected plugins +./install.sh /your/tdarr/plugins/FlowPlugins --all replaceOriginalFile copyToWorkDir +``` + **Update a single plugin** (e.g. after a bug fix): ```bash curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \ diff --git a/install.sh b/install.sh index 950fe65..4ce388e 100644 --- a/install.sh +++ b/install.sh @@ -2,9 +2,11 @@ # install.sh — Update Tdarr plugins from Gitea raw file URLs. # # Usage: -# ./install.sh # update ALL plugins -# ./install.sh transcode2PassX265 # update ONE plugin -# ./install.sh p1 p2 p3 # update MULTIPLE plugins +# ./install.sh # latest version of ALL plugins +# ./install.sh --latest # latest version of ALL plugins +# ./install.sh --all # every available plugin version +# ./install.sh --all p1 p2 # every version of selected plugins +# ./install.sh --latest p1 p2 # latest version of selected plugins # # Or pipe directly from Gitea (no clone needed): # curl -fsSL https://git.cdtech.freeddns.org/PickleRick/Tdarr-plugin/raw/branch/main/install.sh \ @@ -48,7 +50,14 @@ fi PLUGIN_DIR="$1" shift -# If no specific plugins requested, update all +# Version mode defaults to the latest version only. +VERSION_MODE="latest" +if [[ "${1:-}" == "--all" || "${1:-}" == "--latest" ]]; then + VERSION_MODE="${1#--}" + shift +fi + +# If no specific plugins requested, update all. if [[ $# -eq 0 ]]; then TARGETS=("${!PLUGIN_CATEGORY[@]}") else @@ -66,10 +75,13 @@ download_plugin() { fi local versions="1.0.0" - if [[ "$name" == "copyToWorkDir" ]]; then + if [[ "$VERSION_MODE" == "all" ]]; then + case "$name" in + copyToWorkDir) versions="1.0.0 2.0.0" ;; + replaceOriginalFile) versions="1.0.0 2.0.0" ;; + esac + elif [[ "$name" == "copyToWorkDir" || "$name" == "replaceOriginalFile" ]]; then versions="2.0.0" - elif [[ "$name" == "replaceOriginalFile" ]]; then - versions="1.0.0 2.0.0" fi for version in $versions; do @@ -109,7 +121,9 @@ for plugin in "${TARGETS[@]}"; do download_plugin "$plugin" || ERRORS=$((ERRORS + 1)) done -if [[ $# -eq 0 || " ${TARGETS[*]} " == *" copyToWorkDir "* || " ${TARGETS[*]} " == *" replaceOriginalFile "* ]]; then +if [[ "$VERSION_MODE" == "all" + || " ${TARGETS[*]} " == *" copyToWorkDir "* + || " ${TARGETS[*]} " == *" replaceOriginalFile "* ]]; then download_progress_helper || ERRORS=$((ERRORS + 1)) fi