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 02-02-2024, 08:29 PM   #1
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 231

Rep: Reputation: 45
One more Thread on things 'Slackpkg' .


Hello All , As mentioned in the subject line this is one more attempt to educate myself & keep my CRON Script in line with newer options showing up in slackpkg .
Please no mentions that slackpkg shouldn't be run as a cron script it is and for the forseeable future will have to remain so .

One beef is that even with , -batch=on & -default_answer=y , I still get the 'Select what you want file-by-file' options floating around in the output . Which My script in its present form is unable to direct slackpkg to do what I wish to have happen .
ALSO Please note the wonderful escape codes plunked into output shown below .

My hopes are to ...
1 ) Not have the escape output from a manually run command when I am usung -batch=on
2 ) A way of Keeping the previous *.conf files unchanged .
3 ) A way of getting a DIFF in the output from the cron run . Hopefully using slackpkg's selection of diff .

ie: ...
Code:
Select what you want file-by-file 

/etc/bluetooth/input.conf.new - ^[7(K)eep
^[8(O)verwrite
^[8(R)emove
^[8(D)iff
^[8(M)erge
^[8(V)imdiff
^[8K
Please note the bash script that is in use is attached .
NS4-do-slackpkg-for-updates.sh.txt

as well as an output file ...
cron_do-slackpkg-for-updates.sh_of_20231221012133.txt

Tia , JimL
 
Old 02-02-2024, 09:24 PM   #2
reddog83
Member
 
Registered: Apr 2018
Distribution: Slackware 15.0/Current
Posts: 461

Rep: Reputation: 237Reputation: 237Reputation: 237
what happened here:

Quote:
usr/libexec/slackpkg/functions.d/post-functions.sh: line 189: [: 19: unary operator expected
 
1 members found this post helpful.
Old 02-02-2024, 09:38 PM   #3
pghvlaans
Member
 
Registered: Jan 2021
Distribution: Slackware64 {15.0,-current}, FreeBSD, stuff on QEMU
Posts: 459

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Code:
if [ $(( newcount + TEXTLINES )) -lt $ROWS ] || [ "${BATCH}" = "on" ]; then
Best guess: $ROWS is undefined because the script was running as a cron job and therefore wasn't outputting to a terminal window.
 
Old 02-02-2024, 11:20 PM   #4
dchmelik
Senior Member
 
Registered: Nov 2008
Location: USA
Distribution: Slackware, FreeBSD, Illumos, NetBSD, DragonflyBSD, Plan9, Inferno, OpenBSD, FreeDOS, HURD
Posts: 1,074

Rep: Reputation: 149Reputation: 149
I only cron slackpkg to get emailed update notifications, which I think is okay... but what are you saying you do with your cron job?
 
Old 02-03-2024, 03:19 AM   #5
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Quote:
Originally Posted by reddog83 View Post
what happened here:
The fix for that was here: https://www.linuxquestions.org/quest...0/#post6235743
 
Old 02-03-2024, 03:27 AM   #6
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Quote:
Originally Posted by babydr View Post

One beef is that even with , -batch=on & -default_answer=y , I still get the 'Select what you want file-by-file' options floating around in the output .

ALSO Please note the wonderful escape codes plunked into output shown below .

My hopes are to ...
1 ) Not have the escape output from a manually run command when I am usung -batch=on
2 ) A way of Keeping the previous *.conf files unchanged .
I added a cronjob to simply run '/usr/sbin/slackpkg -batch=on -default_answer=y new-config'. I did not get escape codes nor 'Select what you want file-by-file'. This is the mail message crond sent me:
Code:
Searching for NEW configuration files...
Some packages had new configuration files installed (2 new files):

/etc/a2ps.cfg.new
/etc/a2ps-site.cfg.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
y

OK! Your choice is nothing! slackpkg will Keep the old files for you to deal with later

Last edited by Petri Kaukasoina; 02-03-2024 at 08:55 AM.
 
Old 02-03-2024, 08:07 AM   #7
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Your run of 'slackpkg -batch=on -default_answer=y new-config' selected P for (P)rompt K, O, R selection for every single file. Mine did not.

OK, let's look at /usr/libexec/slackpkg/functions.d/post-functions.sh:

Code:
    140         # if there is a /etc/slackpkg/post-functions.conf file, it will be
    141         # used to take the pre-defined action to each file specified there.
    142         if [ -f /etc/slackpkg/post-functions.conf ]; then
    143                 NEWCONFIG="/etc/slackpkg/post-functions.conf"
    144         fi
...
    254                 if [ "${BATCH}" = "on" ] && [ -n "${NEWCONFIG}" ]; then
    255                         ANSWER=P
    256 
    257                         # This allows to have a default behaviour for all .new files in batch mode.
    258                         DEF_AUTOANSWER="$(sed -ne 's#^default:\([ORK]\)#\1#p' $NEWCONFIG 2>/dev/null)"
    259                 fi
You must have created file /etc/slackpkg/post-functions.conf to select actions for different .new files. It does not exist originally. What does it contain? Try to rename it. There is only a sample file /etc/slackpkg/post-functions.conf-sample here.
 
1 members found this post helpful.
Old 02-03-2024, 08:43 AM   #8
Petri Kaukasoina
Senior Member
 
Registered: Mar 2007
Posts: 1,854

Rep: Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522Reputation: 1522
Quote:
Originally Posted by babydr View Post
3 ) A way of getting a DIFF in the output from the cron run . Hopefully using slackpkg's selection of diff .
How about running a separate diff in your cron script:
Code:
find /etc /var/yp /usr/share/vim -type f -name '*.new' \
 ! -name rc.inet1.conf.new ! -name rc.wireless.conf.new ! -name group.new \
 ! -name passwd.new ! -name shadow.new ! -name gshadow.new 2>/dev/null| \
sort -V| while read f; do diff -u ${f%.new} $f;done
 
Old 02-03-2024, 10:34 PM   #9
babydr
Member
 
Registered: Aug 2015
Location: Fairbanks , Alaska
Distribution: Slackware-14.2 & 15.0
Posts: 231

Original Poster
Rep: Reputation: 45
Thank You All for the comments & insights .

@Petri Kaukasoina ,
As re: #7 , Yes indeed that file existed and contained (*) , It was placed there as a test iirc , I've renamed it . Next update will see what happens then & report back . But iirc without that my script never ends and/or leaves alot of lost bits lying about .
As re: #5 , And WHY that update to slackpkg Doesn't seem to be affective in my installation of slackpkg is a quandry for me (**) & (***) .
As re: #8 , I could run a diff as a further function of my script , Tho was hoping to leverage slackpkg's than to duplicate the work .

@dchmelik , The intent is to update all packages that have been installed .


(*)
Code:
blacklist
# You can list here the .new files and the default action
# to do for each file. The list format is:
# 
# /full/path/of/dot/new/file.new:action
# 
# The action can be:
# 
# O to Overwrite it with the new version
# R to Remove the new file
# K to Keep the current and the .new files
#
# Using "default" as file name, you'll set the action for
# the .new files in batch mode. The action for each file
# takes precedence over the "default" one.
#
# E.g:
#/etc/slackpkg/mirrors.new:K
#/etc/ntp.conf.new:R
#
#
#default:O
default:K
(**)
Code:
# slackpkg -h

-h: Unknown option.

slackpkg - version 15.0.10
(***)
Code:
Mon Jan 17 22:44:42 UTC 2022
Things haven't quite settled down yet with more bugfixes and a couple of safe
upgrades, so not today folks. But enjoy Slackware's half-birthday anyway! ;-)
ap/slackpkg-15.0.10-noarch-1.txz: Upgraded.
       Fix mirrors.ucr.ac.cr link address (Emmet Ford)
       Remove wroc.pl mirrors (Emmet Ford)
       Remove kddilabs.jp from mirrors (Emmet Ford)
       Unattended usage improvements (PiterPUNK)
       Create file to flag if the system needs restart (PiterPUNK)
       Thanks to Robby Workman.
 
  


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
having trouble after upgrading 14.1 slackware using slackpkg and slackpkg+ [solved] slackartist Slackware 1 12-28-2015 07:28 AM
[SOLVED] Slackpkg, Slackpkg Plus, Slackware 14.1 x86_64 install.log delay or slow to write bamunds Slackware 7 04-22-2014 11:12 AM
[SOLVED] typos in latest /etc/slackpkg/mirrors(.new) [slackpkg-2.82.0-noarch-8.tgz] wailingwailer Slackware 4 09-22-2012 04:04 AM
how can a variable entered in one thread be used in another thread ?? apanimesh061 Linux - Kernel 2 09-16-2011 01:41 AM
Slackpkg: missing something in /usr/libexec/slackpkg/functions.d/dialog-functions.sh michelino Slackware 4 03-20-2007 12:22 PM

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

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