LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-20-2013, 08:48 AM   #1
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351

Rep: Reputation: 30
Question 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
 
Old 09-20-2013, 09:11 AM   #2
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773
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.
Old 09-20-2013, 09:13 AM   #3
ruario
Senior Member
 
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773Reputation: 1773
Exactly which file needs to be altered and why?
 
Old 09-20-2013, 09:49 AM   #4
BlackRider
Member
 
Registered: Aug 2011
Posts: 295

Rep: Reputation: 101Reputation: 101
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.
 
Old 09-20-2013, 10:13 AM   #5
Skaperen
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
Blog Entries: 31

Rep: Reputation: 181Reputation: 181
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).
 
Old 09-20-2013, 11:15 AM   #6
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351

Original Poster
Rep: Reputation: 30
@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
 
Old 09-20-2013, 12:20 PM   #7
BlackRider
Member
 
Registered: Aug 2011
Posts: 295

Rep: Reputation: 101Reputation: 101
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.
 
Old 09-21-2013, 01:24 AM   #8
saulgoode
Member
 
Registered: May 2007
Distribution: Slackware
Posts: 288

Rep: Reputation: 155Reputation: 155
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.
 
Old 09-21-2013, 05:42 AM   #9
FeyFre
Member
 
Registered: Jun 2010
Location: Ukraine, Vinnitsa
Distribution: Slackware
Posts: 351

Original Poster
Rep: Reputation: 30
@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.
 
Old 09-21-2013, 09:45 AM   #10
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
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.
 
Old 09-22-2013, 12:00 PM   #11
Skaperen
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
Blog Entries: 31

Rep: Reputation: 181Reputation: 181
Quote:
Originally Posted by FeyFre View Post
@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 View Post
> 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 View Post
@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 View Post
@Skaperen
> Installation of software should not turn itself on.
It will not, I promise
Good
 
  


Reply

Tags
reverting, slackware, uninstallation


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to replace files from existing RPM package? Rickert Programming 11 11-10-2011 03:41 PM
Apache modifies files owned by root mrtndimitrov Linux - Newbie 6 03-24-2010 04:22 AM
Any package for creating gif files ? ssvirdi Linux - Software 1 12-03-2009 01:43 PM
Creating a new partition in an existing installation R_Shackleford Slackware 8 02-22-2004 02:16 PM
creating tagfiles from existing installation abs Slackware 1 10-31-2003 06:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:04 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration