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 06-20-2015, 08:14 AM   #1
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Rep: Reputation: Disabled
slackchlog - poor man's Slackware changelog viewer


Hi,

Below follows a script code I wrote to check for Slackware changelog changes.
It will display only the changed parts of the changelog (since the last time the script has been run).

Feel free to use

slackchlog:
Code:
#!/bin/sh

set -e

LOGCUR="$HOME/.slackware.ChangeLog.txt"
LOGTMP="$HOME/.slackware.ChangeLog.txt.tmp"
LOGOLD="$HOME/.slackware.ChangeLog.txt.old"

wget "ftp://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt" -O "$LOGTMP"

[ ! -e "$LOGCUR" ] && touch "$LOGCUR"
mv "$LOGCUR" "$LOGOLD"
mv "$LOGTMP" "$LOGCUR"

echo "ChangeLog:"
echo "============================"
OLINE="$(head -n1 "$LOGOLD")"
while read NLINE; do
  [ "$OLINE" = "$NLINE" ] && break
  echo "$NLINE"
done < "$LOGCUR"
--
Best regards,
Andrzej Telszewski
 
Old 06-20-2015, 11:02 AM   #2
ttk
Senior Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 1,038
Blog Entries: 27

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Love it! :-) Very neat and focused.

I have a similar thinger in my server's /etc/cron.daily which mails diffs. It uses perl, though, making it less desirable to some:

http://ciar.org/ttk/public/slacklog.pl.txt
 
Old 06-20-2015, 11:27 AM   #3
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

Initially I wanted to use 'diff' also but couldn't come with the idea how to do it.
And now I see it in your solution:
Code:
/usr/bin/diff -wiBaE $OLD_LOG $NEW_LOG 2>\&1 | /bin/grep '^>' | cut -b 3-
Nice.

--
Best regards,
Andrzej Telszewski
 
Old 06-20-2015, 12:19 PM   #4
ttk
Senior Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 1,038
Blog Entries: 27

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Thank Sylvain Robitaille :-) I'm pretty sure that line came from his bash script before I incorporated it into mine.
 
Old 06-20-2015, 12:25 PM   #5
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
IMHO, I would consider also the -N option of wget, that downloads a file only if the timestamp is different from the one of the local copy (to be friendly versus the server hosting the changelog): note that this can't be used in combination with -O (see the man page) so if you decide to use it you might have to change the script a little...

Last edited by ponce; 06-20-2015 at 12:28 PM.
 
2 members found this post helpful.
Old 06-20-2015, 04:06 PM   #6
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,
Quote:
I would consider also the -N option of wget
Done.

Also, now the script accepts Slackware version as the first argument, so you can check log for versions different than current. Code below.
Code:
#!/bin/sh

set -e

SLKVER=${1:-64-current}
LOGDIR="$HOME/.slackware.ChangeLog/$SLKVER"
LOGNEW="$LOGDIR/ChangeLog.txt"
LOGOLD="$LOGDIR/ChangeLog.txt.old"

mkdir -p "$LOGDIR"
[ ! -e "$LOGOLD" ] && touch "$LOGOLD"

wget -N -P "$LOGDIR" "ftp://ftp.osuosl.org/pub/slackware/slackware$SLKVER/ChangeLog.txt"

echo "ChangeLog:"
echo "============================"
diff -wiBaE "$LOGOLD" "$LOGNEW" | grep "^>" | cut -b 3-

cp "$LOGNEW" "$LOGOLD"
--
Best regards,
Andrzej Telszewski
 
1 members found this post helpful.
Old 06-20-2015, 04:13 PM   #7
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
Quote:
Originally Posted by atelszewski View Post
Hi,

Below follows a script code I wrote to check for Slackware changelog changes.
It will display only the changed parts of the changelog (since the last time the script has been run).

Feel free to use

slackchlog:
Code:
#!/bin/sh

set -e

LOGCUR="$HOME/.slackware.ChangeLog.txt"
LOGTMP="$HOME/.slackware.ChangeLog.txt.tmp"
LOGOLD="$HOME/.slackware.ChangeLog.txt.old"

wget "ftp://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt" -O "$LOGTMP"

[ ! -e "$LOGCUR" ] && touch "$LOGCUR"
mv "$LOGCUR" "$LOGOLD"
mv "$LOGTMP" "$LOGCUR"

echo "ChangeLog:"
echo "============================"
OLINE="$(head -n1 "$LOGOLD")"
while read NLINE; do
  [ "$OLINE" = "$NLINE" ] && break
  echo "$NLINE"
done < "$LOGCUR"
--
Best regards,
Andrzej Telszewski
I loved it! Really smart-ass!
 
Old 06-20-2015, 05:04 PM   #8
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
I changed it slightly so there's no output in case the changelog doesn't change (maybe useful for putting it in crontab so you get a mail only if it changes)

Code:
#!/bin/sh

set -e

SLKVER=${1:-64-current}
LOGDIR="$HOME/.slackware.ChangeLog/$SLKVER"
LOGNEW="$LOGDIR/ChangeLog.txt"
LOGOLD="$LOGDIR/ChangeLog.txt.old"

mkdir -p "$LOGDIR"
[ ! -e "$LOGOLD" ] && touch "$LOGOLD"

wget -q -N -P "$LOGDIR" "ftp://ftp.osuosl.org/pub/slackware/slackware$SLKVER/ChangeLog.txt"

