[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dpkg --path-exclude um systeme zu verschlanken



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
--path-include Optionen bekommen hat. Dummerweise kapiere ich nicht,
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' mode=120777 owner=0:0 type=50(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
-- 
-------------------------------------- !! No courtesy copies, please !! -----
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


Reply to: