Skip to content

DietPi-Software | Fix purge error on manually installed packages - #1359

Merged
Fourdee merged 3 commits into
testingfrom
fix_apt/dpkg_uninstall
Jan 1, 2018
Merged

Fourdee merged 3 commits into
testingfrom
fix_apt/dpkg_uninstall

Conversation

@MichaIng

@MichaIng MichaIng commented Dec 31, 2017 •

Copy link
Copy Markdown
Owner

https://github.com/Fourdee/DietPi/issues/1352

  • As AGP_ERROR_HANDLED breaks, if the package does not exist in repo, we need to use G_RUN_CMD dpkg -P instead for all packages, installed via dpkg -i.
  • Basically we could use dpkg -P for all purging, means inside G_AGP, as there is really no difference. APT just has the advantage of dependency handling on installation. The only downside is, that you can't use "package*" to purge all packages with this prefix together. All packages have to be fully named, no * or similar accepted, otherwise we could handle this within G_AGP script by grep/sed for "*" and add full names by using dpkg --get-selections.
  • Added marking previously manually installed dependencies as auto. Might be a bid risky, as there might be other software also depend on them, which was also manually installed, thus no APT dependency handling?

=> Take this PR as an offer to think about G_AGP and dependency handling for manually installed packages. Maybe medium-term we need an internal dependency handling for these?

+ As AGP_ERROR_HANDLED breaks, if the package does not exist in repo, we need to use G_RUN_CMD dpkg -P instead for all packages, installed via dpkg -i.
+ Basically we could use dpkg -P for all purging, means inside G_AGP, as there is really no difference. APT just has the advantage of dependency handling on installation. The only downside is, that you can't use "package*" to purge all packages with this prefix together. All packages have to be fully named, no * or similar accepted, otherwise we could handle this within G_AGP script by grep/sed for "*" and add full names by using dpkg --get-selections.
@Fourdee

Fourdee commented Dec 31, 2017

Copy link
Copy Markdown
Collaborator

@MichaIng

Many thanks 👍

I just had an idea that we could exclude the APT error if package does not exist, however, APT always returns exit code of 100 for any failure ☹️
https://github.com/Debian/apt/blob/master/cmdline/apt.cc#L7

Added marking previously manually installed dependencies as auto. Might be a bid risky, as there might be other software also depend on them, which was also manually installed, thus no APT dependency handling?

Yep, i'am not keen on this, could effect other software titles.

Personally, i'd only remove the core package via G_AGP, then allow G_AGA to handle the auto-removal (automatically done in dietpi-software).

For all pre-req/libs: We should leave them installed, regardless if we manually installed them outside of APT or not. There is too much risk in removing pre-reqs, that could break other software.

@MichaIng

Copy link
Copy Markdown
Owner Author

@Fourdee

  • About purging, for now I will leave dpkg -P, as it is also somehow consistent for dpkg -i packages and as said there is absolutely not difference, according to online research.
  • About pre-reqs, yes I agree, there are too much manual installed libs, used by more than one or our software. But I am also not too happy with a "Windows" like growing amount of unused packages. I will comment out the apt-mark statements, but will work on some internal dependency solution. Quick and easy to handle idea:
    • /DietPi/dietpi/.dependencies
    • On manually installing dependencies:
      grep '^<dependency name>' /DietPi/dietpi/.dependencies && sed i "/^<dependency name>[[:space:]]/s/$/\ $INSTALLING_INDEX/" /DietPi/dietpi/.dependencies || echo "^<dependency name> $INSTALLING_INDEX" >> /DietPi/dietpi/.dependencies
    • On uninstalling software (with known dependencies):
      sed -i "s/\ $1[[:space:]]/\ /g" /DietPi/dietpi/.dependencies
    • Before G_AGA:
      apt-mark auto $(grep '^[^[:blank:]]+[[:blank:]]*$' /DietPi/dietpi/.dependencies)

What do you think about?

MichaIng added 2 commits December 31, 2017 14:40
+ Revert apt-mark auto manually installed dependencies, as we cannot guarantee, that not other software needs them.
+ Purge libmpdclient2 on uninstalling mpd.
@Fourdee

Fourdee commented Jan 1, 2018 •

Copy link
Copy Markdown
Collaborator

@MichaIng

About purging, for now I will leave dpkg -P, as it is also somehow consistent for dpkg -i packages and as said there is absolutely not difference, according to online research.

👍

But I am also not too happy with a "Windows" like growing amount of unused packages.
What do you think about?

Same, however, we need to ensure that DietPi never removes a shared package, that could be considered:

  • Manually installed by, or "required" by the user, outside of DietPi scripts
  • Installed by DietPi-Software, required for another software title

If your system would allow for that, i'am all for it. However, personally, i'am not keen on the long "1 liner" commands/if method 😕

@Fourdee Fourdee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaIng

Many thanks 👍

@Fourdee
Fourdee merged commit 15864c7 into testing Jan 1, 2018
@MichaIng
MichaIng deleted the fix_apt/dpkg_uninstall branch January 1, 2018 14:32
@MichaIng

MichaIng commented Jan 1, 2018

Copy link
Copy Markdown
Owner Author

@Fourdee

However, personally, i'am not keen on the long "1 liner" commands/if method 😕
😆 Just a quick example about what I am thinking. Of course this can be also splitted/tuned into a classic if, then, else statement to allow further checks, error handling, user info etc.

After posting it I was thinking, that we can directly use the existing package informations and also merge the existing dependencies (webserver stack, ffmpeg etc.). But yeah, there are more urgent topics for the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants