LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   src2pkg zoneminder 1.25.0 zm.conf missing after installation. (http://www.linuxquestions.org/questions/slackware-14/src2pkg-zoneminder-1-25-0-zm-conf-missing-after-installation-908775/)

matters 10-18-2011 11:20 AM

src2pkg zoneminder 1.25.0 zm.conf missing after installation.
 
Hey guys!

I wanted to create a package of zoneminder 1.25.0 using the folloving directives:
Code:

src2pkg -C -VV -e='--with-webdir=/var/www/htdocs
--with-cgidir=/srv/httpd/cgi-bin --sysconfdir=/etc/zm
--with-ffmpeg=/usr/bin CPPFLAGS=-D__STDC_CONSTANT_MACROS' -i='make
install' -TXZ ZoneMinder-1.25.0.tar.gz

evertything is good except that zm.conf file that should be in /etc/zm after installation is missing.

previously i had installed 1.24.2 from slackbuilds and after uninstalling it /etc/zm directory wasnt removed so i removed it manually, and now when i want to install newer version with directives i showed above the whole directory /etc/zm/ and zm.conf is not created nor the file is there.

Im wondering what im i missing why is that happening?

Thanks alot!

Bindestreck 10-18-2011 12:13 PM

Quote:

Originally Posted by matters (Post 4501538)
Hey guys!

I wanted to create a package of zoneminder 1.25.0 using the folloving directives:
Code:

src2pkg -C -VV -e='--with-webdir=/var/www/htdocs
--with-cgidir=/srv/httpd/cgi-bin --sysconfdir=/etc/zm
--with-ffmpeg=/usr/bin CPPFLAGS=-D__STDC_CONSTANT_MACROS' -i='make
install' -TXZ ZoneMinder-1.25.0.tar.gz

evertything is good except that zm.conf file that should be in /etc/zm after installation is missing.

previously i had installed 1.24.2 from slackbuilds and after uninstalling it /etc/zm directory wasnt removed so i removed it manually, and now when i want to install newer version with directives i showed above the whole directory /etc/zm/ and zm.conf is not created nor the file is there.

Im wondering what im i missing why is that happening?

Thanks alot!

I had some problems before with "missing" files, but that was because of the default INSTALL_TYPE JAIL. Nowadays I use -DEST instead of -JAIL and have not encountered any problems anymore.

However, Im not sure if this is the problem for you.

gnashley 10-18-2011 12:16 PM

First, check the contents of the package tree -probably /tmp/zoneminder-1.25.0-ARCH-1
to see if the dir etc/zm is even being created and if there is a conf file there. If so, then it means you haven't installed the resulting package. If there is no conf file, then you are missing an install option for the conf file (like install_data). Or you may need a ine of manual code in a src2pkg script to install it. Actually, that is the best solution because you should change the name of the conf file so it gets handled intelligently by installpkg.

Rerun the original command adding the '-N' option to generate a script:
Code:

src2pkg -C -VV -e='--with-webdir=/var/www/htdocs
--with-cgidir=/srv/httpd/cgi-bin --sysconfdir=/etc/zm
--with-ffmpeg=/usr/bin CPPFLAGS=-D__STDC_CONSTANT_MACROS' -TXZ -N ZoneMinder-1.25.0.tar.gz

Change the name of the resulting zoneminder.src2pkg.auto to simply zoneminder.src2pkg
Then, edit it (after fake_install) to add something like this :
mkdir -p $PKG_DIR/etc/zm
cp $SRC_DIR/zm.conf $PKG_DIR/etc/zm/zm.conf.new
so it looks like this:
Code:

compile_source  # If used, the 'build' function replaces these 3
fake_install    #

mkdir -p $PKG_DIR/etc/zm
cp $SRC_DIR/zm.conf $PKG_DIR/etc/zm/zm.conf.new

fix_pkg_perms
strip_bins


Run the modified script with original capital-case arguments, plus the '-A' option:
src2pkg -C -VV -TXZ -A

dive 10-18-2011 12:47 PM

May I just ask why you didn't use the slackbuild?

http://slackbuilds.org/repository/13...em/ZoneMinder/

matters 10-21-2011 08:41 AM

@gnashley thanks bro its fixed!
@dive i did, i wanted to check newest version :)

