Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
1dbc2826b2 | |||
a39a772cde | |||
9c36cef1e1 | |||
73f7e37670 | |||
af686fe6c0 | |||
ba07f6275d |
28
README.md
28
README.md
@ -1,15 +1,33 @@
|
||||
# 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:
|
||||
- aur/yay
|
||||
- search
|
||||
- info
|
||||
- localinfo
|
||||
- provides
|
||||
- providefiles
|
||||
- installed
|
||||
- install
|
||||
- update
|
||||
- upgradable
|
||||
- upgrade
|
||||
- install
|
||||
- provides
|
||||
- remove
|
||||
- purge
|
||||
- clean
|
||||
- reflector
|
||||
- ignored
|
||||
- ignore
|
||||
- unignore
|
||||
- config
|
||||
|
||||
`config` is the only flag that is not appended to `pacman`, instead it resolves to `nano /etc/pacman.conf`.
|
||||
`reflector` and `config` are the only flag that are not appended to `pacman` (or `yay`)<br>
|
||||
instead `reflector` resolves to using the `reflector` program with the previously used parameters stored in `/etc/pacman.d/mirrorlist`<br>
|
||||
and `config` resolves to `nano /etc/pacman.conf`.<br>
|
||||
`ignore` and `unignore` require the file `/etc/pacman.d/ignorepkg` to exist (you can use `install -m0644 /etc/pacman.d/ignorepkg` to create it),<br>
|
||||
and the line `Include /etc/pacman.d/ignorepkg` to be inserted into `/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 root privileges, if the UID is not 0 (you are not `root`) and if `sudo` installed.<br>
|
||||
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<br>
|
||||
tho such a feature is planned, to make the script truly ubiquitus.
|
||||
|
77
pman.sh
77
pman.sh
@ -36,6 +36,38 @@ elif [ "$command_args" = "config" ]; then
|
||||
command="nano"
|
||||
command_args="/etc/pacman.conf"
|
||||
su_needed=true
|
||||
elif [ "$command_args" = "reflector" ]; then
|
||||
command="reflector"
|
||||
command_args=$(cat /etc/pacman.d/mirrorlist 2>/dev/null | grep -e "With.*reflector" | sed 's/#.*reflector //')
|
||||
# Check if reflector was actually used to generate the mirrorlist
|
||||
if [ "$command_args" = "" ]; then
|
||||
echo "Error: reflector was not used to generate mirrorlist or mirrorlist location differ from standard"
|
||||
exit 1
|
||||
fi
|
||||
su_needed=true
|
||||
elif [ "$command_args" = "ignored" ]; then
|
||||
command="echo"
|
||||
command_args="$(cat /etc/pacman.d/ignorepkg | sed 's/IgnorePkg = //' | sort)"
|
||||
elif [ "$command_args" = "ignore" ]; then
|
||||
for pkg in "${@}"; do
|
||||
if [ "$(grep -e "$pkg$" /etc/pacman.d/ignorepkg)" != "" ]; then
|
||||
echo "$pkg is already ignored, skipping..."
|
||||
continue
|
||||
fi
|
||||
command="tee"
|
||||
command_args="-a /etc/pacman.d/ignorepkg"
|
||||
su_needed=true
|
||||
echo "IgnorePkg = $pkg" | execute_command &>/dev/null
|
||||
done
|
||||
exit 0
|
||||
elif [ "$command_args" = "unignore" ]; then
|
||||
for pkg in "${@}"; do
|
||||
command="sed"
|
||||
su_needed=true
|
||||
check_sudo
|
||||
$command -i "/IgnorePkg = $pkg/d" /etc/pacman.d/ignorepkg
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If command is empty, command is pacman
|
||||
@ -87,6 +119,13 @@ case "$command_args" in
|
||||
if [ "$command" = "pacman" ]; then
|
||||
su_needed=true
|
||||
fi
|
||||
execute_command "${@}"
|
||||
|
||||
su_needed=false
|
||||
command_args="-Qu"
|
||||
echo
|
||||
echo "$(execute_command "${@}" | wc -l) packages are available for update"
|
||||
exit 0
|
||||
;;
|
||||
"upgradable")
|
||||
command_args="-Qu"
|
||||
@ -121,23 +160,29 @@ case "$command_args" in
|
||||
echo
|
||||
echo "Usage: pman <command> [args...]"
|
||||
echo "Available commands:"
|
||||
echo " yay (aur) - yay | invoke yay "
|
||||
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"
|
||||
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 " reflector - mirrorlist | refresh the mirrorlist with reflector (if used)"
|
||||
echo " (do not use if file location differ from default /etc/pacman.d/mirrorlist)"
|
||||
echo " ignored - /etc/pacman.d/ignorepkg | lists the packages which are ignored from update"
|
||||
echo " (must create /etc/pacman.d/ignorepkg file and import it in /etc/pacman.conf)"
|
||||
echo " ignore - /etc/pacman.d/ignorepkg | ignore package(s) from update"
|
||||
echo " unignore - /etc/pacman.d/ignorepkg | un-ignore package(s) from update"
|
||||
echo " config - /etc/pacman.conf | edits pacman configuration"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user