Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-20-2013, 08:48 AM
|
#1
|
Member
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351
Rep:
|
Creating package which modifies existing files during installation
Hi
Have such task: packaging software into S. package. For proper functionality this software requires modification of some(for now only one) existing config file(s) in system. Well, I can do it in install/doinst.sh, this will not cause any problem for me. BUT, I need a way to revert that modification when removing package. AFAIK, there is no predefined uninstall routines for S., but I do not want to keep those trash. Any ideas?
Predicting question: no, file I want to modify is single solid file, and cannot be split into family of *.d-s
|
|
|
09-20-2013, 09:11 AM
|
#2
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
I would do what they often do on SBo. Don't modify the system file(s) but rather include a README that tells the user how to manually change the system so that the application in question will run.
|
|
1 members found this post helpful.
|
09-20-2013, 09:13 AM
|
#3
|
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559
|
Exactly which file needs to be altered and why?
|
|
|
09-20-2013, 09:49 AM
|
#4
|
Member
Registered: Aug 2011
Posts: 295
Rep: 
|
Letting an auto-tool do configuration modifications without asking is a Bad Idea(tm) most times.
Options you have:
> The Readme Option: You include the relevant information in a README file so the end user can adapt the software to his needs.
> The SuperScript option: You code an Install script that asks clever questions during the install of the package, makes configurations as needed and creates a backup of the modified configurations just in case. Think of Debian's package configuration system. It seems a lot of worth for so little gain and still having a decent chance of having the system broken.
|
|
|
09-20-2013, 10:13 AM
|
#5
|
Senior Member
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,895
Rep: 
|
Installation of software should not turn itself on. For user programs, they do not run until the user takes the action to run them. Daemons should not run unless the user, owner, or administrator starts them. They should not run at boot up time unless the user, owner, or administrator enabled that. Changing the configuration of some other program or the system sounds wrong. Can you explain what that change is and what is changed?
Maybe what you can do is provide a program the user can run to make the change, along with documentation (a README file, a man page) that tells them what the program will do (needs to be detailed enough that the person could do it themselves, instead).
|
|
|
09-20-2013, 11:15 AM
|
#6
|
Member
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351
Original Poster
Rep:
|
@ruario
> ...but rather include a README that tells the user how...
Sure I shall do it, but I want to short as much manual setting/editions as possible(it already has more than a lot).
> Exactly which file needs to be altered and why?
Well, it is "/etc/inittab", because only it can
Code:
vin1:a:respawn:/usr/bin/my-super-daemon-which-must-work-unless-system-dead
Obviously, when removing package I must somehow remove such entries. But how?
@BlackRider
> The SuperScript option:
pkgtools not designed to ask questions during installation of packages, especially during distribution installation.
@Skaperen
> Installation of software should not turn itself on.
It will not, I promise 
|
|
|
09-20-2013, 12:20 PM
|
#7
|
Member
Registered: Aug 2011
Posts: 295
Rep: 
|
Quote:
@BlackRider
> The SuperScript option:
pkgtools not designed to ask questions during installation of packages, especially during distribution installation.
|
Ouch!
Now you bring the matter, I would like to give it a try in a testing environment.
|
|
|
09-21-2013, 01:24 AM
|
#8
|
Member
Registered: May 2007
Distribution: Slackware
Posts: 288
Rep: 
|
I would have doinst.sh copy the existing inittab to inittab.new and then make its modifications to the new file. The sysop then would have the option of substituting the .new for the original.
|
|
|
09-21-2013, 05:42 AM
|
#9
|
Member
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351
Original Poster
Rep:
|
@saulgoode
doinst.sh of package1 does copy inittab -> inittab.new, modifies .new file
doinst.sh of package2 does copy inittab -> inittab.new(overwriting that one made by package1), modifies .new file
...
the same for each n-th package
As a result we have inittab.new suitable only for last installed package(in case of bulk installation).
In any case, this is offtopic, because there is no any problem modifying inittab(OR any other file) during installation, but problem reverting that modification during uninstallation.
|
|
|
09-21-2013, 09:45 AM
|
#10
|
Amigo developer
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928
|
Since removepkg does not support any sort of postrm or prerm action, then you have no way to implement such a feature other than some wild hack.
|
|
|
09-22-2013, 12:00 PM
|
#11
|
Senior Member
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,895
Rep: 
|
Quote:
Originally Posted by FeyFre
@ruario
> ...but rather include a README that tells the user how...
Sure I shall do it, but I want to short as much manual setting/editions as possible(it already has more than a lot).
|
That's where putting all the steps in a script can help. The README can limit itself to describing what the user or administrator needs to know or do or provide.
Quote:
Originally Posted by FeyFre
> Exactly which file needs to be altered and why?
Well, it is "/etc/inittab", because only it can
Code:
vin1:a:respawn:/usr/bin/my-super-daemon-which-must-work-unless-system-dead
Obviously, when removing package I must somehow remove such entries. But how?
|
That's fine as long as this is done only by user/administrator choice. An enable script and a disable script could do the job. And run that script when the package is to be uninstalled. The script can do something like this:
Code:
egrep 'my-super-daemon-which-must-work-unless-system-dead' < /etc/inittab > /etc/inittab.tmp
cmp -s /etc/inittab.tmp /etc/inittab || mv -fv /etc/inittab.tmp /etc/inittab
==
Quote:
Originally Posted by FeyFre
@BlackRider
> The SuperScript option:
pkgtools not designed to ask questions during installation of packages, especially during distribution installation.
|
Those questions should be in the enable script. They should be few, but sometimes packages must know certain things.
Quote:
Originally Posted by FeyFre
@Skaperen
> Installation of software should not turn itself on.
It will not, I promise 
|
Good
|
|
|
All times are GMT -5. The time now is 07:04 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|