LinuxQuestions.org
Visit Jeremy's Blog.
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 11-16-2007, 06:00 PM   #1
agentc0re
Member
 
Registered: Apr 2007
Location: SLC, UTAH
Distribution: Slackware
Posts: 200

Rep: Reputation: 34
src2pkg for Webmin - can't create a working pkg


I am having trouble turning the webmin source into a package. durring the src2pkg process, when i get to the install command part i run through the webmin config. i think this is where it all goes to hell. i follow through the setup like i normally would (just agree with all the default destinations). src2pkg completes and creates the package file just fine but when i install it, not everything is being installed. nothing in the /usr/local/webmin nor the /etc/webmin. all those files are get left in the src dir and never put into the pkg.

Here is the command i am running
Code:
src2pkg -i='./setup.sh /usr/local/webmin' -C -W webmin-1.380.tar.gz
maybe there is a better way to do this or someone has already got it to work?
 
Old 11-16-2007, 11:02 PM   #2
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
I know the webmin build script at SlackBuilds.org creates a working package.
Note that this should not at all be construed as a stab at src2pkg - it just so happens that I personally tested the webmin build script and tried it out with a few things (including pptp-client) :-)
 
Old 11-17-2007, 12:27 PM   #3
agentc0re
Member
 
Registered: Apr 2007
Location: SLC, UTAH
Distribution: Slackware
Posts: 200

Original Poster
Rep: Reputation: 34
Quote:
Originally Posted by rworkman View Post
I know the webmin build script at SlackBuilds.org creates a working package.
You know, i always forget about that site. Thanks!
 
Old 11-17-2007, 01:42 PM   #4
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
I hope gnashley will reply to this, also. I have been using src2pkg more and more, and am interested in how it can handle unusual cases like this.

Brian
 
Old 11-17-2007, 01:47 PM   #5
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Ahh webmin. This a very good example of how much work it can be to get a good package which works correctly on Slackware.
I actually was able to get src2pkg to make a package of everything that gets installed with the setup.sh script. But that doesn't really give you a smoothly working setup. Kudos to Robby, who went to the trouble to work out the fine details and write the rc.webmin script as well as smooth out the setup.sh-based part of package creation.

While src2pkg could create the basic package natively, it takes it a very long time. webmin installs an incredible number of files .over 14,000 of them. And src2pkg double and triple-checks them all during package creation. In cases like this it is much better to insert manual code to streamline things. I downloaded Robby's SlackBuild and just cut and pasted the whole middle part into the middle of a src2pkg script and commented out about half the normal steps. This created the same package as the SlackBuild script would in a lot less time than the normal src2pkg way.

However, I went on to pay back the plagiarism favor, by making a couple of changes to the installation's default configuration which may make webmin a little easier and more flexible to use. In much the same way that Robby disabled some of the setup.sh options and then incorporated them into the SlackBuild, I hacked the setup.sh script down to create a configuration helper which installs to /usr/sbin. After installing the package you run webmin-setup to create the username, password and choose which port to run the service on. You can also re-run the webmin-setup tool at any time if you want to change the configuration.

You can get the src2pkg script and other materials from: http://distro.ibiblio.org/pub/linux/...s/webmin-1.350

Or, even easier -make sure you are connected to the internet, then cd into the directory where you have the source tarball and run:
src2pkg http://distro.ibiblio.org/pub/linux/...webmin.src2pkg