DIFF=$(diff -wiBaE "$LOGOLD" "$LOGNEW" | grep "^>" | cut -b 3-)

if [ "$DIFF" ]; then
        echo "slackware$SLKVER ChangeLog:"
        echo "+--------------------------+"
        echo "$DIFF"
        cp "$LOGNEW" "$LOGOLD"
fi
 
Old 06-20-2015, 05:41 PM   #9
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

I see it attracts attention.
Maybe Pat should include something like that in the next release if he sees many hits on the server?

--
Best regards,
Andrzej Telszewski
 
Old 06-22-2015, 07:09 AM   #10
ahlr
Member
 
Registered: Jun 2012
Distribution: Slackware-Current
Posts: 44

Rep: Reputation: Disabled
Very good!

How to make a pop-up with the changelog?
 
Old 06-22-2015, 07:38 AM   #11
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
hi ahlr,

I personally never tried (also because I don't use any icon tray), but I spotted this

http://slackbuilds.org/repository/14.1/desktop/sun/

Last edited by ponce; 06-22-2015 at 07:40 AM.
 
Old 07-08-2015, 10:23 AM   #12
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

Quote:
I would consider also the -N option of wget
The "-N" option prevents fetching the changes as of Tue Jul 7 22:59:17 UTC 2015. Any idea why it is so?
wget simply says the file is up to date.

--
Best regards,
Andrzej Telszewski
 
Old 09-12-2015, 10:21 AM   #13
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

Quote:
Love it! :-) Very neat and focused.
Unfortunately this is no longer the truth
I spent some time and boiled something more complex

Quote from README:
Quote:
slackchlog is Slackware's ChangeLog viewer written in BASH.
It allows to download and view the remote ChangeLog file and
also to generate RSS feed suitable for RSS feed readers.
Using command line arguments, it's possible to specify
the architecture, release and mirror for the ChangeLog file
in question.

For usage details, type:
$ slackchlog --help
Help output:
Code:
Usage: /usr/bin/slackchlog [OPTIONS]

Options are:
  --text-diff-remote  Display textual diff between remote and local ChangeLog.
                      This is the default action.
  --text-diff-local   Display textual diff for local ChangeLog, that is,
                      the result of the most recent --text-diff-remote action.
  --rss-remote        Display remote ChangeLog in RSS format.
  --arch=ARCH         Slackware architecture (x86, x86_64, arm). Default: detect.
  --release=RELEASE   Slackware release (current, 14.1, etc.). Default: current.
  --timeout=TIMEOUT   Timeout (in seconds) for fetching the remote ChangeLog.
                      Default: 10 seconds.
  --cache-dir=DIR     Specify an alternative directory for storing ChangeLog's data.
                      Default: $HOME/.cache/slackware.ChangeLog.
  --mirror-file=FILE  Specify an alternative mirror list for remote ChangeLog.
                      Default: $HOME/.config/slackchlog.mirror.txt.
                      In the case where the default file does not exist and
                      alternative file is not specified, upstream URLs are used.
  --verbose           Be verbose (quiet by default).
  --help              Display this help message and exit.
  --version           Display version and exit.

Note:
  It is perfectly acceptable to specify the same option multiple times.
  In such case, the last one takes precedence
I think with all this functionality the script can fulfill the needs of:
- console users,
- crontab users,
- GUI users (provided that your feed reader supports external commad).

Please give the thing a try and let me know what you think.
From my point of view, it's feature complete, so I only accept bug fixes
Should you spot something erroneous, please let me know.
I'm planning to push it to SlackBuilds.org after initial reviews.

For now:
- source (md5: 46bcdcf32410e2345faf616afce1b31e)
- package (md5: 7545bde33add02cb70940c04fc850cd1)

Once the SlackBuild gets accepted on SBo, the package will be removed. [ACCEPTED, REMOVED]

Attached screen shot of slackchlog in action

--
Best regards,
Andrzej Telszewski
Attached Thumbnails
Click image for larger version

Name:	slack_log_feed.png
Views:	97
Size:	89.4 KB
ID:	19560  

Last edited by atelszewski; 09-26-2015 at 04:26 AM.
 
Old 09-12-2015, 04:13 PM   #14
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 -current,
Posts: 550

Rep: Reputation: 196Reputation: 196
Quote:
Originally Posted by ttk View Post
It uses perl, though, making it less desirable to some:
And more desirable to others
 
Old 09-13-2015, 06:05 AM   #15
atelszewski
Member
 
Registered: Aug 2007
Distribution: Slackware
Posts: 948

Original Poster
Rep: Reputation: Disabled
Hi,

Quote:
Originally Posted by fogpipe View Post
And more desirable to others
The more I program in shell, the more I want to go to C/C++.

--
Best regards,
Andrzej Telszewski
 
  


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
Poor man's graphical boot in Slackware revisited... Keith Hedger Slackware 82 03-29-2016 07:49 PM
Poor man's graphical boot in Slackware 13.X... LuckyCyborg Slackware 38 05-21-2011 11:33 AM
Wanna do a poor man's slacktop... papa0822 Linux - Laptop and Netbook 2 10-12-2004 06:59 PM
poor man alaios Linux - Laptop and Netbook 3 04-17-2004 10:11 AM
Network for poor man (SuSE) Björneborg Linux - Networking 1 01-27-2003 12:18 PM

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

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