Last active
September 11, 2023 20:06
-
-
Save cookiengineer/94265370d66ea73f4782f80c231e126c to your computer and use it in GitHub Desktop.
APT-PAC - pacman with APT syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save this file as /usr/bin/apt-pac and chmod +x it. | |
case "$1" in | |
autoremove) | |
pacman -Rns $(pacman -Qdtq); | |
;; | |
clean) | |
if [ "$2" == "--force" ]; then | |
pacman -Scc; | |
else | |
echo "Use \"apt-pac clean --force\" to remove all packages from cache."; | |
pacman -Sc; | |
fi; | |
;; | |
changelog) | |
pacman -Qc "$2"; | |
;; | |
download) | |
pacman -Sw "$2"; | |
;; | |
install) | |
pacman -S "$2"; | |
;; | |
policy) | |
cat /etc/pacman.d/mirrorlist | grep "^[^#]"; | |
;; | |
rdepends) | |
pacman -Sii "$2"; | |
;; | |
remove) | |
pacman -Rs "$2"; | |
;; | |
search) | |
pacman -Ss "$2"; | |
;; | |
show) | |
pacman -Qi "$2"; | |
;; | |
update) | |
if [ "$2" == "--force" ]; then | |
pacman -Syy; | |
else | |
echo "Use \"apt-pac update --force\" to force-update packages index."; | |
pacman -Sy; | |
fi; | |
;; | |
upgrade) | |
pacman -Su; | |
;; | |
*|help) | |
echo ""; | |
echo "aptpac - pacman wrapper for apt-get syntax"; | |
echo ""; | |
echo ""; | |
echo "APT commands:"; | |
echo ""; | |
echo -e "\tautoremove, clean, update, upgrade, policy"; | |
echo ""; | |
echo "Package-specific commands:"; | |
echo ""; | |
echo -e "\tchangelog, download, install, rdepends, remove, search, show"; | |
echo ""; | |
echo "Command-specific flags:"; | |
echo -e "\t--force can be used with clean, update to emulate same behaviour as aptitude."; | |
echo ""; | |
;; | |
esac; |
I will, and I appreciate your work on this. I'm just more worried about other people not reading these comments, copying the entire thing and doing -Syy
without -Su
and potentially screwing up their system this way.
I mean, can't gists be edited? Is it too much effort to at least remove that one extra y
?
@Architector4 I updated the gist to reflect the same behaviour, while hiding the force-clean and force-update behind a --force
flag. I think this is the best compromise in this case.
Oh, that's good. Thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Disclaimer: It's just a goddamn gist, not an AUR package and neither (hopefully) a git repository.
Do whatever you like with it.