LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-23-2018, 10:49 PM   #1906
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619

Okay, so I couldn't stop thinking about this problem, and I believe I have a solution. (Whether Pat thinks it's a good solution may be a different story.) The idea is that each time config() is called in doinst.sh, it compares the new file with a reference (presumably unmodified) config file rather than the actual installed config file, which may include user edits. It then saves a new reference config file.

Code:
config() {                                                                      
  NEW="$1"                                                                      
  OLD="$(dirname $NEW)/$(basename $NEW .new)"                                   
  REF="${OLD}.ref"                                                              
  # If there's no config file by that name, mv it over:                         
  if [ ! -r $OLD ]; then                                                        
    cp $NEW $REF                                                                
    mv $NEW $OLD                                                                
  else                                                                          
    # If reference config file doesn't exist, fall back to the old behavior     
    if [ ! -r $REF ]; then                                                                               
      if [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
        mv $NEW $REF                                                            
      else                                                                      
        cp $NEW $REF                                                            
      fi                                                                        
    else                                                                        
      if [ "$(cat $REF | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
        mv $NEW $REF                                                            
      else                                                                      
        cp $NEW $REF                                                            
      fi                                                                        
    fi                                                                          
  fi                                                                            
}
Unfortunately, this also requires some changes to installpkg and upgradepkg. Because upgradepkg runs installpkg twice, doinst.sh also gets executed twice, and therefore on the second run $REF always has the same contents as $NEW, so $NEW is always discarded. This patch causes doinst.sh to only be executed once with upgradepkg.

Code:
--- upgradepkg.orig	2018-08-23 23:38:24.378352677 -0400
+++ upgradepkg	2018-08-23 23:30:51.966761078 -0400
@@ -302,11 +302,11 @@
 
   # Next, the new package is pre-installed:
   if [ "$VERBOSE" = "verbose" ]; then
-    /sbin/installpkg $INCOMINGDIR/$NNAME
+    /sbin/installpkg --preinstall $INCOMINGDIR/$NNAME
     RETCODE=$?
   else
     echo "Pre-installing package $NEW..."
-    /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+    /sbin/installpkg --preinstall $INCOMINGDIR/$NNAME 1> /dev/null
     RETCODE=$?
   fi
   # Make sure that worked:
--- installpkg.orig	2018-08-23 23:37:54.342581247 -0400
+++ installpkg	2018-08-23 23:31:38.568951574 -0400
@@ -145,6 +145,7 @@
 
 # Parse options:
 MODE=install # standard text-mode
+PREINSTALL=0
 while [ 0 ]; do
   if [ "$1" = "-warn" -o "$1" = "--warn" ]; then
     MODE=warn
@@ -188,6 +189,9 @@
     fi
     ROOT="$2"
     shift 2
+  elif [ "$1" = "-preinstall" -o "$1" = "--preinstall" ]; then
+    PREINSTALL=1
+    shift 1
   else
     break
   fi
@@ -517,7 +521,7 @@
     /sbin/ldconfig
   fi
 
-  if [ -f $ROOT/install/doinst.sh ]; then
+  if [ -f $ROOT/install/doinst.sh -a $PREINSTALL -eq 0 ]; then
     if [ "$MODE" = "install" ]; then
       echo "Executing install script for $(basename $package)."
     fi
I have tested a bit, and it seems to have the right behavior:
  • If the .new config file matches the .ref config file, .new is not installed.
  • If the .new config file is different from the .ref config file, .new is installed.
  • If there is no .ref file, it falls back to the old behavior.
  • In no case is the user's existing config file overwritten.

Last edited by montagdude; 08-23-2018 at 10:52 PM.
 
1 members found this post helpful.
Old 08-24-2018, 12:34 AM   #1907
Darth Vader
Senior Member
 
Registered: May 2008
Location: Romania
Distribution: DARKSTAR Linux 2008.1
Posts: 2,727

Rep: Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247Reputation: 1247
Oh, well...

So, IF your proposal is accepted, in the name of some questionable commodity, the entire /etc folder will be spammed with *.ref files?

One for every config file? OMG!

Heck! Even on RHEL provisioning I do not seen something like this...

Last edited by Darth Vader; 08-24-2018 at 12:36 AM.
 
Old 08-24-2018, 12:53 AM   #1908
bormant
Member
 
Registered: Jan 2008
Posts: 426

Rep: Reputation: 240Reputation: 240Reputation: 240
Seems that using terminus-v* font for setup isn't so good idea.

This fonts (with -v*) have 512 glyphs and use foreground intensity bit to switch between A/B 256 sets. As result the console can use only 8 foreground colors instead of 16 as for fonts with 256 glyphs. In this mode dialog's "windows" has no shaded boxes and looks ugly (for ex. screenshot from this message https://www.linuxquestions.org/quest...ps-4175636135/).

How about using one of 256 glyphs terminus (not terminus-v*) ?

Last edited by bormant; 08-24-2018 at 12:56 AM.
 
Old 08-24-2018, 03:55 AM   #1909
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,781

Rep: Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459Reputation: 1459
Quote:
Originally Posted by montagdude View Post
The idea is that each time config() is called in doinst.sh, it compares the new file with a reference (presumably unmodified) config file rather than the actual installed config file, which may include user edits. It then saves a new reference config file.
Why save the config files instead of the md5 checksums? One file, for example, /var/lib/pkgtools/checksums.md5 would contain lines like

0b546ba67dada3250e3c7e4362066152 /etc/ntp.conf
 
2 members found this post helpful.
Old 08-24-2018, 04:07 AM   #1910
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
Quote:
Originally Posted by franzen View Post
doinst.sh from texlive contains

Code:
( cd usr/bin ; rm -rf man )
( cd usr/bin ; ln -sf ../share/texmf-dist/doc/man man )
This breaks "man", sorry.
A workaround fix is to remove the symlink in within the buildscript, but i'll fix this within texmf_get.sh.
An unrelated question: Would it be possible to include package ucs into TeX Live Slackware installation? There are several other packages listing it as required, as shown by "grep ucs /usr/share/texmf-dist/tex -ri | grep -i Require" (admittedly, in most cases it's optional, but still there are some where it's not).
 
Old 08-24-2018, 04:27 AM   #1911
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Quote:
Originally Posted by montagdude View Post
Not quite, and apparently I was not very clear. Let me try again. I will use ntp as an example, since it was recently upgraded in 14.2. On my system, I had uncommented a few lines in /etc/ntp.conf. When ntp was upgraded, /etc/ntp.conf.new was installed, which only differed from /etc/ntp.conf by having those lines commented again. In other words, /etc/ntp.conf.new was offering to revert the changes I had made. My request is to prevent this from happening. In other words, if ntp.conf in the ntp-4.2.8p12 package is not any different from the one in the previous version, then I would like it to not be installed as ntp.conf.new, because it is in fact not new.
My brain just exploded. <grin>

Maybe to much coffee, not enough beer. If you commented out two lines in ntp.conf, then you have changed it. The new, even if everything is the same "except" for those two commented out lines, the new ntp.conf IS different; thus the ntp.conf.new is installed. With every update to ntp.conf I go through the merge process after upgraded with slackpkg.
 
Old 08-24-2018, 04:51 AM   #1912
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Rep: Reputation: 144Reputation: 144
Unhappy conf.new proposal

I had though of md5's too. You don't need a separate file for them either, they could be in the package doinst.
something like if (calculated md5sum of new conf) != (saved in script md5sum of previous package version of conf file) or (conf file does not exist in situ) then create conf.new version, otherwise do nothing.

The down side of this is that if you messed up the config you would have to remove the config entirely, not just uninstall the package to be presented with a new config

the other downside is Pat would have to keep track of all those md5sums in the doinstall.sh
It also could present a problem if the project changes the name or number of conf files. (I know it isn't in slack114.2 but think dovecot going from single config to config+config directory with more config files. In that case, the functional result did not change, but the default example configs did.)

It would have another problem; what if the config changed in one update, but not the next one. If you had missed an update, when you applied the latest version it would not change the config because the last one had not changed. It would not know that you had the version previous to that, as it could only compare the config with the previous version, not the one before it. This problem (user not doing every update available in sequence) is much more of an issue as it negates any benefit you might gain from implementing it. In fact this one seems to be a show-stopper for the idea.
 
2 members found this post helpful.
Old 08-24-2018, 04:57 AM   #1913
linuxtinker
Member
 
Registered: Dec 2013
Location: NJ / USA
Distribution: Slackware 64 -Current
Posts: 232

Rep: Reputation: 99
Quote:
Originally Posted by Darth Vader View Post
Oh, well...

So, IF your proposal is accepted, in the name of some questionable commodity, the entire /etc folder will be spammed with *.ref files?

One for every config file? OMG!

Heck! Even on RHEL provisioning I do not seen something like this...



It could always have an on/off switch in a config file..or the ref file reside in another directory. I know I could have used those *.ref files when I borked a few config files.



ps. Might want to turn down the drama responses you might get better feedback.
 
1 members found this post helpful.
Old 08-24-2018, 05:05 AM   #1914
franzen
Member
 
Registered: Nov 2012
Distribution: slackware
Posts: 535

Rep: Reputation: 379Reputation: 379Reputation: 379Reputation: 379
Quote:
Originally Posted by cgorac View Post
An unrelated question: Would it be possible to include package ucs into TeX Live Slackware installation? There are several other packages listing it as required, as shown by "grep ucs /usr/share/texmf-dist/tex -ri | grep -i Require" (admittedly, in most cases it's optional, but still there are some where it's not).
When i find time, i will implement that on creation of texlive-base, \RequirePackage will be checked, and hard deps will be added too.
Don't know how this works out, but it's desireable that nothing in the stock texlive package depends on an external(e.g. SBo) package, while keeping the the stock package small.

Johannes
 
Old 08-24-2018, 07:37 AM   #1915
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by Darth Vader View Post
Oh, well...

So, IF your proposal is accepted, in the name of some questionable commodity, the entire /etc folder will be spammed with *.ref files?

One for every config file? OMG!

Heck! Even on RHEL provisioning I do not seen something like this...
Who cares? Plus, they have a valid purpose; sometimes it is useful to have a quick way to check what you changed in the config file. Anyway, as others have said, there are other ways to accomplish the same purpose, such as storing the checksums instead of the files.
 
1 members found this post helpful.
Old 08-24-2018, 07:43 AM   #1916
upnort
Senior Member
 
Registered: Oct 2014
Distribution: Slackware
Posts: 1,893

Rep: Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161Reputation: 1161
One way to handle the *.new challenge is provided by the Salix devs. The applet is called -- drum roll -- dotnew. One option in the applet is to view a diff of the affected files. Or a vimdiff.

Some Slackers have been asking for sbopkg, slackpkg+, slapt-get/gslapt to be added to the Slackware /extra repo. Perhaps most if not all of the Salix admin tools could be included in that wish list.
 
Old 08-24-2018, 07:52 AM   #1917
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by chrisretusn View Post
My brain just exploded. <grin>

Maybe to much coffee, not enough beer. If you commented out two lines in ntp.conf, then you have changed it. The new, even if everything is the same "except" for those two commented out lines, the new ntp.conf IS different; thus the ntp.conf.new is installed. With every update to ntp.conf I go through the merge process after upgraded with slackpkg.
That's the point. I don't want to have to go through the diff and merge process just to confirm that I really do want to keep the changes that I already made. I would like to only consider changes that are actually new.
 
Old 08-24-2018, 08:54 AM   #1918
USUARIONUEVO
Senior Member
 
Registered: Apr 2015
Posts: 2,335

Rep: Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930Reputation: 930
gparted-0.32.0

https://sourceforge.net/projects/gpa...ar.gz/download
 
1 members found this post helpful.
Old 08-24-2018, 09:34 AM   #1919
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Quote:
Originally Posted by montagdude View Post
That's the point. I don't want to have to go through the diff and merge process just to confirm that I really do want to keep the changes that I already made. I would like to only consider changes that are actually new.
Well I can certainly understand that. I think we are taking the simple of of KIS. I'm always for less work. Maintaining -current takes some work. I'm fine with that. Looking at ntp.conf as the example. You change two lines from the default, the new ntp.conf is unchanged except for those two lines. I can see that. How you going to tell the installer yours is the same except for those two lines?

What about may use case? My ntp.conf has 4 parts, 9 lines in all that have changed from the default. Some configurations files are a nightmare (cups.conf) for example. I gotten to the point of selecting keep (cups.conf.new) then deleting it after processing via slackpkg is finished so it won't come up again because I know there are no changes affecting my setup.
 
Old 08-24-2018, 09:39 AM   #1920
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
Quote:
Originally Posted by franzen View Post
When i find time, i will implement that on creation of texlive-base, \RequirePackage will be checked, and hard deps will be added too.
That would be great. In any case, thanks for all your work so far on packaging TeX Live for Slackware.
 
1 members found this post helpful.
  


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] Requests for -current (20151216) rworkman Slackware 3441 12-28-2017 03:50 PM

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

All times are GMT -5. The time now is 02:43 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