thanks all for the contribution!

matters 10-21-2011 11:19 AM

@gnashley one problem occured again! after installation and wanted to start the script to start the service i got msg:

Code:

Starting ZoneMinder: /etc/rc.d/rc.zm: line 49: /usr/bin/zmpkg.pl: No such file or directory
in $SRC theres subdirectory scripts with *.pl.in among with zmpkg.pl.im, im wondering what *.in means? is it safely to rename it to *.pl or i missed some directives in ./configure again?

gnashley 10-21-2011 02:38 PM

Hmmm, this build is pretty complex. Have you tried doing as dive suggests by using the SlackBuild -it includes several patches, extra sources and a couple of config files which should give you a working package. It's not that this can't be done with src2pkg, but you'd need to know a bit about how it works, maybe, to get it done. I've downloaded the sources, patches, etc. and will try to get a workign script for you -but I'm having some pretty serious health problems at the moment and so I can't promise anything right now.

matters 10-21-2011 04:47 PM

@gnashley yes, ive tried slackbuilds before, and i got it created, and installed, everything worked, then i upgraded to kernel 2.6.38.7 then i uninstalled, and after trying to create 1.24.2 package from slacbuilds again i got error saying that zm needs video4linux to be installed, although i have kernel headers and everything kernel related installed, so ive tried newer version 1.25.0 with src2pkg, and this is what i succeed so far!

ive checked installation guide from zoneminder slackware 12.2 followed that steps to install created pkg. ive borrowed some code from slackbuilds so far and this is what mine src2pkg script look so far although i didnt add patches(and after installation i tried to execute rc.zm and the error occured which i posted in my previous post):

Code:

#!/bin/bash
## src2pkg script for:  zoneminder
## Auto-generated by src2pkg-2.2
## src2pkg - Copyright 2005-2009 Gilbert Ashley <amigo@ibilio.org>

SOURCE_NAME='ZoneMinder-1.25.0.tar.gz'
ALT_NAME='zoneminder'
VERSION='1.25.0'  # Use ALT_VERSION to override guessed value
# ARCH=''
# BUILD='1'
# PRE_FIX='usr'
# Any extra options go here:
EXTRA_CONFIGS="--libdir=/usr/lib${LIBDIRSUFFIX} --sysconfdir=/etc/zm --localstatedir=/var --mandir=/usr/man --build=$ARCH-slackware-linux --with-libarch=lib${LIBDIRSUFFIX}--with-mysql=/usr --with-ffmpeg=/usr  --with-webdir=$DOCROOT --with-cgidir=$CGIROOT --with-webuser=$DOCOWN --with-webgroup=$DOCGRP --disable-crashtrace --disable-debug --enable-mmap=yes CXXFLAGS=-D__STDC_CONSTANT_MACROS "

AUTORECONF=YES

# Optional function replaces configure_source, compile_source, fake_install
# To use, uncomment and write/paste CODE between the {} brackets.
# build() { CODE }

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# Execute the named packaging steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
configure_source #
compile_source  # If used, the 'build' function replaces these 3
fake_install    #
# Strip binaries
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
          | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Compress manpages
find $PKG/usr/man -type f -exec gzip -9 {} \;

# Remove junk files and dirs
find $PKG -name perllocal.pod \
          -o -name ".packlist" \
            -o -name "*.bs" \
              | xargs rm -f || true

find $PKG/usr -depth -type d -empty -delete || true

mkdir -p $PKG/var/{log,lock/subsys}
install -d -o $DOCOWN -g $DOCGRP $PKG/var/log/zm

