Skip to content

Scoop 脚本,用于下载和更新软件时使用替换后的 url。Scoop script that uses the replaced url during the installation and update.

License

Notifications You must be signed in to change notification settings

abgox/scoop-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨scoop-tools✨

简体中文 | English | Github | Gitee

license version code size repo size created


Introduction

  • Some PowerShell scripts that allows you to add Scoop configurations to use a replaced url instead of the original url when installing the app in Scoop.
    • scoop-install
    • scoop-update
  • Typical case: if app come from GitHub, you can configure a proxy URL to improve download experience in China.

Installation

  • Add bucket

    scoop bucket add abyss https://gitee.com/abgox/abyss
  • Install scoop-install

    scoop install abyss/abgox.scoop-install
  • Install scoop-update

    scoop install abyss/abgox.scoop-update

Usage

Tip

Scoop Config

  • scoop-install-url-replace-from: The URL to replace, use regular expressions. Use ^ to match the beginning of the URL.
  • scoop-install-url-replace-to: The replacement URL that corresponds to scoop-install-url-replace-from.
  1. Set URL replacement configurations. Use ||| as a delimiter if there are multiple values.

    scoop config scoop-install-url-replace-from "^https://github.com|||^https://raw.githubusercontent.com"
    scoop config scoop-install-url-replace-to "https://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com"
  2. Install PSCompletions to add command completion.

    scoop install abyss/abgox.pscompletions
    Import-Module PSCompletions
    psc add scoop-install scoop-update
  3. Install apps using the scoop-install command.

    scoop-install abyss/Microsoft.PowerShell
  4. Update apps using the scoop-update command.

    scoop-update abyss/Microsoft.PowerShell

  • scoop-install supports the -reset parameter and all parameters of the scoop install command.

  • scoop-update supports the -reset parameter and all parameters of the scoop update command.

  • Examples:

    • If you want to undo all local file changes in the buckets to avoid synchronization conflicts during scoop update.

      • It uses git stash to undo.
      • If you still need these changes, you can use git stash pop. For details, refer to git stash
      scoop-install -reset
    • If you want to install abyss/abgox.InputTip-zip without updating Scoop, you can use -u or --no-update-scoop.

      scoop-install abyss/Microsoft.PowerShell -u
    • If you don't also want to use the download cache, you can use -k or --no-cache.

      scoop-install abyss/Microsoft.PowerShell -u --no-cache

How It Works

Tip

When you run scoop-install abyss/Microsoft.PowerShell, it goes through the following process:

  1. scoop-install reads the following two configuration values:

    • scoop-install-url-replace-from
    • scoop-install-url-replace-to
  2. It replaces url in the manifest file of abyss/Microsoft.PowerShell based on these configurations.

    • For example, if you use the following configuration:

      • scoop-install-url-replace-from is set to ^https://github.com|||^https://raw.githubusercontent.com
      • scoop-install-url-replace-to is set to https://gh-proxy.com/github.com|||https://gh-proxy.com/raw.githubusercontent.com
    • It will split the values by ||| and replace the url accordingly:

      • ^https://github.com matches url starting with https://github.com and replaces them with https://gh-proxy.com/github.com.
      • ^https://raw.githubusercontent.com is replaced with https://gh-proxy.com/raw.githubusercontent.com.
  3. After replacement, scoop-install runs the actual scoop install command.

    • Since url of the manifest have been replaced with https://gh-proxy.com, Scoop will download the installation packages from https://gh-proxy.com.
  4. Once the installation is complete (or interrupted with Ctrl + C), scoop-install automatically undos the changes made to the manifest file.

    • If you close the terminal during installation, it cannot undo the changes.

    • This may cause issues with scoop update due to local file modifications conflicting with the remote bucket.

    • In that case, you can run scoop-install -reset, which will undo local file changes in all buckets via git stash.

      • It uses git stash to undo.
      • If you still need these changes, you can use git stash pop. For details, refer to git stash

About

Scoop 脚本,用于下载和更新软件时使用替换后的 url。Scoop script that uses the replaced url during the installation and update.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project