src2pkg for nagios
Hey gnashley, I am running into a problem when trying to make nagios 2.10 into a package using src2pkg.
here's how i'm trying to accomplish it. src2pkg build script Code:
#!/bin/bash Code:
src2pkg -C -X also, do you think that is the correct way to do add the users needed? P.S. Thank you for the webmin help. i did get that one made. it was very much appreciated. **insert brown nose smiley here :D |
Code:
SOURCE_NAME='nagios-2.10.tar.gz' When you need to run multiple make rules put them all together as shown for INTALL_LINE. For EXTRA_CONFIGS you might consider adding the options for --with-htmlurl and perhaps for nagios-user/nagios-group and command-user/command-group depending on who you want to allow to run the program. Usually, if the program is a sort of daemon, you'd make the user 'nobody' in Slackware with group users. Do the chowning after the fix_pkg_perms to 'undo' the regular way, although I think that the normal root:root may be correct in this case. This should be done after fake_install: mv $PKG_DIR/etc/rc.d/nagios $PKG_DIR/etc/rc.d/rc.nagios Usually, these init files need to be hand edited in order to work properly with Slackware, though in this case it looks like it might just work, if you have given enough of the needed extra options to configure and if you have the latest slack init-scripts which include the /etc/rc./init.d/finctions file. For better compatibility with Slack-11 and just for better control, you should consider hand-editing the init file and then copy it into the $PKG_DIR/etc/rc.d directory after fake_install runs, something like: rm -f $PKG_DIR/etc/rc.d/nagios cp $CWD/rc.nagios $PKG_DIR/etc/rc.d/ chown root:root $PKG_DIR/etc/rc.d/rc.nagios chmod 644 $PKG_DIR/etc/rc.d/rc.nagios #Create User and Group Nagios groupadd nagios useradd nagios -g nagios The commands to create a new user and group should, most properly go in a doinst.sh file which gets run when the package is installed. Use grep to make sure that the user and group don't already exist, so that you don't get multiple entries if you install the package several times. if [ $(grep nagios /etc/group) != "" ] ; then groupadd nagios fi if [ $(grep nagios /etc/passwd) != "" ] ; then useradd nagios -g nagios fi Build the package first without any doinst.sh file to see whether src2pkg produces one. If the 'make install' rules create any links then src2pkg will create a doinst.sh for you with the code for creating the links when the package is installed. You can then add the above code for group/useradd to that doinst.sh. You may also want to add code which echos a couple of lines into /etc/rc.d/rc.local which check to see if /etc/rc.d/rc.nagios is executable and which start the service if it is. Use the example from webmin for code sample. A little trick: if the package indeed creates links, you can preserve the ability to have src2pkg add them automatically by placing any other code you want added to the doinst.sh in a file named doinst.prepend or doinst.append, depending on whether you want the code before or after the link-creation lines. This is most handy for packages whose link-creation lines change when you build a new version -usually for libs, so that may not be the case here. Once you place a file named doinst.sh in the $CWD it will be added to the package *without changes*. I won't 'steal your thunder' by doing the whole thing for you this time-you seem to want to learn more and besides, I'm in the middle of adding serious new code to src2pkg so my running version is only semi-functional at the moment. the webmin package should give you some good examples. One other thing, nagios appears to support using DESTDIR, so if you have any problems getting it to install correctly as shown above, you could always comment out the fake_install line and put this in its' place: mkdir -p $PKG_DIR/$PRE_FIX cd $SRC_DIR && make DESTDIR=$PKG_DIR install install-config install-init Cheers! |
Quote:
so i got the package built fine. even made my own (first one too) doinst.sh. I don't have a ftp server or anything to upload this stuff too so i'll just post it again. I know there are a TON of "free" places i could chose from, any you or anyone else for that matter, recommends? My doinst.sh Code:
root@yoda:/tmp/nagios# cat doinst.sh Code:
#!/bin/bash |
FWIW, the INSTALL_LINE is superfluous if you comment out the fake_install function. What I meant was that if the fake_install function would correctly install using the INSTALL_LINE as given, then you could do it the alternate way by using the manual ceration of $PKG_DIR/$PRE_FIX and using DESTDIR in the 'make install' rule. Sometimes this works when fake_install won't, but fake_install works more reliably than DESTDIR -statistically. Some packages seem to need DESTDIR like this: 'make DESTDIR=?? install' and others can take it like:
'make install DESTDIR=??' DESTDIR should *not* be used in INSTALL_LINE for fake_install. The fake_install routine attempts to do a real installation in the real location and uses installwatch to track the files created. Anything which gets overwritten on your system gets backed up first, then the new files are installed, then copied into the PKG_DIR, then the backed up files are copied back to the real file system. Pretty complicated the way it happens, but works remarkably well -as mentioned more often than DESTDIR. The worst thing about DESTDIR is when sources only support it *partially*. This means that some files get copied into the DESTDIR while others get installed to your real system -and there is virtually no way to know that this has happened. The 'serious coding' that I mentioned I am working on invloves getting installwatch to do an even better job by simulating a root directory -sort of like installing in a chroot directory, which should make it more dependable and less intrusive at the same time. Congrats on your progress in learning to use src2pkg -you've started by attempting some fairly difficult packages. But just look at how simple the scripts are compared to a very basic SlackBuild! As far as where to upload your packages, you could always try putting them on linuxpackages.net, although you'll have to include a 'slack-requires' file in order to get them approved, I think. I only host packages that I have compiled on my site, but perhaps I'll compile and package it using and (crediting) your work on getting it working smoothly with config and doinst.sh tweaks -that's the most important and hardest part, anyway, -src2pkg make the routine parts of packaging easy so you shouldn't mind running the build and installation a few times to make sure everything is right. Bet you are itching to build something else... |
All times are GMT -5. The time now is 02:49 AM. |