for DIR in events images sound; do
          install -d -o $DOCOWN -g $DOCGRP $PKG$DOCROOT/$DIR
  done

  #Create conf file
  mkdir -p $PKG_DIR/etc/zm
  cp $SRC_DIR/zm.conf $PKG_DIR/etc/zm/zm.conf.new

  # Install logrotate script
  mkdir -p $PKG/etc/logrotate.d/
  cat $CWD/zm_logrotate > $PKG/etc/logrotate.d/zm.new

  # Install apache config
  sed "s%@DOCROOT@%$DOCROOT%" $CWD/zm_apache.conf > $PKG/etc/zm/zm_apache.conf.new

  # Install startup script
  install -D -m 755 scripts/zm $PKG/etc/rc.d/rc.zm.new

  # Copy documentation
  mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  cp -a AUTHORS ChangeLog INSTALL NEWS README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
  cat $CWD/README.PERLDEPS > $PKG/usr/doc/$PRGNAM-$VERSION/README.PERLDEPS


fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# DOCLIST='' PATCHLIST='' INSTALL_TYPE=''
# CONFIG_COMMAND='' MAKE_COMMAND='' INSTALL_LINE=''
# When editing src2pkg scripts to add custom code, use these variables
# to refer to the current directory, the sources or the package tree:
# $CWD (current directory), $SRC_DIR (sources), $PKG_DIR (package tree)
# Other commonly-used directories include: $DOC_DIR (document directory)
# $MAN_DIR (man-page directory) $DATA_DIR (shared-data directory)

And yes, no rush bro, take your time, be well and safe, we can continue with this once ull be well, although i still want to do it with src2pkg and understand it, not just run the script and of we go :)

Ill be waiting for bro, be safe, and well, you can reply to me whenever you will have time, no rush, im just wondering should i bump the thread once in a while to remind you or theres no need for that?

I would like to get reply about *.pl.in files in scripts subdirectory in $SRC to understand what *.in means exactly and if its ./configure responsible for those files to generate just *.pl in thia case and if its safe just to rename them to *pl would that suffice. Of course you take some rest, i have infinite patience to wait!

Thanks and I wish you well!

gnashley 10-22-2011 05:37 AM

Usually, *.in files are templates for a finished file. Some routine -yes usually 'configure' will process them and replace some values with the proper ones -like 'webdir' for instance. So, no, you can't simply rename them and have them work. The README.PERLDEPS from the SlackBuild kit contains a rather lengthy list of prerl module dependencies. It's possible that there is something new in there that needs to be installed.

Uhh, I notice you are using a pretty old version of src2pkg. Perhaps upgrading would be a good idea:
http://distro.ibiblio.org/amigolinux...5-noarch-2.tgz

I really will try to work on this for you over the weekend.

matters 10-22-2011 10:48 AM

@gnashley thanks for the clarification. On the webpage http://www.zoneminder.com/wiki/index.php/Slackware_12.2 are steps what i used to install 1.24.2 slackbuild, and it worked perfectly.

btw whats interesting about new src2pkg that you posted is that it created *pl in scripts subdir compared to the one that i used previously which it didnt, and i modified script to copy those *.pl files from $SRC/scripts to /usr/bin

and now i get new error :)

Code:

Starting ZoneMinder: Can't locate ZoneMinder.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.12.3/i486-linux-thread-multi /usr/lib/perl5/site_perl/5.12.3 /usr/lib/perl5/vendor_perl/5.12.3/i486-linux-thread-multi /usr/lib/perl5/vendor_perl/5.12.3 /usr/lib/perl5/5.12.3/i486-linux-thread-multi /usr/lib/perl5/5.12.3 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl) at /usr/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.

hehe its interesting! ill wait for you to respond when you will be free from ill, its not needed to rush :)

thanks bro!

gnashley 10-23-2011 05:34 AM

A couple of other pointers: You are using:
install -d -o $DOCOWN -g $DOCGRP
when those vars have not been set. Put them above EXTRA_CONFIGS

