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 12-03-2010, 07:25 AM   #1
lionsong
LQ Newbie
 
Registered: Sep 2009
Location: UK
Distribution: slackware
Posts: 7

Rep: Reputation: 0
suggestions for parsing slack -current changelogs


Hi there,
I'm trying to get better at CLI work and for a first project I'd like to be able to parse the daily changelogs of slackware -current and output them to a terminal.
So far i've got the following, i'd really appreciate people pointing out whats a) wrong b) stupid and c) stupidly wrong.
From the wget manpage, the option "-o -" prints to standard output, so sticking

Code:
wget -o - ftp://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt
in a cronjob would update my changlogs automatically and print it to the terminal, then how would i go about binding this to specific terminal (for example one i've pinned to the desktop)?
Maybe this would'nt be the best way either as it would not store a local copy of the changelog (just prints to stdout).
Also if the changelog is large how would i go about formatting the output, im guessing sed....

So whadya think?
 
Old 12-03-2010, 09:34 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
I suggest you start by reading the Advanced Bash-Scripting Guide: http://tldp.org/LDP/abs/html/TV .
Your question is so vague that it is realy impossible to answer in a non-interactive way, like on this forum.

Eric
 
1 members found this post helpful.
Old 12-03-2010, 12:13 PM   #3
brixtoncalling
Member
 
Registered: Jul 2008
Location: British Columbia
Distribution: Slackware current
Posts: 403

Rep: Reputation: 67
Quote:
in a cronjob would update my changlogs automatically and print it to the terminal, then how would i go about binding this to specific terminal (for example one i've pinned to the desktop)?
It is a little unclear what you are trying to do. If you want the changelog to periodically be saved to your computer then you are nearly there. You could even write a script that would show the changelog on a terminal once a day -- but this probably wouldn't be a good thing since who knows what you are using that terminal for when it happens to run and dump the data to your screen?

Code:
while [ true ]
do    
    sleep 1d
    wget -O - ftp://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt
done
Save it as changelog.sh, make it executable and then run it in your terminal or put it in your .bashrc:
Code:
# changelog.sh &
But it's not particularly useful.

First try to come up with exactly what you want to do and I'm sure people will be happy to help.
 
Old 12-04-2010, 09:24 AM   #4
lionsong
LQ Newbie
 
Registered: Sep 2009
Location: UK
Distribution: slackware
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
it is realy impossible to answer in a non-interactive way
Good point. Forums are not IRC, i probably haven't taken part enough in online communities to recognise that.

I thought id alluded sufficiently to what i was trying to achieve, but reading back i can see i should have made a clearer exposition.

Basically, using fluxbox i have several terminals pinned to the desktop (i.e frameless, persistant and beneath ever other window) to which i output things like htop. Sort of a poor mans conky.
I'd like to have one of these terminals display the daily changelogs of slack -current.

What i meant by the title of this thread (which thinking about it would have read better as "wanting suggestions for a way of parsing....) was to open up a dialog with more experienced users as to how to approach the problem of having the changelogs automagically update to my desktop.

The method i suggested was to wget them daily, another idea i had was to write a script to update locally whenever they were updated on the ftp server, and so on.

So im open to suggestions about approachs to the problem.

Thanks to Alien Bob and Brixtoncalling for the tips regarding clarity, they are good points and will be well remembered.
 
Old 12-04-2010, 10:26 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,901

Rep: Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025Reputation: 5025
Put something like:
Code:
wget -O - ftp://ftp.osuosl.org/pub/slackware/slackware64-current/ChangeLog.txt >/tmp/changelog.txt
in cron on whatever schedule you like. (daily seems reasonable - don't do it too often so as not to abuse the ftp site)

Then display the latest days worth of log with
Code:
sed -n -e "0,/+--/p" /tmp/changelog.txt | xmessage -file -
Instead of xmessage you can display it anyway you like. Putting the sed in .bashrc might not be a bad choice rather than having it permanently on your desktop.
Or if you prefer you could even use dialog:
Code:
dialog --msgbox "$(sed -n -e "0,/+--/p" /tmp/changelog.txt)" 0 0
to imbed this in an xterm you could use the -e option
Code:
xterm -T "Latest ChangeLog" -e 'dialog --msgbox "$(sed -n -e "0,/+--/p" /tmp/changelog.txt)" 0 0'
The options are as unlimited as your imagination.

Last edited by GazL; 12-04-2010 at 10:44 AM.
 
Old 03-10-2011, 09:12 AM   #6
neymac
Member
 
Registered: May 2009
Distribution: Slackware64-14.1
Posts: 138

Rep: Reputation: 19
For those who use kde, like me:
Code:
#!/bin/bash
#Shows changelog.txt slackware64-current in a kde text box
wget -O - ftp://ftp.osuosl.org/pub/slackware/s.../ChangeLog.txt >/tmp/changelog.txt
kdialog --textbox /tmp/changelog.txt 700 950
exit 0
Save it like:
Code:
changelog.sh
Make it executable:
Code:
chmod +x changelog.sh
Then run:
Code:
./changelog.sh
PS****
For command line interface do:
Code:
wget -O - ftp://ftp.osuosl.org/pub/slackware/s.../ChangeLog.txt >/tmp/changelog.txt && dialog --textbox /tmp/changelog.txt 700 950

Last edited by neymac; 03-10-2011 at 09:35 AM.
 
Old 03-10-2011, 09:52 AM   #7
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
I use a method that runs a script from a cronjob. Basically the steps

mv the last changelog to changelog.old
wget the new changelog
diff the two > somefile
if there is a change mailx the diff to me
 
Old 03-10-2011, 10:58 AM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,240

Rep: Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322Reputation: 5322
Vincent Batts has RSS feeds for the changelogs. Just subscribe to one.

http://connie.slackware.com/~vbatts/
 
1 members found this post helpful.
Old 03-11-2011, 06:18 AM   #9
lionsong
LQ Newbie
 
Registered: Sep 2009
Location: UK
Distribution: slackware
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks guys, they are some great suggestions (im playing with GazL's method at the minute).

Sorry dugan, although that is by far the easiest method i am trying to use this as a learning experience in shell scripting. But thanks anyway.
 
  


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
Do Current changelogs always say (pre-release)? damgar Slackware 2 04-01-2010 02:18 AM
In Linux Slackware Project how do I update Slack 12 following the "Changelogs" route? JamesAG Slackware 7 04-20-2008 02:01 PM
Seg faults and slack pack parsing! MylesCLin Programming 6 02-23-2005 11:20 PM
current Slack-Current giving troubles? r_jensen11 Slackware 5 02-02-2004 05:08 PM
Need suggestions for parsing a shell variable Pauly Linux - General 1 01-15-2003 07:32 PM

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

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