dpkg --path-exclude um systeme zu verschlanken

04/03/2016 - 23:00 von Marc Haber | Report spam
Hallo,

seit fünfzehn Jahren warte ich darauf, dass man dpkg beim Auspacken
sagen kann, gewisse Subtrees komplett auszuschließen. Kürzclih habe
ich gemerkt, dass es inzwischen geht, da dpkg die --path-exclude und
wie das funktioniert.

In meinem test packe ich tzdata.deb aus und möchte, dass
/usr/share/zoneinfo komplett leer ist bis auf
/usr/share/zoneinfo/right/Europe/Berlin.
Ich versuche zuerst das Directory auszuschließen:

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find /usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|Setting up tzdata (2016a-1) ...
|
|Current default time zone: 'Europe/Berlin'
|Local time is now: Sun Feb 7 10:42:24 CET 2016.
|Universal Time is now: Sun Feb 7 09:42:24 UTC 2016.
|Run 'dpkg-reconfigure tzdata' if you wish to change it.
|
|/usr/share/zoneinfo/right/Europe
|/usr/share/zoneinfo/right/Europe/Zaporozhy
|/usr/share/zoneinfo/right/Europe/Uzhgorod

Das funktoniert nicht, der Inhalt ist trotzdem da. Nun schließe ich
den Inhalt des Directories aus:

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/*' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find /usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|Setting up tzdata (2016a-1) ...
|
|Current default time zone: 'Europe/Berlin'
|Local time is now: Sun Feb 7 09:42:47 UTC 2016.
|Universal Time is now: Sun Feb 7 09:42:47 UTC 2016.
|Run 'dpkg-reconfigure tzdata' if you wish to change it.
|
|find: '/usr/share/zoneinfo/right/Europe': No such file or directory

Das scheint jetzt zu tun. Schließen wir als die Zieldatei wieder an.

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/*' --path-include='/usr/share/zoneinfo/right/Europe/Berlin' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find /usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|dpkg: error processing archive /var/cache/apt/archives/tzdata_2016a-1_all.deb (--install):
| unable to create '/usr/share/zoneinfo/right/Europe/Berlin.dpkg-new' (while processing './usr/share/zoneinfo/right/Europe/Berlin'): No such file or directory
|Errors were encountered while processing:
| /var/cache/apt/archives/tzdata_2016a-1_all.deb

Oops, da fehlt das Directory. Include.

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/*' --path-include='/usr/share/zoneinfo/right/Europe' --path-include='/usr/share/zoneinfo/right/Europe/Berlin' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find /usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|dpkg: error processing archive /var/cache/apt/archives/tzdata_2016a-1_all.deb (--install):
| error creating directory './usr/share/zoneinfo/right/Europe': No such file or directory
|Errors were encountered while processing:
| /var/cache/apt/archives/tzdata_2016a-1_all.deb

Das tut wohl auch nicht, also das Parent Directory ebenfalls
einschließen.

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/*' --path-include='/usr/share/zoneinfo/right' --path-include='/usr/share/zoneinfo/right/Europe/Berlin' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find /usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|Setting up tzdata (2016a-1) ...
|
|Current default time zone: 'Europe/Berlin'
|Local time is now: Sun Feb 7 09:44:11 UTC 2016.
|Universal Time is now: Sun Feb 7 09:44:11 UTC 2016.
|Run 'dpkg-reconfigure tzdata' if you wish to change it.
|
|/usr/share/zoneinfo/right/Europe
|/usr/share/zoneinfo/right/Europe/Berlin
|/usr/share/zoneinfo/right/Europe/Moscow

Jetzt verstehe ich weniger. Ich habe nur das Directory zoneinfo/right
eingeschlossen, und würde erwarten, dass wie oben der Inhalt "extra"
behandelt wird. Stattdessen wird Europe/* inkludiert. Noch eine
Exkludeoption:

|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg --path-exclude='/usr/share/zoneinfo/*' --path-include='/usr/share/zoneinfo/right' --path-exclude='/usr/share/zoneinfo/right/Europe/*' --path-include='/usr/share/zoneinfo/right/Europe/Berlin' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb && find
/usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|Setting up tzdata (2016a-1) ...
|
|Current default time zone: 'Europe/Berlin'
|Local time is now: Sun Feb 7 09:49:31 UTC 2016.
|Universal Time is now: Sun Feb 7 09:49:31 UTC 2016.
|Run 'dpkg-reconfigure tzdata' if you wish to change it.
|
|/usr/share/zoneinfo/right/Europe
|/usr/share/zoneinfo/right/Europe/Berlin
|/usr/share/zoneinfo/right/Europe/Moscow

Hier etwasd Debug-Output von dpkg an dieser Stelle:

|D000010: tarobject ti->name='./usr/share/zoneinfo/right/Europe/Moscow' mode0777 owner=0:0 typeP(l) ti->linkname='../W-SU' namenode='/usr/share/zoneinfo/right/Europe/Moscow' flags=2 instead='<none>'
|D000100: setupvnamevbs main='/usr/share/zoneinfo/right/Europe/Moscow' tmp='/usr/share/zoneinfo/right/Europe/Moscow.dpkg-tmp' new='/usr/share/zoneinfo/right/Europe/Moscow.dpkg-new'
|D000100: tarobject nonexistent
|D000010: filter comparing '/usr/share/zoneinfo/right/Europe/Moscow' and '/usr/share/zoneinfo/*'
|D000010: filter removing ./usr/share/zoneinfo/right/Europe/Moscow
|D000010: filter comparing '/usr/share/zoneinfo/right/Europe/Moscow' and '/usr/share/zoneinfo/right'
|D000010: filter comparing '/usr/share/zoneinfo/right/Europe/Moscow' and '/usr/share/zoneinfo/right/Europe/*'
|D000010: filter removing ./usr/share/zoneinfo/right/Europe/Moscow
|D000010: filter comparing '/usr/share/zoneinfo/right/Europe/Moscow' and '/usr/share/zoneinfo/right/Europe/Berlin'
|D000010: filter seeing if '/usr/share/zoneinfo/right/Europe/Moscow' needs to be reincluded
|D000100: filter subpattern '/usr/share/zoneinfo/right'
|D000010: filter reincluding ./usr/share/zoneinfo/right/Europe/Moscow
|D000010: path_remove_tree '/usr/share/zoneinfo/right/Europe/Moscow.dpkg-new'
|D000010: path_remove_tree '/usr/share/zoneinfo/right/Europe/Moscow.dpkg-tmp'
|D000100: tarobject symlink creating
|D000100: tarobject new - no backup
|D000100: tarobject done and installation deferred

Wenn ich das richtig verstehe, inkludiert er das wegen des
path-include=/usr/share/zoneinfo/right. Aber dsa brauche ich um das
Direcotry zu haben. Also noch ein Exclude für den content.
|root@fan:/# rm -rf /usr/share/zoneinfo && dpkg -D333 --path-exclude='/usr/share/zoneinfo/*' --path-include='/usr/share/zoneinfo/right' --path-exclude='/usr/share/zoneinfo/right/*' --path-include='/usr/share/zoneinfo/right/Europe/Berlin' --install /var/cache/apt/archives/tzdata_2016a-1_all.deb 2>dpkg-debug.2 && find
/usr/share/zoneinfo/right/Europe | head -n 3
|(Reading database ... 9745 files and directories currently installed.)
|Preparing to unpack .../tzdata_2016a-1_all.deb ...
|Unpacking tzdata (2016a-1) over (2016a-1) ...
|Setting up tzdata (2016a-1) ...
|/usr/share/zoneinfo/right/Europe
|/usr/share/zoneinfo/right/Europe/Berlin
|/usr/share/zoneinfo/right/Europe/Moscow
|root@fan:/#

Und hier kapier ich jetzt nicht mehr was passiert.

Hat schonmal jemand mit --path-exclude gearbeitet und mag mir
erklàren, wie man das richtig verwendet?

Grüße
Marc
Marc Haber | " Questions are the | Mailadresse im Header
Mannheim, Germany | Beginning of Wisdom " | http://www.zugschlus.de/
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834
 

Lesen sie die antworten

#1 Sven Hartge
04/03/2016 - 23:10 | Warnen spam
Marc Haber <mh+ wrote:

Hat schonmal jemand mit --path-exclude gearbeitet und mag mir
erklàren, wie man das richtig verwendet?



Ich nutze das indirekt via dpkg-localepurge. Dieses hat früher die
Dateien selbst nach der Installation wieder gelöscht (extrem böse),
jetzt legt es in /etc/dpkg/dpkg.cfg.d/ eine Datei mit den Excludes ab.
Sieht wie folgt aus:

# DO NOT MODIFY/REMOVE THIS FILE - IT IS AUTO-GENERATED
#
# To remove/disable this, run dpkg-reconfigure localepurge
# and say no to/disable the "Use dpkg --path-exclude" option.
#
# To change what patterns are affected use:
# * dpkg-reconfigure localepurge
# (to alter which locales are kept and whether manpages should
# be purged)
# * Add a dpkg config file in /etc/dpkg/dpkg.cfg.d that is read
# after this file with the necessary --path-include and
# --path-exclude options.
#
# Report faulty patterns against the localepurge package.
#

# Paths to purge
path-exclude=/usr/share/locale/*
path-exclude=/usr/share/gnome/help/*/*
path-exclude=/usr/share/doc/kde/HTML/*/*
path-exclude=/usr/share/omf/*/*-*.emf
path-exclude=/usr/share/man/*
# Paths to keep
path-include=/usr/share/locale/locale.alias
path-include=/usr/share/locale/de/*
path-include=/usr/share/locale/de_DE/*
path-include=/usr/share/locale//*
path-include=/usr/share/locale/de_DE.UTF-8/*
path-include=/usr/share/locale/en/*
path-include=/usr/share/locale/en_GB/*
path-include=/usr/share/locale/en_GB.ISO-8859-15/*
path-include=/usr/share/locale/en_GB.UTF-8/*
path-include=/usr/share/locale/en_US/*
path-include=/usr/share/locale/en_US.ISO-8859-15/*
path-include=/usr/share/locale/en_US.UTF-8/*
path-include=/usr/share/gnome/help/*/C/*
path-include=/usr/share/gnome/help/*/de/*
path-include=/usr/share/gnome/help/*/de_DE/*
path-include=/usr/share/gnome/help/*//*
path-include=/usr/share/gnome/help/*/de_DE.UTF-8/*
path-include=/usr/share/gnome/help/*/en/*
path-include=/usr/share/gnome/help/*/en_GB/*
path-include=/usr/share/gnome/help/*/en_GB.ISO-8859-15/*
path-include=/usr/share/gnome/help/*/en_GB.UTF-8/*
path-include=/usr/share/gnome/help/*/en_US/*
path-include=/usr/share/gnome/help/*/en_US.ISO-8859-15/*
path-include=/usr/share/gnome/help/*/en_US.UTF-8/*
path-include=/usr/share/doc/kde/HTML/C/*
path-include=/usr/share/doc/kde/HTML/de/*
path-include=/usr/share/doc/kde/HTML/de_DE/*
path-include=/usr/share/doc/kde/HTML//*
path-include=/usr/share/doc/kde/HTML/de_DE.UTF-8/*
path-include=/usr/share/doc/kde/HTML/en/*
path-include=/usr/share/doc/kde/HTML/en_GB/*
path-include=/usr/share/doc/kde/HTML/en_GB.ISO-8859-15/*
path-include=/usr/share/doc/kde/HTML/en_GB.UTF-8/*
path-include=/usr/share/doc/kde/HTML/en_US/*
path-include=/usr/share/doc/kde/HTML/en_US.ISO-8859-15/*
path-include=/usr/share/doc/kde/HTML/en_US.UTF-8/*
path-include=/usr/share/omf/*/*-de.emf
path-include=/usr/share/omf/*/*-de_DE.emf
path-include=/usr/share/omf/*/*
path-include=/usr/share/omf/*/*-de_DE.UTF-8.emf
path-include=/usr/share/omf/*/*-en.emf
path-include=/usr/share/omf/*/*-en_GB.emf
path-include=/usr/share/omf/*/*-en_GB.ISO-8859-15.emf
path-include=/usr/share/omf/*/*-en_GB.UTF-8.emf
path-include=/usr/share/omf/*/*-en_US.emf
path-include=/usr/share/omf/*/*-en_US.ISO-8859-15.emf
path-include=/usr/share/omf/*/*-en_US.UTF-8.emf
path-include=/usr/share/omf/*/*-C.emf
path-include=/usr/share/locale/languages
path-include=/usr/share/locale/all_languages
path-include=/usr/share/locale/currency/*
path-include=/usr/share/locale/l10n/*
path-include=/usr/share/man/de/*
path-include=/usr/share/man/de_DE/*
path-include=/usr/share/man//*
path-include=/usr/share/man/de_DE.UTF-8/*
path-include=/usr/share/man/en/*
path-include=/usr/share/man/en_GB/*
path-include=/usr/share/man/en_GB.ISO-8859-15/*
path-include=/usr/share/man/en_GB.UTF-8/*
path-include=/usr/share/man/en_US/*
path-include=/usr/share/man/en_US.ISO-8859-15/*
path-include=/usr/share/man/en_US.UTF-8/*
path-include=/usr/share/man/man[0-9]/*

Vielleicht gibt dir das eine Idee, wie es funktionieren sollte.



Sigmentation fault. Core dumped.

Ähnliche fragen