Change all occurences of $PKG/ to $PKG_DIR (even though PKG is supposed to work)
All the stripping and man-page handling should be done automatically for you, so those lines are redundant. The same for normal docs, although the lines using '$DOCOWN -g $DOCGRP' are probably needed as they install extra docs which src2pkg would not automatically include.
Instead of '$PKG$DOCROOT/' you can use $DOC_DIR (temporary install dir + path to docs + package-specific doc path). Usually for installing extra docs, the code should be placed *after* the normal create_docs. The var EXTRA_DOCS can usually be used to add extra or unusual docs or doc dirs, but in this case the special ownerships/groups would not be used.

Code:

#!/bin/bash
## src2pkg script for:  zoneminder
## Auto-generated by src2pkg-2.2
## src2pkg - Copyright 2005-2009 Gilbert Ashley <amigo@ibilio.org>

SOURCE_NAME='ZoneMinder-1.25.0.tar.gz'
ALT_NAME='zoneminder'
VERSION='1.25.0'  # Use ALT_VERSION to override guessed value
# ARCH=''
# BUILD='1'
# PRE_FIX='usr'
# Any extra options go here:
EXTRA_CONFIGS="--libdir=/usr/lib${LIBDIRSUFFIX} --sysconfdir=/etc/zm --localstatedir=/var --mandir=/usr/man --build=$ARCH-slackware-linux --with-libarch=lib${LIBDIRSUFFIX}--with-mysql=/usr --with-ffmpeg=/usr  --with-webdir=$DOCROOT --with-cgidir=$CGIROOT --with-webuser=$DOCOWN --with-webgroup=$DOCGRP --disable-crashtrace --disable-debug --enable-mmap=yes CXXFLAGS=-D__STDC_CONSTANT_MACROS "

AUTORECONF=YES

# lack of this may be whats causing improper install location of the .pm/.pl files
# if this doesn't fix it let me know and I'll show you another way.
INSTALL_LINE="make install DESTDIR=$PKG_DIR INSTALLDIRS=vendor INSTALLVENDORMAN3DIR=/usr/man/man3"

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# Execute the named packaging steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
configure_source #
compile_source  # If used, the 'build' function replaces these 3
fake_install    #

# src2pkg doesn't do this by default -perl stuff is the worst offender. Otherwise,
# removing empty dirs is usually a bad idea.
find $PKG_DIR/usr -depth -type d -empty -delete || true

mkdir -p $PKG_DIR/var/{log,lock/subsys}
install -d -o $DOCOWN -g $DOCGRP $PKG_DIR/var/log/zm

for DIR in events images sound; do
          install -d -o $DOCOWN -g $DOCGRP $DOC_DIR/$DIR
done

  #Create conf file
  mkdir -p $PKG_DIR/etc/zm
  cp $SRC_DIR/zm.conf $PKG_DIR/etc/zm/zm.conf.new

  # Install logrotate script
  mkdir -p $PKG_DIR/etc/logrotate.d/
  cat $CWD/zm_logrotate > $PKG_DIR/etc/logrotate.d/zm.new

  # Install apache config
  # src2pkg uses autoconf-style 'docdir' internally
  sed "s%@DOCROOT@%$docdir%" $CWD/zm_apache.conf > $PKG_DIR/etc/zm/zm_apache.conf.new

  # Install startup script
  install -D -m 755 scripts/zm $PKG_DIR/etc/rc.d/rc.zm.new

  # Copy documentation
  mkdir -p $DOC_DIR
  cp -a AUTHORS ChangeLog INSTALL NEWS README TODO $DOC_DIR
  cat $CWD/$NAME.SlackBuild > $DOC_DIR/$NAME.SlackBuild
  cat $CWD/README.SLACKWARE > $DOC_DIR/README.SLACKWARE
  cat $CWD/README.PERLDEPS > $DOC_DIR/README.PERLDEPS


fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

