Compare commits
15 Commits
0.1.0
...
14fbf3c41e
| Author | SHA1 | Date | |
|---|---|---|---|
| 14fbf3c41e | |||
| ba07f6275d | |||
| 8e2bdd88d3 | |||
| 8b23dc96a3 | |||
| 7b3de6cef0 | |||
| 2c209fd7a0 | |||
| b1306a73b4 | |||
| e2789d200b | |||
| eddbe307c2 | |||
| 3e22f4ebbd | |||
| cdc17a329b | |||
| fd49c9e953 | |||
| eeaee974bd | |||
| 0df0a8dd6e | |||
| aa97ad4c20 |
28
PKGBUILD
Normal file
28
PKGBUILD
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Maintainer: Bryan Joshua Pedini <bryan [at] pedini [dot] dev>
|
||||||
|
|
||||||
|
_pkgname="pman"
|
||||||
|
pkgname="$_pkgname-helper"
|
||||||
|
pkgver="1.2.0"
|
||||||
|
pkgrel="1"
|
||||||
|
pkgdesc="A `pacman` helper script, because you forget all the stupid flags"
|
||||||
|
url="https://git.bjphoster.com/source/$_pkgname"
|
||||||
|
arch=("any")
|
||||||
|
license=("MIT")
|
||||||
|
depends=("bash" "pacman")
|
||||||
|
conflicts=("pman") # Another package called `pman` currently exists in the AUR
|
||||||
|
source=(
|
||||||
|
"LICENSE"
|
||||||
|
"pman.sh"
|
||||||
|
)
|
||||||
|
sha256sums=(
|
||||||
|
"3964e8cf1894ecfea6ca57cf350e7a538229cd205ac35293ea8bf3fb19c0b86f"
|
||||||
|
"6bb6aab1dd31ae0a326a24afc34e62da13d482843fad5872562135007b43f1a5"
|
||||||
|
)
|
||||||
|
md5sums=(
|
||||||
|
"72db3ecfa718db796cd818f883cbdc68"
|
||||||
|
"369ea3fa3fb44dcfe035a297f64af9e5"
|
||||||
|
)
|
||||||
|
package() {
|
||||||
|
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||||
|
install -Dm755 pman.sh "${pkgdir}/usr/bin/${_pkgname}"
|
||||||
|
}
|
||||||
16
README.md
16
README.md
@@ -1,15 +1,23 @@
|
|||||||
# pman.sh
|
# pman.sh
|
||||||
A `pacman` helper script, because you forget the stupid flags
|
A `pacman` helper script, because you forget all the stupid flags
|
||||||
|
|
||||||
## Usage / Features:
|
## Usage / Features:
|
||||||
|
- aur/yay
|
||||||
- search
|
- search
|
||||||
|
- info
|
||||||
|
- localinfo
|
||||||
|
- provides
|
||||||
|
- providefiles
|
||||||
|
- installed
|
||||||
|
- install
|
||||||
- update
|
- update
|
||||||
- upgradable
|
- upgradable
|
||||||
- upgrade
|
- upgrade
|
||||||
- install
|
- remove
|
||||||
- provides
|
- purge
|
||||||
|
- clean
|
||||||
- config
|
- config
|
||||||
|
|
||||||
`config` is the only flag that is not appended to `pacman`, instead it resolves to `nano /etc/pacman.conf`.
|
`config` is the only flag that is not appended to `pacman` (or `yay`), instead it resolves to `nano /etc/pacman.conf`.
|
||||||
|
|
||||||
`sudo` gets prepended automatically if the command requires it and if installed - no, there is no check if your user is in the `sudo` group, if you download this script you should already be, or know you can only use part of this utility
|
`sudo` gets prepended automatically if the command requires it and if installed - no, there is no check if your user is in the `sudo` group, if you download this script you should already be, or know you can only use part of this utility
|
||||||
|
|||||||
159
pman.sh
159
pman.sh
@@ -7,8 +7,26 @@ command=""
|
|||||||
more_arguments=false
|
more_arguments=false
|
||||||
su_needed=false
|
su_needed=false
|
||||||
|
|
||||||
|
# If sudo is needed and necessary (and installed), prepend it, if not installed throw error
|
||||||
|
check_sudo() {
|
||||||
|
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ]; then
|
||||||
|
if command -v "sudo" &>/dev/null; then
|
||||||
|
command="sudo $command"
|
||||||
|
else
|
||||||
|
echo "sudo command needed but not found" > /dev/stderr
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Execute the command
|
||||||
|
execute_command() {
|
||||||
|
check_sudo
|
||||||
|
$command $command_args "${@}"
|
||||||
|
}
|
||||||
|
|
||||||
# Check if yay (aur)
|
# Check if yay (aur)
|
||||||
if [ "$command_args" = "yay" ]; then
|
if [ "$command_args" = "yay" ] || [ "$command_args" = "aur" ]; then
|
||||||
command="yay"
|
command="yay"
|
||||||
command_args="$1"
|
command_args="$1"
|
||||||
shift
|
shift
|
||||||
@@ -27,47 +45,102 @@ if [ "$command" = "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Evaluate the command arguments
|
# Evaluate the command arguments
|
||||||
if [ "$command_args" = "search" ]; then
|
case "$command_args" in
|
||||||
command_args="-Ss"
|
"search")
|
||||||
elif [ "$command_args" = "update" ]; then
|
command_args="-Ss"
|
||||||
command_args="-Sy"
|
;;
|
||||||
if [ "$command" = "pacman" ]; then
|
"info")
|
||||||
|
command_args="-Si"
|
||||||
|
;;
|
||||||
|
"localinfo")
|
||||||
|
command_args="-Qi"
|
||||||
|
;;
|
||||||
|
"provides")
|
||||||
|
# Update the cache
|
||||||
su_needed=true
|
su_needed=true
|
||||||
fi
|
command_args="-Fy"
|
||||||
elif [ "$command_args" = "upgradable" ]; then
|
execute_command "${@}"
|
||||||
command_args="-Qu"
|
|
||||||
elif [ "$command_args" = "upgrade" ]; then
|
|
||||||
command_args="-Syu"
|
|
||||||
if [ "$command" = "pacman" ]; then
|
|
||||||
su_needed=true
|
|
||||||
fi
|
|
||||||
elif [ "$command_args" = "install" ]; then
|
|
||||||
command_args="-S"
|
|
||||||
if [ "$command" = "pacman" ]; then
|
|
||||||
su_needed=true
|
|
||||||
fi
|
|
||||||
elif [ "$command_args" = "provides" ]; then
|
|
||||||
command_args="-F"
|
|
||||||
elif [ "$more_arguments" = "true" ]; then
|
|
||||||
echo "Invalid command: \"$command $command_args\""
|
|
||||||
echo
|
|
||||||
echo "Usage: pman <command> [args...]"
|
|
||||||
echo "Available commands:"
|
|
||||||
echo " yay (aur) - yay | invoke yay "
|
|
||||||
echo " (aur packages - all the normal operations except config are available)"
|
|
||||||
echo " aur (yay) - yay | same as \"yay\""
|
|
||||||
echo " search - pacman -Ss | search packages"
|
|
||||||
echo " update - pacman -Sy | updates the repositories"
|
|
||||||
echo " upgradable - pacman -Qu | list available upgrades"
|
|
||||||
echo " upgrade - pacman -Syu | upgrades your system"
|
|
||||||
echo " provides - pacman -F | list packages that provide file"
|
|
||||||
echo " config - /etc/pacman.conf | edits pacman configuration"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If sudo is needed and necessary (and installed), prepend it
|
su_needed=false
|
||||||
if [ "$su_needed" = "true" ] && [ "$UID" != 0 ] && command -v "sudo" &>/dev/null; then
|
command_args="-F"
|
||||||
sudo $command $command_args "${@}"
|
;;
|
||||||
else
|
"providefiles")
|
||||||
$command $command_args "${@}"
|
# Update the cache
|
||||||
fi
|
su_needed=true
|
||||||
|
command_args="-Fy"
|
||||||
|
execute_command "${@}"
|
||||||
|
|
||||||
|
su_needed=false
|
||||||
|
command_args="-Fl"
|
||||||
|
;;
|
||||||
|
"installed")
|
||||||
|
command_args="-Q"
|
||||||
|
;;
|
||||||
|
"install")
|
||||||
|
command_args="-S"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"update")
|
||||||
|
command_args="-Sy"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"upgradable")
|
||||||
|
command_args="-Qu"
|
||||||
|
;;
|
||||||
|
"upgrade")
|
||||||
|
command_args="-Syu"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"remove")
|
||||||
|
command_args="-Rs"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"purge")
|
||||||
|
command_args="-Rns"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"clean")
|
||||||
|
command_args="-Scc"
|
||||||
|
if [ "$command" = "pacman" ]; then
|
||||||
|
su_needed=true
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ "$more_arguments" = "true" ]; then
|
||||||
|
echo "Invalid command: \"$command_args\""
|
||||||
|
echo
|
||||||
|
echo "Usage: pman <command> [args...]"
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " yay (aur) - yay | invoke yay "
|
||||||
|
echo " (aur packages - all the normal operations except config are available)"
|
||||||
|
echo " aur (yay) - yay | same as \"yay\""
|
||||||
|
echo " search - pacman -Ss | search packages"
|
||||||
|
echo " info - pacman -Si | show package information"
|
||||||
|
echo " localinfo - pacman -Qi | show local package information"
|
||||||
|
echo " provides - pacman -F | list packages that provide file"
|
||||||
|
echo " providefiles - pacman -Fl | list files provided by package"
|
||||||
|
echo " installed - pacman -Q | list installed packages"
|
||||||
|
echo " install - pacman -S | install packages"
|
||||||
|
echo " update - pacman -Sy | updates the repositories"
|
||||||
|
echo " upgradable - pacman -Qu | list available upgrades"
|
||||||
|
echo " upgrade - pacman -Syu | upgrades your system"
|
||||||
|
echo " remove - pacman -Rs | remove packages & dependencies"
|
||||||
|
echo " purge - pacman -Rns | remove packages, dependencies & conf"
|
||||||
|
echo " clean - pacman -Scc | remove all package files & trash"
|
||||||
|
echo " config - /etc/pacman.conf | edits pacman configuration"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
execute_command "${@}"
|
||||||
|
|||||||
Reference in New Issue
Block a user