LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 05-28-2023, 07:56 AM   #1
tuxuser1
Member
 
Registered: Nov 2021
Posts: 165

Rep: Reputation: Disabled
SLackbuild config function (doinst.sh) problem


Hi,

I just built snapper package which have a configuration file in /etc/conf.d/snapper.
According slackware documentation i added the following content in my doinst.sh:
Code:
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

config etc/conf.d/snapper.new
when I run "slackpkg install snapper", I see this output:

Code:
[1/1]   Package: snapper-0.10.3-x86_64-1_Sdom.tgz
        Linking /home/domenico/Slackdom/x86_64/snapper/snapper-0.10.3-x86_64-1_Sdom.tgz
        Linking /home/domenico/Slackdom/x86_64/snapper/snapper-0.10.3-x86_64-1_Sdom.tgz.asc
[1/1]   Package snapper-0.10.3-x86_64-1_Sdom.tgz is already in cache - not downloading
        Installing [Slackdom]:snapper-0.10.3-x86_64-1_Sdom...
snapper-0.10.3-x86_64-1_Sdom: Snapper is a tool for Linux file system snapshot management ......................................................................... [ 3.8M]
cat: etc/conf.d/snapper.new: No such file or directory
Searching for NEW configuration files...
Some packages had new configuration files installed (1 new files):

/etc/slackpkg/slackpkgplus.conf.new

What do you want (K/O/R/P)?

        (K)eep the old files and consider .new files later

        (O)verwrite all old files with the new ones. The
           old files will be stored with the suffix .orig

        (R)emove all .new files

        (P)rompt K, O, R selection for every single file
K
As you can see, snapper.new cannot be found and it is right, but
must it work in this way ? or am i wronging anything?
Another point which is not clear for me, after the installation,
if I edit "/etc/conf.d/snapper" changing its content then
its md5sum will change, thus, if I run "slackpkg reinstall snapper"
i expect to find /etc/conf.d/snapper and /etc/conf.d/snapper.new
but I only find /etc/conf.d/snapper with its original content losing the
previous changes.
What am i wronging?

Regards
 
Old 05-28-2023, 08:26 AM   #2
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
In your SlackBuild script, did you mv /etc/conf.d/snapper to /etc/conf.d/snapper.new? If there is no change to /etc/conf.d/snapper then you will not see /etc/conf.d/snapper.new because that purpose of the config function in doinst.sh.
 
Old 05-28-2023, 08:55 AM   #3
tuxuser1
Member
 
Registered: Nov 2021
Posts: 165

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrisretusn View Post
In your SlackBuild script, did you mv /etc/conf.d/snapper to /etc/conf.d/snapper.new? If there is no change to /etc/conf.d/snapper then you will not see /etc/conf.d/snapper.new because that purpose of the config function in doinst.sh.
Thanks chrisretusn.
I bad interpretated the config function work.
Mark a solved.

Sorry, just a curiosity:
When i remove a package, sometimes I see the removed list files and other times not instead.
What does it depends on ?
 
Old 05-29-2023, 06:08 AM   #4
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by tuxuser1 View Post
Sorry, just a curiosity:
When i remove a package, sometimes I see the removed list files and other times not instead.
What does it depends on ?
I've noticed this too. Never looked in to it. The package is removed that's all I need to know. By the way, configuration files are not removed when removing a package. Those are the "*.new" files. Also files that are added later by the program. Removepkg can only remove what it know about. There is a douninst.sh that can be used to remove files like the configuration files and other files. See 'man removepkg'
 
Old 05-29-2023, 07:43 AM   #5
tuxuser1
Member
 
Registered: Nov 2021
Posts: 165

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrisretusn View Post
I've noticed this too. Never looked in to it. The package is removed that's all I need to know. By the way, configuration files are not removed when removing a package. Those are the "*.new" files. Also files that are added later by the program. Removepkg can only remove what it know about. There is a douninst.sh that can be used to remove files like the configuration files and other files. See 'man removepkg'
Ok.
Thanks.
 
  


Reply



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
[SOLVED] how to properly make a doinst.sh for a slackbuild? BW-userx Slackware 6 11-19-2022 06:15 AM
[SOLVED] Bash question about slackbuild doinst.sh phalange Slackware 8 08-17-2019 06:58 AM
[SOLVED] About creating symlinks in .SlackBuild and doinst.sh cigerma Slackware 7 12-31-2011 06:31 AM
doinst.sh i need to install packages using command line Clarence27 Zenwalk 2 10-07-2006 07:03 AM
appending to perllocal.pod via doinst.sh jong357 Slackware 1 10-31-2005 10:48 AM

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

All times are GMT -5. The time now is 07:51 AM.

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