apt - What is the correct way of ignoring a system script installed by a package when removing that package? - Ask Ubuntu


i handling 30 packages , have sorts of files , scripts installed.

some of scripts can run while package installed, once removed (opposed purged), should not executed anymore.

how being managed in standard ubuntu/debian packages?

for example, have logrotate file gets installed with:

/var/log/snapwebsites/snapmanagerdaemon.log {     weekly     maxsize 10m     su snapwebsites snapwebsites     missingok     rotate 10     postrotate         /usr/bin/snapsignal snapmanagerdaemon/log     endscript     compress     delaycompress     notifempty     create 640 snapwebsites snapwebsites } 

the /usr/bin/snapsignal binary disappear if packages removed, logrotate script stays in place... when gets run, fails on 1 call.

i thought remove in postrm script in:

if [ "$1" = "remove" ]     rm -f /etc/logrotate.d/snapmanagerdaemon fi 

that works remove step, if user re-installs package, not come (it not unpacked.) result, not got expected log rotation. @ least no until forcibly extract file , re-install hand.

i can see several solutions, i'd know how done in proper debian package.

one solution work, me add test know whether snapsignal still installed.

    postrotate         if test -x /usr/bin/snapsignal                     /usr/bin/snapsignal snapmanagerdaemon/log         fi     endscript 

only means logrotate continues run entry forever though package gone. have similar feeling other scripts manage. once package removed, there should no need have such script still running.

note logrotate 1 example exhibiting problem. noticed dpkg configuration file, script place under:

/etc/dpkg/dpkg.conf.d/... 

which remains in place after remove.

another type of script stays behind , cause problems: cron files. install under /etc/cron.daily, /etc/cron.monthly, etc. if 1 of scripts try access 1 of binary files after remove, fail.

with of other people, found answer in debian policy document, spelled out in cron jobs section (opposed more generic section such scripts.)

the concerned paragraph:

the scripts or crontab entries in these directories should check if necessary programs installed before try execute them. otherwise, problems arise when package removed not purged since configuration files kept on system in situation.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User