I haven't tested the above script, but it should help you streamline yours. The build is a bit complex. (Other notes: PRGNAME should also be usable instead of NAME, but I've changed the references anyway. You might also try using the 'sb2sp' utility to convert the SlackBuild to a src2pkg script, but move/rename the src2pkg scripts you have manually created first before trying it.)

matters 10-27-2011 07:49 AM

@gnashley sorry for longer delay.

heres what i get when i want to start /etc/rc.d/rc.zm

Code:

Starting ZoneMinder: Can't locate ZoneMinder.pm in @INC (@INC contains: /usr/share/perl5 /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5) at /usr/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.
                                                          [FAILED]

seems like i missed some files i have to copy, they are located at $SRC/scripts/ZoneMinder/lib/ZoneMinder.

Tommorrow ill modify the script and post you the results.
In the meantime can you tell me is there a way for me to modify the script like to copy all files from specific location, i mean so i dont have to specify every individual file, in specific folder(like cp -a)?


i modified the script like you suggested and it everything looks good so far.

Heres what it looks like now:

Code:

#!/bin/bash
## src2pkg script for:  zoneminder
## Auto-generated by src2pkg-2.2
## src2pkg - Copyright 2005-2009 Gilbert Ashley <amigo@ibilio.org>

SOURCE_NAME='ZoneMinder-1.25.0.tar.gz'
ALT_NAME='zoneminder'
VERSION='1.25.0'  # Use ALT_VERSION to override guessed value
DOCOWN=${DOCOWN:-apache}
DOCGRP=${DOCGRP:-apache}
DOCROOT=${DOCROOT:-"/srv/httpd/htdocs/zm"}
CGIROOT=${CGIROOT:-"/srv/httpd/cgi-bin"}

# ARCH=''
# BUILD='1'
# PRE_FIX='usr'
# Any extra options go here:
EXTRA_CONFIGS="--libdir=/usr/lib${LIBDIRSUFFIX} --sysconfdir=/etc/zm --localstatedir=/var --mandir=/usr/man --build=$ARCH-slackware-linux --with-libarch=lib${LIBDIRSUFFIX}--with-mysql=/usr --with-ffmpeg=/usr  --with-webdir=$DOCROOT --with-cgidir=$CGIROOT --with-webuser=$DOCOWN --with-webgroup=$DOCGRP --disable-crashtrace --disable-debug --enable-mmap=yes CXXFLAGS=-D__STDC_CONSTANT_MACROS "

AUTORECONF=YES

# Optional function replaces configure_source, compile_source, fake_install
# To use, uncomment and write/paste CODE between the {} brackets.
# build() { CODE }

# Get the functions and configs
. /usr/libexec/src2pkg/FUNCTIONS ;

# Execute the named packaging steps:
pre_process
find_source
make_dirs
unpack_source
fix_source_perms
configure_source #
compile_source  # If used, the 'build' function replaces these 3
fake_install    #

#src2pkg doesn't do this by default -perl stuff is the worst offender. Otherwise,
# removing empty dirs is usually a bad idea.
find $PKG_DIR/usr -depth -type d -empty -delete || true

mkdir -p $PKG_DIR/var/{log,lock/subsys}
install -d -o $DOCOWN -g $DOCGRP $PKG_DIR/var/log/zm

