Is there any harm in changing /usr/bin/apt-get
to convert the upgrade
option into dist-upgrade
to pass to the real apt-get?
What problem does this even solve?
It saves me from reading the warning notice and then typing the “new” way, since “apt-get upgrade” is muscle memory from many years of Ubuntu and Debian admin.
You shouldn’t even be using upgrade on Ubuntu, as the same issues can arise. I always use dist-upgrade on my Mint systems.
Again, this is from many years of admin, when “upgrade” was perfectly acceptable, and the only way to make sure you didn’t move to the next major release, while still staying patched.
If you’ve only worked with recent versions, then you likely never ran into this, but it wasn’t until about 16.04 or so that “upgrade” became deprecated on Ubuntu.
I started using Ubuntu around 12.04 I think, and I was able to re-train my fingers. And since upgrade is depreciated, you really should re-train yourself to do it properly.
Adapt and overcome. It only benefits yourself. I’m a shining example of old dogs learning new tricks. There is no point in reinforcing bad habits.
huh? upgrade isn’t deprecated. upgrade is the safe option, doesn’t remove stuff.
dist-upgrade is more if you’re a sid user - it’ll add/remove packages.
apt-get is deprecated, you should be using apt.
Source?
From the apt man page:
SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS
The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While it tries not to break backward
compatibility this is not guaranteed either if a change seems beneficial for interactive use.
All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well. apt(8) just changes the default
value of some options (see apt.conf(5) and specifically the Binary scope). So you should prefer using these commands (potentially with some
additional options enabled) in your scripts as they keep backward compatibility as much as possible.
Debian documentation specifies dist-upgrade.
This is not correct.
apt-get upgrade is also advised against in Debian policy.
Only apt-get dist-upgrade should be used.
apt-get upgrade has been dissuaded since pre-2000.
Use an alias; if you edit the file, we may overwrite it with package updates.
The problem with apt-get upgrade is it does not bring in new dependencies.
Sam
Unfortunately, this doesn’t work, as aliases only affect the first word of a command line…I can’t have upgrade
change to dist-upgrade
.
Since any overwrite either will change the file in important ways, or will just put back the warning, it’ll be pretty easy to fix in the latter case.
But, since it is safe to do this sort of replacement, and OSMC is a special distribution that can really get broken with just upgrade
, perhaps you should just change the file to do the substitution instead of warn, and leave something like the existing nowarn-upgrade
if somebody really wants to shoot themselves in the foot.
You could add PATH modification to your bashrc or profile.
Add /home/osmc/nabsltd first and add a replacement shell script there.
We could, but we like to advise the user where possible. It might save them on a different platform.
Sam
You could also create a bash function to make you own version of apt apt-get.
It won’t export properly on privIlege escalation such as sudo
Good point, I didn’t think of that.
Since I log in as root and su to osmc when necessary, that wouldn’t be an issue.