Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #194237 > unrolled thread

Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

Started bySven Joachim <svenjoac@gmx.de>
First post2018-03-28 19:40 +0200
Last post2018-03-30 04:10 +0200
Articles 7 — 4 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to execute user's scripts when upgrading a certain package via apt/aptitude Sven Joachim <svenjoac@gmx.de> - 2018-03-28 19:40 +0200
    Re: How to execute user's scripts when upgrading a certain package via apt/aptitude Sven Joachim <svenjoac@gmx.de> - 2018-03-28 20:20 +0200
      Re: How to execute user's scripts when upgrading a certain package  via apt/aptitude <tomas@tuxteam.de> - 2018-03-28 20:50 +0200
        Re: How to execute user's scripts when upgrading a certain package  via apt/aptitude "John Crawley (johnraff)" <john@bunsenlabs.org> - 2018-03-29 01:10 +0200
        Re: How to execute user's scripts when upgrading a certain package  via apt/aptitude "John Crawley (johnraff)" <john@bunsenlabs.org> - 2018-03-29 01:10 +0200
      Re: How to execute user's scripts when upgrading a certain package  via apt/aptitude Abdullah Ramazanoglu <ar018@yahoo.com> - 2018-03-29 02:20 +0200
        Re: How to execute user's scripts when upgrading a certain package  via apt/aptitude "John Crawley (johnraff)" <john@bunsenlabs.org> - 2018-03-30 04:10 +0200

#194237 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

FromSven Joachim <svenjoac@gmx.de>
Date2018-03-28 19:40 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vyndg-60Z-17@gated-at.bofh.it>
On 2018-03-28 18:29 +0200, Mikhail Morfikov wrote:

> I have some packages, for instance firefox, which need a little bit of
> customization from a user side. So basically when I install the new version of
> firefox, I also have to do some extra steps and so far I've been doing it
> manually because I don't know any better way.
>
> In the case of firefox, I have to create some hard links. Those hard links are
> used as additional executable files to be profiled in AppArmor. But when I
> upgrade my system, and firefox is on the package list, the hard links basically
> stop working and they have to be removed and recreated manually after the
> upgrade is done.
>
> Is there a way to pass some extra commands/script to apt/aptitude so when the
> firefox package is to be upgraded, it would recreate the links automatically?

You could use a dpkg trigger for that, a short intro how to do this is
on stackoverflow[1].  See also deb-triggers(5).

Cheers,
       Sven


1. https://stackoverflow.com/questions/15276535/dpkg-how-to-use-trigger

[toc] | [next] | [standalone]


#194238

FromSven Joachim <svenjoac@gmx.de>
Date2018-03-28 20:20 +0200
Message-ID<vynPX-6uS-1@gated-at.bofh.it>
In reply to#194237
On 2018-03-28 19:46 +0200, Mikhail Morfikov wrote:

> On 2018-03-28 19:29, Sven Joachim wrote:
>> On 2018-03-28 18:29 +0200, Mikhail Morfikov wrote:
>> 
>>> I have some packages, for instance firefox, which need a little bit of
>>> customization from a user side. So basically when I install the new version of
>>> firefox, I also have to do some extra steps and so far I've been doing it
>>> manually because I don't know any better way.
>>>
>>> In the case of firefox, I have to create some hard links. Those hard links are
>>> used as additional executable files to be profiled in AppArmor. But when I
>>> upgrade my system, and firefox is on the package list, the hard links basically
>>> stop working and they have to be removed and recreated manually after the
>>> upgrade is done.
>>>
>>> Is there a way to pass some extra commands/script to apt/aptitude so when the
>>> firefox package is to be upgraded, it would recreate the links automatically?
>> 
>> You could use a dpkg trigger for that, a short intro how to do this is
>> on stackoverflow[1].  See also deb-triggers(5).
> Is this a solution for a user or rather for maintainer of the package? I think
> it's the second one and hence I can't use it.

It requires you to create your own package (since there is no other way
to register triggers in dpkg), but it does not have to contain any
files, you only need to include the triggers list and a postinst script
which manages the links.

An alternative is to use the dpkg's post-invoke option, but that is
rather inefficient, since it will be run on every dpkg invocation and
not only when one of the packages which interest you is
updated/installed/removed.

Cheers,
       Sven

[toc] | [prev] | [next] | [standalone]


#194239 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

From<tomas@tuxteam.de>
Date2018-03-28 20:50 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vyoj0-6FJ-3@gated-at.bofh.it>
In reply to#194238
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Mar 28, 2018 at 08:18:24PM +0200, Mikhail Morfikov wrote:
> On 2018-03-28 20:12, Sven Joachim wrote:

[...]