for DIR in events images sound; do
          install -d -o $DOCOWN -g $DOCGRP $DOC_DIR/$DIR
  done

  #Create conf file
  mkdir -p $PKG_DIR/etc/zm
  cp $SRC_DIR/zm.conf $PKG_DIR/etc/zm/zm.conf.new

  #COPY PERL SCRIPTS TO usr/bin
  cp $SRC_DIR/scripts/zmaudit.pl $PKG_DIR/usr/bin/zmaudit.pl
  cp $SRC_DIR/scripts/zmcontrol.pl $PKG_DIR/usr/bin/zmcontrol.pl
  cp $SRC_DIR/scripts/zmdc.pl $PKG_DIR/usr/bin/zmdc.pl
  cp $SRC_DIR/scripts/zmfilter.pl $PKG_DIR/usr/bin/zmfilter.pl
  cp $SRC_DIR/scripts/zmpkg.pl $PKG_DIR/usr/bin/zmpkg.pl
  cp $SRC_DIR/scripts/zmtrack.pl $PKG_DIR/usr/bin/zmtrack.pl
  cp $SRC_DIR/scripts/zmtrigger.pl $PKG_DIR/usr/bin/zmtrigger.pl
  cp $SRC_DIR/scripts/zmupdate.pl $PKG_DIR/usr/bin/zmupdate.pl
  cp $SRC_DIR/scripts/zmvideo.pl $PKG_DIR/usr/bin/zmvideo.pl
  cp $SRC_DIR/scripts/zmwatch.pl $PKG_DIR/usr/bin/zmwatch.pl
  cp $SRC_DIR/scripts/zmx10.pl $PKG_DIR/usr/bin/zmx10.pl

  # Install logrotate script
  mkdir -p $PKG_DIR/etc/logrotate.d/
  cat $CWD/zm_logrotate > $PKG_DIR/etc/logrotate.d/zm.new

  # Install apache config
  sed "s%@DOCROOT@%$DOCROOT%" $CWD/zm_apache.conf > $PKG_DIR/etc/zm/zm_apache.conf.new

  # Install startup script
  install -D -m 755 scripts/zm $PKG_DIR/etc/rc.d/rc.zm.new

  # Copy documentation
  mkdir -p $DOC_DIR
  cp -a AUTHORS ChangeLog INSTALL NEWS README TODO $DOC_DIR
  cat $CWD/$NAME.SlackBuild > $DOC_DIR/$NAME.SlackBuild
  cat $CWD/README.SLACKWARE > $DOC_DIR/README.SLACKWARE
  cat $CWD/README.PERLDEPS > $DOC_DIR/README.PERLDEPS


fix_pkg_perms
strip_bins
create_docs
compress_man_pages
make_description
make_doinst
make_package
post_process

## See the documentation for more help and examples. Below are some of
# the most common Extras and Options for easy cut-and-paste use.
# DOCLIST='' PATCHLIST='' INSTALL_TYPE=''
# CONFIG_COMMAND='' MAKE_COMMAND='' INSTALL_LINE=''
# When editing src2pkg scripts to add custom code, use these variables
# to refer to the current directory, the sources or the package tree:
# $CWD (current directory), $SRC_DIR (sources), $PKG_DIR (package tree)
# Other commonly-used directories include: $DOC_DIR (document directory)
# $MAN_DIR (man-page directory) $DATA_DIR (shared-data directory)


gnashley 10-27-2011 12:14 PM

Try this:
Code:

# fake_install    #
cd $SRC_DIR
make install DESTDIR=$PKG_DIR INSTALLDIRS=vendor INSTALLVENDORMAN3DIR=/usr/man/man3


matters 10-28-2011 11:33 AM

@gnashley that fixes the problem, with that single directive everything is in place and daemon starts no need to copy any files from $SRC, that line was also in the slackbuilds but i didnt include it because i relied myself on src2pkg itself, can you please explain the directive what means INSTALLDIRS=vendor ?

Also in what cases i should use similar instructions with make install like this and not to rely just with basics based on src2pkg? i suspect only when complicated builds are in the game?

Thanks bro!

gnashley 10-30-2011 05:30 AM

INSTALLDIRS=vendor is perl-specific variable. It seems to be a bit touchy to use -I've had little luck with it as an option to src2pkg, like: -m="make install DESTDIR=$PKG_DIR INSTALLDIRS=vendor" and I'm not yet sure why that doesn't work. Some of my tries have led to installation of perl subdirs in DESTDIR root-level. It may be that it can only be done as 'root', using the src2pkg -REAL or -SAFE install type.

I'm still really sick, but when I get a little better I'll have a look into getting that to work.


All times are GMT -5. The time now is 03:35 PM.