That will download the src2pkg script and execute it, which will download all the needed extra files. (If you didn't already have the source tarball it would download that too). After installation just run /usr/sbin/webmin-setup to setup the confiuration and start the server.
 
Old 11-17-2007, 02:08 PM   #6
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Well, I appreciate the kudos, but...
I didn't write the script - David Somero deserves that credit.
All I did was test it, make a few relatively minor changes and tweaks, and approve it for inclusion in our repository, so you might want to note David's name in there instead of mine.
Otherwise, thanks I'm going to refer him to your modifications too
 
Old 11-17-2007, 02:33 PM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You may find the webmin-setup useful for inclusion -possibly as a setup-type script. I just put it in /usr/sbin so it's in the normal path. I'll change/add the credits to David.
 
Old 11-20-2007, 09:39 AM   #8
agentc0re
Member
 
Registered: Apr 2007
Location: SLC, UTAH
Distribution: Slackware
Posts: 200

Original Poster
Rep: Reputation: 34
Wow, I can't believe you went as far as writing something like that up. Kindness like that can only be summarized as PURE AWESOME!
I've looked at all the scripts to see what i can learn from it. One thing i saw was the cmd install. Never knew that existed. The other package i was trying to make was Cacti, so I am going to take a swing at creating a script with what you've supplied for Webmin. Cacti doesn't require any ./configure or make process. just need to copy the files to the directory you wish to have them in IE your htdocs dir. Would you recommend using install or just use the mv cmd?

Another question i had about the Webmin script is why you decided to put it in the /usr/libexec/ dir? When I first looked into this i had looked at the slackbook for a description of the dir's to properly place the program. I figured /usr/share or /usr/local. i know that in the end it doesn't really matter, but what was your reasoning behind it and what is potentially wrong with what I though?

Also, if i wanted to use the latest and greatest webmin package would i just need to change the the following in the src2pkg script
Code:
SOURCE_URL='http://prdownloads.sourceforge.net/webadmin/webmin-1.380.tar.gz'
##OR##
SOURCE_URL='/tmp/webminbuild/webmin-1.380.tar.gz'
EXTRA_SOURCES='
/tmp/webminbuild/doinst.sh
/tmp/webminbuild/rc.webmin
/tmp/webminbuild/webmin-setup
/tmp/webminbuild/slack-desc
/tmp/webminbuild/README.webmin-setup
'
SOURCE_NAME='webmin-1.380.tar.gz'
NAME='webmin'
VERSION='1.380'
ARCH='i486'
BUILD='1'
PRE_FIX='usr'
 
Old 11-20-2007, 11:08 AM   #9
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Uh, you should realize that SOURCE_URL is kind of an addon. For use with sources which are already on your system you only need to supply SOURCE_NAME. src2pkg will look for the tarball in your SOURCES_DIR, which is CWD (the current directory) by deafult. You can change this to something else by editing your /etc/src2pkg/src2pkg.conf file. An example would be, say you want all your sources to be in one directory -like /usr/src/src2pkg/SOURCES. You could then put all tarballs in there and edit your src2pkg.conf file by placing this line in there:
SOURCES_DIR=/usr/src/src2pkg/SOURCES
Or using this:
! [[ $SOURCES_DIR ]] && SOURCES_DIR=/usr/src/src2pkg/SOURCES
will still let you override it on a case by case basis or from the command-line.

About SOURCE_URL, if the script includes that line, src2pkg will look for the named tarball in whatever directory you have set as the SOURCES_DIR *or* the CWD.
If you have the URL to a new version, but don't have the tarball available locally, yeah just edit the SOURCE_URL line. You'll want to re-edit the VERSION line also and the SOURCE_NAME. As I mentioned SOURCE_URL is kind of extra. In fact even the VERSION is not needed. If you supply only a SOURCE_NAME, src2pkg figures out all the rest -this is what happens when you run it from the command line
src2pkg name-of-tarball
When src2pkg creates a script for you, it writes out the NAME and VERSION for you, but they are not really needed. You can comment them out and it will still work. If the SOURCE_URL is the only thing given it still figures it out. The only problem is when src2pkg is unable to correctly guess the name and version (or you want to use something different than what it derives) -then you need to override its' guessing by passing ALT_NAME and ALT_VERSION. These will take precedence over the guessed values. The SOURCE_URL or SOURCE_NAME correspond to the actual name of the tarball. NAME and VERSION are what src2pkg guesses, and ALT_NAME and ALT_VERSION are your arbitrary overrides of the guesses. You can also easily manipulate the naming by creating a link to the tarball with the name and vesrion that you want or need.
You can do it like you have written there, but I really recommend that you always work in a separate directory for each package so that your generically-named files don't get clobbered. At least make it
/tmp/webmin
This keeps things much more orderly.

I used /usr/libexec/webmin because that was what was used in the unofficial SlackBuild -and because that really is the right place -for the same reason that src2pkg is also correctly installed under /usr/libexec. /usr/libexec is used for executable code which is architecture-independent. Since webmin is script based that's the best place for the files. If it used binaries for eveything then thy should go in the path. In the same way, src2pkg place its' FUNCTIONS and DEFINES files in libexec beacuse they contain code which is executed. generally libexec contains programs/code which is not called directly by the user but is called by other programs. You can also install such programs under /usr/lib/somedir or in someplace like /usr/somedir or /usr/local/somedir. Many programs do this, but probably less than before as these locations are rightly used for programs which contain real 'binary' programs which are architecture-dependent. To really be correct, they shouldn't install to /usr/somedir or /usr/lib/somedir, but instead to /opt/somedir. 'Anything goes' under /opt and programs aren't really supposed to create new directories under /usr. Anyway, you get the idea that filesystem hierarchy is complex and far from cut-and-dried.

As I mentioned, most of the guts for the webmin.src2pkg script were just copied from the SlackBuild -I usually just use copy and set the perms separately. Using the install command lets you set permissions at the same time and can be used for files or directories. PatV mostly uses 'cat' instead of install or cp. mv is basically the same as cp and then rm the original, but actually it is sometimes better than any of the above -especially for links. Your choice...

I've just downloaded cacti and had a look at it since I had never heard of it. The sources don't seem to conatin any real information about how/where to install it. I see that it is all php, so the best bet is to install it wherever you normally install php files. As with cgi files, this might be under /usr/www, maybe /var/www or even /www or /srv -depending on your setup. I'm not really versed on using these things so your guess is probably as good as mine. One thing I do see, cacti appears to expect fo find everything under the same directory. This is the case with most programs that install to /opt/?? or /usr/lib/?? (like mozilla,gcc). So to create a package with src2pkg. just comment out the configure, compile and fake_install lines.
then put
mkdir -p $PKG_DIR/wherever/you/think/it/should/go
cp $SRC_DIR/* $PKG_DIR/wherever/you/think/it/should/go

If there are programs in there which should be run like a command-line tool, then you'll need to either create links or wrapper which can be put in the users path.
I prefer to use wrappers as they are more flexible and it may be more obvious what they do. In that case, just create the bin dir in the package:
mkdir -p $PKG_DIR/usr/bin (or whichever bindir)
cp -mywrapper $PKG_DIR/usr/bin

If you create links, they usually should be relative. Say you want to put cacti in /usr/www and create a link to a program in the folder in the path:

mkdir -p $PKG_DIR/usr/bin
cd $PKG_DIR/usr/bin ; ln -sf ../www/someproggie someproggie

Hope this helps you without confusing you...

Last edited by gnashley; 11-20-2007 at 11:19 AM.
 
  


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
Can't create new ACL for Squid in Webmin ashwin_think Linux - Newbie 4 04-18-2008 05:58 AM
Apache / Webmin Not Working Verbal Kint Linux - Networking 8 09-28-2006 08:59 PM
Getting webmin working NNP Linux - Software 2 11-01-2005 01:59 PM
Webmin Not working Fedora Core 3 stlyz3 Linux - Software 12 06-06-2005 01:12 AM
glib 2.6.0 will not create pc files in pkg folder humble20 Linux - Newbie 6 01-04-2005 08:37 AM

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

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