LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-19-2008, 02:26 AM   #1
khronosschoty
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 648
Blog Entries: 2

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
pkgtool source code.


Does any one know what pkgtool was written in. I am looking around the net and I still have not found any leads. Things some times are right in front of my face and I am blind... but I am not being lazy...

I want to examine how pkgtool was written. If for example I wanted to modify it or something.
 
Old 10-19-2008, 02:37 AM   #2
fietser
Member
 
Registered: Feb 2006
Location: Nederland
Distribution: slackware
Posts: 47

Rep: Reputation: 7
less /sbin/pkgtool
Succes.
 
Old 10-19-2008, 03:36 AM   #3
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
http://slackware.osuosl.org/slackwar...ce/a/pkgtools/
 
Old 10-19-2008, 03:55 AM   #4
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by empcrono View Post
Does any one know what pkgtool was written in. I am looking around the net and I still have not found any leads. Things some times are right in front of my face and I am blind... but I am not being lazy...

I want to examine how pkgtool was written. If for example I wanted to modify it or something.
It is shell script. Open it with any text editor.
 
Old 10-19-2008, 07:13 AM   #5
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
The file command tells you about a file's type and the which command will search the paths for it so try this :
Code:
file $(which pkgtool)
/sbin/pkgtool: Bourne shell script text executable
 
Old 10-19-2008, 02:58 PM   #6
khronosschoty
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 648

Original Poster
Blog Entries: 2

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Quote:
Originally Posted by ErV View Post
It is shell script. Open it with any text editor.
wow pkgtool was written as a shell script. The shell is indeed powerful. I know for example that Gentoo's package manager was written in python. I wounder if there would be an advantage if one rewrote pkgtool in C. That was my idea. See I am trying to learn how to program and I have gone through books on it and I get the Idea... but non of those books inspired me to do anything so I forget most of what is in there. I was thinking of a project that would be challenging but not so challenging something that like a project that would teach me.. so I though what if I just rewrote something it would teach me a lot about things.

So I though lets rewrite pkgtool.

Quote:
The file command tells you about a file's type and the which command will search the paths for it so try this :

Code:

file $(which pkgtool)
/sbin/pkgtool: Bourne shell script text executable
Thank you you showed me ware to find it locally. But I thought it was cool that you gave me a script to use to figure all that stuff out. So I typed in the command line... never mind as I was writing this I just thought maybe I should type in the command as root and sure enough when I did it worked thanks a lot.
 
Old 10-19-2008, 03:06 PM   #7
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
If you want to programm something in C, why not try a graphical (gtk or qt lib) front end for a command tool program ?
(I myself did a graphical front end for 'at' command as a learning project first with motif then with gtk )
re-write pkgtool in C as a learning programming experience could be dangerous I think, if you make an error, you risk some serious damage for your system as pkgtool is rather a critical slackware program...
 
Old 10-19-2008, 03:18 PM   #8
khronosschoty
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 648

Original Poster
Blog Entries: 2

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
Quote:
Originally Posted by keefaz View Post
If you want to programm something in C, why not try a graphical (gtk or qt lib) front end for a command tool program ?
(I myself did a graphical front end for 'at' command as a learning project first with motif then with gtk )
re-write pkgtool in C as a learning programming experience could be dangerous I think, if you make an error, you risk some serious damage for your system as pkgtool is rather a critical Slackware program...
I see your point. O okay at first when I sat down to write my next question I was going to ask why would I want to do Graphics when I am trying to program and then I got it.I think I figured out what your were saying reasoning it out as I typed. Your suggesting a graphics front end for the command line. That is cool. e.g. pkgtool is a graphics front end in the command line.. something of that nature of GUI


Just out of interest I do realize that pkgtool could bring it all down if I messed up but do you think there would be an advantage to having it written in C?

Last edited by khronosschoty; 10-19-2008 at 03:19 PM.
 
Old 10-19-2008, 03:29 PM   #9
ludist
Member
 
Registered: Nov 2005
Location: Greece
Distribution: Slackware
Posts: 172

Rep: Reputation: 21
Quote:
Originally Posted by empcrono View Post
I wounder if there would be an advantage if one rewrote pkgtool in C. That was my idea. See I am trying to learn how to program and I have gone through books on it and I get the Idea... but non of those books inspired me to do anything so I forget most of what is in there. I was thinking of a project that would be challenging but not so challenging something that like a project that would teach me.. so I though what if I just rewrote something it would teach me a lot about things.
I think someone allready done that.

What about to write a front-end / program for pccard tools? I think there is no GUI for that. (but, I think it's too simple task )
 
Old 10-19-2008, 03:40 PM   #10
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
Quote:
I just thought maybe I should type in the command as root
Oops - sorry I should have told you that - nice one for figuring it out ! Of course /sbin is part of root's path but not a normal user.
 
Old 10-19-2008, 03:41 PM   #11
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Quote:
Originally Posted by empcrono View Post
Just out of interest I do realize that pkgtool could bring it all down if I messed up but do you think there would be an advantage to having it written in C?
I don't see any advantage, only drawbacks
The major drawback: after each official pkgtool update, you have to rebuild your program to include the change
Other drawback: Heavy string manipulations, deal with system permissions, run as root etc..
For system admin tools like this, I think shell scripts are better suited
You don't need really need memory/CPU performances here, just reliability
 
Old 10-19-2008, 04:29 PM   #12
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Lower Rhine region, Germany
Distribution: Slackware64 14.2 and current, SlackwareARM current
Posts: 1,645

Rep: Reputation: 146Reputation: 146
Quote:
Originally Posted by ludist View Post
I think someone allready done that.
http://spkg.megous.com/ is one.
 
Old 10-19-2008, 06:09 PM   #13
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
Quote:
Originally Posted by bgeddy
Oops - sorry I should have told you that - nice one for figuring it out ! Of course /sbin is part of root's path but not a normal user.
But
Code:
file `whereis -b pkgtool | awk '{print $2}'`
will work as any user.
 
Old 10-20-2008, 12:32 AM   #14
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
Quote:
Originally Posted by empcrono View Post
I wounder if there would be an advantage if one rewrote pkgtool in C. That was my idea.
This is pointless and there won't be any advantage. Using C makes sense only for CPU-intensive tasks, for large programs or for projects that can't be done using scripts. Script allow high flexibility and very high development speed (script will work right after you modify it). So by doing rewrite into C you'll waste your time. So my advice: try something else.
 
Old 10-21-2008, 05:39 PM   #15
mudflap
Member
 
Registered: Jul 2008
Location: Coffin Point
Distribution: Slackware - ttylinux - CPO
Posts: 53

Rep: Reputation: 15
>> empcrono

Pkgtool is merely a front-end. Most, if not all the scripts it calls up can be run directly from the command line.

You may find the "Advanced Bash Scripting" documentation useful if you need a more thorough explanation than you get from "man bash"

http://tldp.org/LDP/abs/html/
 
  


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
LXer: Krugle offers code search engine for open source, with open source LXer Syndicated Linux News 0 02-27-2007 08:04 AM
LXer: Voip Encryption, source code open source LXer Syndicated Linux News 0 07-09-2006 03:21 PM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM
Swaret/Pkgtool confusion and a source compile query dos1 Slackware 3 10-21-2003 06:51 AM

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

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