ivan-hc / AM

AppImage package manager to install, update (for real) and manage ALL of them (system-wide or locally) thanks to its ever-growing AUR-inspired database listing 2000+ portable apps and programs for GNU/Linux. The first, real centralized repository to manage your AppImages with the ease of APT and the power of PacMan.
https://portable-linux-apps.github.io
GNU General Public License v3.0
448 stars 32 forks source link

"To uninstall "AM" just run the command am -R am" but what about if some package maintainer pack it for some linux distribution? So, it will be an illegal way to uninstall? #830

Closed vitaly-zdanevich closed 2 weeks ago

vitaly-zdanevich commented 1 month ago

For example in Ubuntu - user will need to use usual apt. So, what do you think about some conditional check?

I want to package it for Gentoo Linux - and normal way no uninstall packages here is # emerge --depclean <packagename>

ivan-hc commented 1 month ago

Uhm... what about a rule?

I don't know how a gentoo package works, but I think that if you put a configuration file that prevents the command am -R am, everything should work as expected.

ivan-hc commented 1 month ago

"AM" is a third party package manager, after all, so it is ment to be also easily uninstalled like this.

I think that a configuration file that has a rule to prevent AM removing itself if installed via "portage" would be enough for what you are looking at.

ivan-hc commented 1 month ago

Same for other options, for example, am -s, if you don't want AM updating itself.

vitaly-zdanevich commented 1 month ago

Ok, thanks, I will check the documentation about configuration file.

Samueru-sama commented 1 month ago

I dont think a configuration file or even changes from our side are needed, I have an idea but Im on the phone, I will get back here later.

ivan-hc commented 1 month ago

I also have an idea: uninstalling AM, or any other app from AM, depends on the "remove" script.

You can prevent the creation of /opt/am/remove

vitaly-zdanevich commented 1 month ago

I think that a configuration file that has a rule to prevent AM removing itself if installed via "portage" would be enough for what you are looking at.

I do not know what rule - usually people create patches that remove code about remove/update.

vitaly-zdanevich commented 1 month ago

You can prevent the creation of /opt/am/remove

Yep, but am -h should not have info about remove/update am.

vitaly-zdanevich commented 1 month ago

...if installed by apt, portage, or another system package manager.

ivan-hc commented 1 month ago

Tell me one thing, should a package of AM including also the modules?

ivan-hc commented 1 month ago

if yes, you can apply patches to remove these references. All package maintainers do it.

vitaly-zdanevich commented 1 month ago

Tell me one thing, should a package of AM including also the modules?

This modules?

Looks like yes, because, for example, help.am is here.

ivan-hc commented 1 month ago

also, AM is GPL3, you can fork it and apply the needed patches

ivan-hc commented 1 month ago

so you can remove, for example, the function that updates AM https://github.com/ivan-hc/AM/blob/4d30b36ff2a17adde3f8f593f1236b195ff1a3ab/APP-MANAGER#L765

vitaly-zdanevich commented 1 month ago

if yes, you can apply patches to remove these references. All package maintainers do it.

Yes, looks like... Or maybe your CI/CD can build a special version for system package managers?

ivan-hc commented 1 month ago

or maybe you can comment this line https://github.com/ivan-hc/AM/blob/4d30b36ff2a17adde3f8f593f1236b195ff1a3ab/APP-MANAGER#L800

ivan-hc commented 1 month ago
sed -i 's/  _sync_amcli/    #_sync_amcli/g' /opt/am/APP-MANAGER

with "TAB" spaces, don't forget

ivan-hc commented 1 month ago

it is enough to add a post-installation script, also .deb packages have these

vitaly-zdanevich commented 1 month ago

Or maybe add checks to code - that will check, for example, that some file is exists? If that file exists - instead of AM removing - print a message like "For uninstalling of AM - please use your system package manager".

ivan-hc commented 1 month ago

@vitaly-zdanevich what AM has that prevents you to package it for gentoo?

I'll write the shell commands for you to patch it, for a post installation script, if you need it

ivan-hc commented 1 month ago

I can create a dedicated directory in this repo with post installation scripts for gentoo or debian, if you want

ivan-hc commented 1 month ago

but I don't know nothing about Gentoo, I've only tried one time to install a no more maintained italian distro, Sabayon

Samueru-sama commented 1 month ago

Is there something preventing the gentoo package of AM to replace the /opt/am/remove script for something like this:

echo "AM was installed by emerge, remove it using emerge"

That way AM can't remove itself, since the remove script is what removes it.

When you try to remove am with am -r am all it does it call its own /opt/am/remove script, which in this case won't actually remove anything and just echo a message.

vitaly-zdanevich commented 1 month ago

Ok, I will write a patch for that - when will package for Gentoo.

ivan-hc commented 2 weeks ago

I have a fix at https://github.com/ivan-hc/AM/pull/894

ivan-hc commented 2 weeks ago

Solved https://github.com/ivan-hc/AM/releases/tag/8.1