-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Reliable way to invoke apt-get
#192
base: master
Are you sure you want to change the base?
Conversation
* Avoid user interaction in case of error * Use exit code `1` if `/ust/bin/apt-get` doesn't exist
Can you rebase it against the current master please, so the actual changes are easily viewable? |
I didn't know about the whereis command. It looks nice an avoids hardcoding paths. It can be assumed installed on Debian systems using apt-fast as it is a dependency for mount (which is a dependency for systemd). So I placed an exec file in /usr/local/bin/apt-get and the whereas output is: How is the order of the output? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebase :)
It seems
For instance, invoking Large text ahead
Additionally, I also tried to confuse Invoking apt-get: /usr/bin/apt-get /usr/sbin/apt-get /usr/local/bin/apt-get /usr/share/man/man8/apt-get.8.gz
Based on my output from |
BTW, I marked this PR as a draft temporarily, since I've been a bit stressed out lately, and I accidentaly messed up something when trying to rebase. 🤦♂️ (facepalm) I'll fix it in the next few days; in the meantime, we can continue analyzing the idea behind my PR. |
Why?
This PR attempts to cover an edge case which might occur here if an user attempts to use aptitude (or any other custom package manager) in
apt-fast.conf
, by overriding"${_APTMGR}"
, while being in an environment which prioritizes/usr/local/bin
over/usr/bin
in"${PATH}"
, with a symlink from e.g./usr/local/bin/aptitude
->/usr/bin/apt.fast
.Trying to invoke
apt-fast
with this setup would causeapt-fast
to call himself.Is this necessary?
Although such environment would seem extremely unusual at first, taking a closer look to your
"${PATH}"
might reveal that, in fact, you could be using a similar configuration without even knowing (Like i discovered); also, if we take into account thatapt-fast.conf
actually allows"${_APTMGR}"
to be overridden, than means that we'd just need to also create a symlink like the one above described to trigger this edge case.So? What's the idea?
The idea behind this PR it's quite simple: We just need to make sure that we're calling
/usr/bin/apt-get
whenever we call forapt-get
.This can be achieved in many ways
apt-get
occurence withinapt-fast
with/usr/bin/apt-get
/usr/bin/apt-get
into a variable, and replace eachapt-get
occurence with"${var}"
[Currently in use]Or we could use
whereis
command, from utils-linux package to do something like thisreal_APT="${whereis_APT[1]}"
Are there any drawbacks?
Strictly talking, there could be a few:
Option 1
This option would end up adding a lot of hardcoded lines into
apt-fast
Option 2
This option requires an additional variable to store
apt-get
fullpath, and just one hardcoded line.Option 3
This option requires (at least) an additional variable to store
apt-get
fullpath, and adding another dependency: utils-linux package.After a little research, seems
systemd
package depends onutils-linux
, so that meansutils-linux
comes preinstalled, at least in Ubuntu (Debian's systemd doesn't seem to share that dependency)Final notes
As always, If I made some mistake, or if you have any suggestion, it's always welcome.