feat(ubuntu): add apt-fast support (#13175)

This commit is contained in:
Amr Elsayyad 2025-06-19 11:05:40 +03:00 committed by GitHub
parent 7ee92de190
commit f8022980a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 10 deletions

View File

@ -10,10 +10,11 @@ plugins=(... ubuntu)
## Aliases ## Aliases
Commands that use `$APT` will use `apt` if installed or defer to `apt-get` otherwise. Commands that use `$APT` will use `apt-fast` if installed, or `apt` if installed, or defer to `apt-get`
otherwise.
| Alias | Command | Description | | Alias | Command | Description |
|---------|--------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------| | ------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| age | `sudo $APT` | Run apt-get with sudo | | age | `sudo $APT` | Run apt-get with sudo |
| acs | `apt-cache search` | Search the apt-cache with the specified criteria | | acs | `apt-cache search` | Search the apt-cache with the specified criteria |
| acsp | `apt-cache showpkg` | Shows information about the listed packages | | acsp | `apt-cache showpkg` | Shows information about the listed packages |
@ -26,7 +27,7 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
| agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation | | agd | `sudo $APT dselect-upgrade` | Follows dselect choices for package installation |
| agi | `sudo $APT install <pkg>` | Install the specified package | | agi | `sudo $APT install <pkg>` | Install the specified package |
| agli | `apt list --installed` | List the installed packages | | agli | `apt list --installed` | List the installed packages |
| aglu | `sudo apt-get -u upgrade --assume-no` | Run an apt-get upgrade assuming no to all prompts | | aglu | `apt list --upgradable` | List available updates only |
| agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files | | agp | `sudo $APT purge <pkg>` | Remove a package including any configuration files |
| agr | `sudo $APT remove <pkg>` | Remove a package | | agr | `sudo $APT remove <pkg>` | Remove a package |
| ags | `$APT source <pkg>` | Fetch the source for the specified package | | ags | `$APT source <pkg>` | Fetch the source for the specified package |
@ -40,17 +41,16 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
| mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package | | mydeb | `time dpkg-buildpackage -rfakeroot -us -uc` | Create a basic .deb package |
| ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA | | ppap | `sudo ppa-purge <ppa>` | Remove the specified PPA |
## Functions ## Functions
| Function | Usage | Description | | Function | Usage | Description |
|-------------------|---------------------------------------|--------------------------------------------------------------------------| | ----------------- | ------------------------------------- | ------------------------------------------------------------------------ |
| aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package | | aar | `aar ppa:xxxxxx/xxxxxx [packagename]` | apt-add-repository with automatic install/upgrade of the desired package |
| apt-history | `apt-history <action>` | Prints the Apt history of the specified action | | apt-history | `apt-history <action>` | Prints the Apt history of the specified action |
| apt-list-packages | `apt-list-packages` | List packages by size | | apt-list-packages | `apt-list-packages` | List packages by size |
| kerndeb | `kerndeb` | Kernel-package building shortcut | | kerndeb | `kerndeb` | Kernel-package building shortcut |
## Authors: ## Authors
- [@AlexBio](https://github.com/AlexBio) - [@AlexBio](https://github.com/AlexBio)
- [@dbb](https://github.com/dbb) - [@dbb](https://github.com/dbb)
@ -59,3 +59,4 @@ Commands that use `$APT` will use `apt` if installed or defer to `apt-get` other
- [Nicolas Jonas](https://nextgenthemes.com) - [Nicolas Jonas](https://nextgenthemes.com)
- [@loctauxphilippe](https://github.com/loctauxphilippe) - [@loctauxphilippe](https://github.com/loctauxphilippe)
- [@HaraldNordgren](https://github.com/HaraldNordgren) - [@HaraldNordgren](https://github.com/HaraldNordgren)
- [@AmrElsayyad](https://github.com/AmrElsayyad)

View File

@ -1,11 +1,22 @@
(( $+commands[apt] )) && APT=apt || APT=apt-get # Detect available package manager (prefer apt-fast > apt > apt-get)
if (( $+commands[apt-fast] )); then
APT=apt-fast
elif (( $+commands[apt] )); then
APT=apt
else
APT=apt-get
fi
alias acs='apt-cache search' alias acs='apt-cache search'
alias afs='apt-file search --regexp' alias afs='apt-file search --regexp'
# These are apt/apt-get only # These are apt/apt-get only
alias ags="$APT source" if (( $+commands[apt] )); then
alias ags="apt source"
else
alias ags="apt-get source"
fi
alias acp='apt-cache policy' alias acp='apt-cache policy'