Merge pull request #76 from RXT067:what-the-bash/pckm

This commit is contained in:
Koichi Murase
2022-02-22 18:46:39 +09:00
4 changed files with 106 additions and 0 deletions
+12
View File
@@ -174,6 +174,18 @@ If you would like to track the upstream changes for your customized version of m
If you would like to replace an existing module (theme/plugin/aliases/complet) bundled with Oh My Bash, create a module of the same name in the `custom/` directory so that it will be loaded instead of the original one.
### Configuration
#### Disable internal uses of `sudo`
Some plugins of oh-my-bash internally use `sudo` when it is necessary. However, this might clutter with the `sudo` log. To disable the use of `sudo` by oh-my-bash, `OMB_USE_SUDO` can be set to `false` in `~/.bashrc`.
```bash
OMB_USE_SUDO=false
```
Each plugin might provides finer configuration variables to control the use of `sudo` by each plugin.
## Getting Updates
By default, you will be prompted to check for upgrades every few weeks. If you would like `oh-my-bash` to automatically upgrade itself without prompting you, set the following in your `~/.bashrc`:
+20
View File
@@ -0,0 +1,20 @@
# aliases
## alias:package-manager
This plugin provides the set of aliases that can be used to control package managers. Here is the list of the supported aliases for each package manager. You can find the details of each alias in the source [`package-manager.aliases.bash`](package-manager.aliases.bash).
- `emerge` (Portage Enoch Merge) ... `em`, `es`, `esync`, `eb`, `er`, `ers`, `emfu`, `elip`
- `cave` (Paludis Cave) ... `cave`, `cr`, `cui`, `cs`, `cli`
- `apt` (Advanced Packaging Tool) ... `apt`, `aptfu`, `apti`, `apts`, `aptr`, `aptar`, `aptli`
- `dpkg` (Debian Package) ... `dpkg`
The command to use to call these package manager can be specified in the variable `OMB_ALIAS_PACKAGE_MANAGER_SUDO`. By default, `sudo` is used when the current use is not root and the command `sudo` is available.
```bash
# Use sudo to run the package manager
OMB_ALIAS_PACKAGE_MANAGER_SUDO=sudo
# Do not use sudo but directly run the package manager
OMB_ALIAS_PACKAGE_MANAGER_SUDO=
```
+70
View File
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# Created by Jacob Hrbek github.com in 2019
# A local temporary variable
declare _omb_tmp_sudo
# Switch for the use of "sudo"
_omb_tmp_sudo=
if [[ ${OMB_ALIAS_PACKAGE_MANAGER_SUDO+set} ]]; then
_omb_tmp_sudo=${OMB_ALIAS_PACKAGE_MANAGER_SUDO:+$OMB_ALIAS_PACKAGE_MANAGER_SUDO }
elif [[ ${OMB_USE_SUDO-true} == true ]]; then
if ((EUID != 0)) && _omb_util_binary_exists sudo; then
_omb_tmp_sudo='sudo '
fi
fi
# Portage - Enoch Merge
if _omb_util_binary_exists emerge; then
alias em="${_omb_tmp_sudo}emerge" # Enoch Merge
alias es="${_omb_tmp_sudo}emerge --search" # Enoch Search
alias esync="${_omb_tmp_sudo}emerge --sync" # Enoch SYNC
alias eb="${_omb_tmp_sudo}ebuild" # Enoch Build
alias er="${_omb_tmp_sudo}emerge -c" # Enoch Remove
alias ers="${_omb_tmp_sudo}emerge -c" # Enoch Remove Systempackage
alias emfu="${_omb_tmp_sudo}emerge --sync && ${_omb_tmp_sudo}emerge -uDUj @world"
alias elip="${_omb_tmp_sudo}eix-installed -a" # Enoch List Installed Packages
fi
# Paludis - Cave
if _omb_util_binary_exists cave; then
alias cave="${_omb_tmp_sudo}cave"
alias cr="${_omb_tmp_sudo}cave resolve" # Cave Resolve
alias cui="${_omb_tmp_sudo}cave uninstall" # Cave UnInstall
alias cs="${_omb_tmp_sudo}cave show" # Cave Show
alias cli="${_omb_tmp_sudo}cave print-ids --matching '*/*::/'" # Cave List Installed
fi
# Advanced Packaging Tool - APT
if _omb_util_binary_exists apt; then
alias apt="${_omb_tmp_sudo}apt" # Advanced Packaging Tool
alias aptfu="${_omb_tmp_sudo}apt update -y && ${_omb_tmp_sudo}apt upgrade -y && ${_omb_tmp_sudo}apt dist-upgrade -y && ${_omb_tmp_sudo}apt autoremove -y"
alias apti="${_omb_tmp_sudo}apt install -y" # Apt install
alias apts="${_omb_tmp_sudo}apt-cache search" # Apt search
alias aptr="${_omb_tmp_sudo}apt remove -y" # Apt remove
alias aptar="${_omb_tmp_sudo}apt autoremove -y" # Apt Auto Remove
alias aptli="${_omb_tmp_sudo}apt list --installed"
fi
# Debian PacKaGe - DPKG
if _omb_util_binary_exists dpkg; then
alias dpkg="${_omb_tmp_sudo}dpkg"
fi
# # Zypper = Zen Yast Package Program (ZYPP?)
# if _omb_util_binary_exists zypper; then
# # Yast = Yet Another Silly/Setup Thing/Thing
# alias lcp="${_omb_tmp_sudo}zypper"
# alias lcpi="${_omb_tmp_sudo}zypper install"
# alias lcps="${_omb_tmp_sudo}zypper search"
# alias lcpsi="${_omb_tmp_sudo}zypper source-install"
# alias lcpr="${_omb_tmp_sudo}zypper remove"
# if grep -q 'openSUSE Tumbleweed' /etc/os-release; then
# # Zypper update kills the system - LCP
# alias lcpfu="${_omb_tmp_sudo}zypper dup"
# # Because Geeko uses sublime3 to call sublime_text instead of something that makes sence like 'subl'..
# alias subl="${_omb_tmp_sudo}sublime3"
# fi
# fi
unset -v _omb_tmp_sudo
+4
View File
@@ -49,6 +49,10 @@ OSH_THEME="font"
# Would you like to use another custom folder than $OSH/custom?
# OSH_CUSTOM=/path/to/new-custom-folder
# To disable the uses of "sudo" by oh-my-bash, please set "false" to
# this variable. The default behavior for the empty value is "true".
OMB_USE_SUDO=true
# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*)
# Custom completions may be added to ~/.oh-my-bash/custom/completions/
# Example format: completions=(ssh git bundler gem pip pip3)