> > It requires you to create your own package (since there is no other way
> > to register triggers in dpkg) [...]

> I really thought there's some easy way to include user's scripts when you want
> to make some additional changes to the upgraded packages, but it looks like the
> apt mechanism is a little bit limited. But I will try to do something with the
> trigger and see how that will work.

I think the trick is to create a (nearly) empty package "my-firefox-custom"
which depends on firefox and thus pulls it in before its own post-install
takes over.

Cheers
- -- t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlq74ZgACgkQBcgs9XrR2kbT9ACfQjrs0rzgRKXyWjXwJOKgOXJT
N4MAn1OQERkWXADCZJlQ1S2/OWcr3iKe
=moS3
-----END PGP SIGNATURE-----

[toc] | [prev] | [next] | [standalone]


#194246 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

From"John Crawley (johnraff)" <john@bunsenlabs.org>
Date2018-03-29 01:10 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vysmB-16L-1@gated-at.bofh.it>
In reply to#194239
On 2018-03-29 03:40, tomas@tuxteam.de wrote:
> On Wed, Mar 28, 2018 at 08:18:24PM +0200, Mikhail Morfikov wrote:
>> On 2018-03-28 20:12, Sven Joachim wrote:
>> I really thought there's some easy way to include user's scripts when you want
>> to make some additional changes to the upgraded packages, but it looks like the
>> apt mechanism is a little bit limited. But I will try to do something with the
>> trigger and see how that will work.
> 
> I think the trick is to create a (nearly) empty package "my-firefox-custom"
> which depends on firefox and thus pulls it in before its own post-install
> takes over.
> This sounds as if it should work, but your custom package would need 
upgrading every time Firefox was upgraded, so the automation would be lost.

@Sven, depending on how you do your upgrades, maybe a script could 
interrogate apt-get as to what packages it intended to upgrade, before 
performing it. If 'firefox' was found, the extra action could be taken. 
So you'd write a wrapper around 'apt-get'.
-- 
John

[toc] | [prev] | [next] | [standalone]


#194249 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

From"John Crawley (johnraff)" <john@bunsenlabs.org>
Date2018-03-29 01:10 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vysmB-16L-9@gated-at.bofh.it>
In reply to#194239
On 2018-03-29 03:40, tomas@tuxteam.de wrote:
>> I really thought there's some easy way to include user's scripts when you want
>> to make some additional changes to the upgraded packages, but it looks like the
>> apt mechanism is a little bit limited. But I will try to do something with the
>> trigger and see how that will work.

PS sorry, that was @Michael not @Sven.
-- 
John

[toc] | [prev] | [next] | [standalone]


#194251 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

FromAbdullah Ramazanoglu <ar018@yahoo.com>
Date2018-03-29 02:20 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vytsl-1HG-1@gated-at.bofh.it>
In reply to#194238
On Wed, 28 Mar 2018 20:00:34 +0200 Mikhail Morfikov said:
> Is there some variable that holds, for instance, a list of the
> packages that apt wants to upgrade? In such way it would be easy to
> set this up.

On Wed, 28 Mar 2018 20:18:24 +0200 Mikhail Morfikov said:
> But I will try to do something with the trigger and see how that will
> work.

Indeed, printing out the run-time environment from within the
Post-Invoke-Success script might give some ideas.

Regards
-- 
Abdullah Ramazanoglu

[toc] | [prev] | [next] | [standalone]


#194287 — Re: How to execute user's scripts when upgrading a certain package via apt/aptitude

From"John Crawley (johnraff)" <john@bunsenlabs.org>
Date2018-03-30 04:10 +0200
SubjectRe: How to execute user's scripts when upgrading a certain package via apt/aptitude
Message-ID<vyREl-Db-1@gated-at.bofh.it>
In reply to#194251
On 2018-03-29 09:15, Abdullah Ramazanoglu wrote:
> On Wed, 28 Mar 2018 20:00:34 +0200 Mikhail Morfikov said:
>> Is there some variable that holds, for instance, a list of the
>> packages that apt wants to upgrade? In such way it would be easy to
>> set this up.

apt list --upgradable
will print out a list, but the output of 'apt' is not considered  
suitable for parsing by scripts (still unstable).
apt-get --simulate upgrade
will also print the packages to be upgraded, along with a lot of noise  
that your script would have to filter.

But:
> On Wed, 28 Mar 2018 20:18:24 +0200 Mikhail Morfikov said:
>> But I will try to do something with the trigger and see how that will
>> work.

It looks as if that worked for you. You created a new package  
'firefox-trigger' with a trigger that looked for upgrades to firefox,  
right? That sounds like the neatest solution, and I will make a note of  
it for my personal reference. Thanks.

-- 
John

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web