Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Contributions to ELOG, Page 3 of 6  Not logged in ELOG logo
New entries since:Thu Jan 1 01:00:00 1970
ID Date Author Author Email Categoryup Subject Status Last Revision
  150   Fri Feb 21 19:05:18 2020 Laurent Jean-Rigaudlollspam@free.frOtherRPM build process enhancementsStableFri Feb 21 19:14:53 2020 by Laurent Jean-Rigaud

Hi Stefan,

I enclosed a patch for RPM build process available on GIT.

changes :

  • rpmbuild :
    • checks if provider or custom build (the rm/mv are done on your computers only :-))
    • call rpmbuild with version / release given as parameters
  • elog.spec :
    • last changelog entry date is set to build date
    • build with debug for debuginfo rpms (product rpms are normally automatically strimmed)
    • elog.init call /etc/ini.d/functions for RHEL/Centos/Fedora/? dists

 

Todo:

  • add RPMbuild options for ldap/pam/...
  • enclosed git log in changelog automatically (the dream :-))
Attachment 1: elog_patch_for_4936b76915d63a9ebb3788d50d62faadf49cdb6b.patch
diff --git a/buildrpm b/buildrpm
index 9d21f4a..dba7067 100755
--- a/buildrpm
+++ b/buildrpm
@@ -12,7 +12,7 @@ set release = $argv[2]
 set dir = /tmp/elog-$version
 set archive = elog-$version-$release.tar.gz
 
-perl -wapi.bak -e 's&^(Version:\s+).*$&${1}'"${version}"'&;s&^(Release:\s+).*$&${1}'"${release}"'&;' elog.spec
+#perl -wapi.bak -e 's&^(Version:\s+).*$&${1}'"${version}"'&;s&^(Release:\s+).*$&${1}'"${release}"'&;' elog.spec
 
 # create temporary directory
 rm -Rf $dir
@@ -68,19 +68,33 @@ rm -Rf $dir
 
 # transfer archive
 echo Transfer archive...
-cp /tmp/$archive ~ritt/html/elog/download/tar/
-cp /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
 cp /tmp/$archive ~/rpmbuild/SOURCES/elog-$version.tar.gz
-cd ~ritt/elog
-cp -f doc/ChangeLog ~ritt/html/elog/download/ChangeLog
+# If Stefan...
+if ( -d /home/ritt ) then
+  echo "Manager mode"
+  if ( -d ~ritt/html/elog/download/tar ) then
+    cp /tmp/$archive ~ritt/html/elog/download/tar/
+    cp /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
+    cd ~ritt/elog
+    cp -f doc/ChangeLog ~ritt/html/elog/download/ChangeLog
+  endif
+endif
+cd -
 rm -f /tmp/$archive
 
+echo Cleanup $version-$release rpms
+rm -f ~/rpmbuild/RPMS/*/elog*${version}-${release}*.rpm
+rm -f ~/rpmbuild/SRPMS/elog*${version}-${release}*.rpm
 # building RPMs
-echo Build RPMs...
-rm -f ~/rpmbuild/RPMS/x86_64/*
-rm -f ~/rpmbuild/SRPMS/*
-rpmbuild -ba elog.spec || exit $?
-cp ~/rpmbuild/RPMS/x86_64/elog*rpm ~ritt/html/elog/download/RPMS/
-cp ~/rpmbuild/RPMS/x86_64/elog-$version-$release.x86_64.rpm ~ritt/html/elog/download/RPMS/elog-latest.x86_64.rpm
-cp ~/rpmbuild/SRPMS/elog*rpm ~ritt/html/elog/download/SRPMS/
-cp ~/rpmbuild/SRPMS/elog-$version-$release.src.rpm ~ritt/html/elog/download/SRPMS/elog-latest.src.rpm
+echo Build RPMs..
+rpmbuild -ba --define "version ${version}" --define "release ${release}" elog.spec || exit $?
+
+# If Stefan...
+if ( -d /home/ritt ) then
+  if ( -d ~ritt/html/elog/download/tar ) then
+    cp ~/rpmbuild/RPMS/x86_64/elog*rpm ~ritt/html/elog/download/RPMS/
+    cp ~/rpmbuild/RPMS/x86_64/elog-$version-$release.x86_64.rpm ~ritt/html/elog/download/RPMS/elog-latest.x86_64.rpm
+    cp ~/rpmbuild/SRPMS/elog*rpm ~ritt/html/elog/download/SRPMS/
+    cp ~/rpmbuild/SRPMS/elog-$version-$release.src.rpm ~ritt/html/elog/download/SRPMS/elog-latest.src.rpm
+  endif
+endif
diff --git a/elog.spec b/elog.spec
index 16add8f..8397eab 100755
--- a/elog.spec
+++ b/elog.spec
@@ -1,9 +1,13 @@
-# OpenSSH privilege separation requires a user & group ID
+# ELOG weblog application
+# rpmbuild -ba --define 'version 3.1.4' --define 'release 2' --define "date $(LC_TIME=En date '+%a %b %d %Y')" elog.spec
+ 
+#define	date	$(LC_TIME=En date '+%a %b %d %Y')      
+%define build_timestamp %(LC_TIME=En date '+%a %b %d %Y')
 
 Name:       elog
 Summary:    elog is a standalone electronic web logbook
-Version:    3.1.4
-Release:    2
+Version:    %version
+Release:    %release%{?dist}
 License:    GPL
 Group:      Applications/Networking
 Source:     http://elog.psi.ch/elog/download/elog-%{version}.tar.gz
@@ -41,6 +45,8 @@ access control, etc. Moreover, a single server can host several weblogs, and
 each weblog can be totally different from the rest. 
 
 %changelog
+* %{build_timestamp} Stefan Ritt <stefan.ritt@psi.ch> %version-%release
+- Updated from git 
 * Wed Sep 26 2018 Stefan Ritt <stefan.ritt@psi.ch>
 - Made adjustments for new elog server and RH7
 * Fri Aug 29 2014 Stefan Ritt <stefan.ritt@psi.ch>
@@ -72,7 +78,7 @@ each weblog can be totally different from the rest.
    -g elog -M -r elog 2>/dev/null || :
 
 %build
-make
+make CFLAGS='-O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml -g'
 sed "s#\@PREFIX\@#%{prefix}#g" elogd.init_template > elogd.init
 
 %install
diff --git a/elogd.init b/elogd.init
index 5d4e7ee..e04143c 100644
--- a/elogd.init
+++ b/elogd.init
@@ -6,6 +6,9 @@
 # config: /usr/local/elog/elogd.cfg
 # pidfile: /var/run/elogd.pid
 
+# RHEL
+[ -f /etc/init.d/functions ] && . /etc/init.d/functions
+
 # Check for the config file
 if [ ! -f /usr/local/elog/elogd.cfg ]; then
     exit 0
diff --git a/elogd.init_template b/elogd.init_template
index e94b5d7..bb1b330 100755
--- a/elogd.init_template
+++ b/elogd.init_template
@@ -6,6 +6,9 @@
 # config: @PREFIX@/elog/elogd.cfg
 # pidfile: /var/run/elogd.pid
 
+# RHEL
+[ -f /etc/init.d/functions ] && . /etc/init.d/functions
+
 # Check for the config file
 if [ ! -f @PREFIX@/elog/elogd.cfg ]; then
     exit 0
  151   Mon Mar 2 14:31:12 2020 Laurent Jean-Rigaudlollspam@free.frOtherRe: RPM build process enhancementsStableWed Mar 4 18:40:40 2020 by Laurent Jean-Rigaud

Hi Stefan,

2nd patch for RPM build which adds :

  • dynamic build options for krb5/ldap/pam/ssl support :
    • for git / non rpm users : 
      • buildrpm version release [-krb5] [-ldap] [-pam] [-ssl]
    • for rpm users using SRPMS (dependances are managed) :
      • rpm -i elog-ver-rel.src.rpm && rpmbuld -bb [--use krb5] [--use ldap] [--use pam] [--use ssl] ~/rpmbuild/SPECS/elog.spec
  • dynamic 2 last changelog entries :
    • last with build information with
      • dynamic user 's info (use your info if builded from PSI, or use %packager from ~/.rpmmacros if exists, or set to username username@ostname)
      • build options list (KBR5, LDAP, PAM, SSL)
    • before last for product changelog of current ELOG version-release
  • customrel flag for local rebuild :
    • release = %elogrel%{?customrel}%{?dist)
    • so custom builder can add --define 'customrel NSA'  at rpmbuild command or in .rpmmacros file -> elog-3.1.4-2.NSA.el7.x86_64.rpm by example.
  • elog version and release are delivered in specfile as default for rebuild (tarball name uses it so it can not be changed for local rebuild from SRPMS).
  • buildrpm uses ~/rpmbuild/SPECS/elog.spec generated from elog.spec.template (elog.spec is deleted in repo, replaced by elog.spec.template).

 

Tested on EL6 and EL7 x86_64 :-)

Bye

 

Laurent Jean-Rigaud wrote:

Hi Stefan,

I enclosed a patch for RPM build process available on GIT.

changes :

  • rpmbuild :
    • checks if provider or custom build (the rm/mv are done on your computers only :-))
    • call rpmbuild with version / release given as parameters
  • elog.spec :
    • last changelog entry date is set to build date
    • build with debug for debuginfo rpms (product rpms are normally automatically strimmed)
    • elog.init call /etc/ini.d/functions for RHEL/Centos/Fedora/? dists

 

Todo:

  • add RPMbuild options for ldap/pam/...
  • enclosed git log in changelog automatically (the dream :-))

 

Attachment 1: elog-git_dd35f04ec8effce1c12927078a9efb59822ceb3f-add_use_options.diff
diff --git a/Makefile b/Makefile
index d8eecba..87cb502 100644
--- a/Makefile
+++ b/Makefile
@@ -23,16 +23,32 @@ RCDIR      = $(ROOT)/etc/rc.d/init.d
 SRVDIR     = $(ROOT)/usr/lib/systemd/system
 
 # flag for SSL support
+ifdef USESSL
 USE_SSL    = 1
+else
+USE_SSL    = 0
+endif
 
 # flag for Kerberos support, please turn on if you need Kerberos
+ifdef USEKRB5
+USE_KRB5   = 1
+else
 USE_KRB5   = 0
+endif
 
 # flag for LDAP support, please turn on if you need LDAP
+ifdef USELDAP
+USE_LDAP   = 1
+else
 USE_LDAP   = 0
+endif
 
 # flag for PAM support, please turn on if you need PAM
+ifdef USEPAM
+USE_PAM    = 1
+else
 USE_PAM    = 0
+endif
 
 #############################################################
 
diff --git a/buildrpm b/buildrpm
index 1c0b9bc..8dde819 100755
--- a/buildrpm
+++ b/buildrpm
@@ -1,17 +1,38 @@
 #!/bin/csh
-# Usage: build [-n] <version> <release>
+# Usage: build [-n] <version> <release> [-krb5] [-ldap] [-pam] [-ssl]
 # Build ELOG distribution
 
 if ($#argv < 2) then
-  echo "Usage: build <version> <release>"
+  echo "Usage: build <version> <release> [-krb5] [-ldap] [-pam] [-ssl]"
   exit
 endif
  
 set version = $argv[1]
 set release = $argv[2]
+set i = 0
+set BUILDOPTS=""
+foreach argument ($argv)
+  set i=`expr $i + 1`
+  if ($i <= 2) continue
+  switch ($argument)
+    case "-ldap":
+       set BUILDOPTS="$BUILDOPTS --with ldap"
+       breaksw
+    case "-pam":
+       set BUILDOPTS="$BUILDOPTS --with pam"
+       breaksw
+    case "-ssl":
+       set BUILDOPTS="$BUILDOPTS --with ssl"
+       breaksw
+    case "-krb5":
+       set BUILDOPTS="$BUILDOPTS --with krb5"
+       breaksw
+  endsw
+end
+
 set dist = `rpm --eval %{\?dist}`
 set dir = /tmp/elog-$version
-set archive = elog-$version.tar.gz
+set archive = elog-$version-$release.tar.gz
 
 # create temporary directory
 rm -Rf $dir
@@ -65,7 +86,8 @@ rm -Rf $dir
 
 # transfer archive
 echo Transfer archive...
-mkdir -p ~/rpmbuild/SOURCES && cp /tmp/$archive ~/rpmbuild/SOURCES/elog-$version.tar.gz
+[ ! -d ~/rpmbuild/SOURCES ] && mkdir -p ~/rpmbuild/SOURCES 
+cp /tmp/$archive ~/rpmbuild/SOURCES/elog-$version-$release.tar.gz
 
 # if running on at PSI copy to download area
 if (`hostname` == 'elog01.psi.ch') then
@@ -75,6 +97,8 @@ if (`hostname` == 'elog01.psi.ch') then
     cp -v /tmp/$archive ~ritt/html/elog/download/tar/elog-latest.tar.gz
     cp -vf doc/ChangeLog ~ritt/html/elog/download/ChangeLog
   endif
+  # define Factory Packager
+  set BUILDOPTS="${BUILDOPTS} --define \"packager Stefan Ritt <stefan.ritt@psi.ch>\""
 endif
 rm -f /tmp/$archive
 
@@ -83,8 +107,13 @@ rm -f ~/rpmbuild/RPMS/*/elog*${version}-${release}*.rpm
 rm -f ~/rpmbuild/SRPMS/elog*${version}-${release}*.rpm
 
 # building RPMs
+cp elog.spec.template ~/rpmbuild/SPECS/elog.spec
+sed -i "s/__ELOGVER__/${version}/;s/__ELOGREL__/${release}/" ~/rpmbuild/SPECS/elog.spec
 echo Build RPMs...
-rpmbuild -ba --define "version ${version}" --define "release ${release}" elog.spec || exit $?
+set factorydate = `env LC_TIME=C date '+%a %b %d %Y'`
+rpmbuild -ba ${BUILDOPTS} --define "factorydate ${factorydate}" \
+	--define "version ${version}" --define "elogrel ${release}" \
+	~/rpmbuild/SPECS/elog.spec || exit $?
 
 # if running on at PSI copy to download area
 if (`hostname` == 'elog01.psi.ch') then
diff --git a/elog.spec b/elog.spec
deleted file mode 100755
index 8397eab..0000000
--- a/elog.spec
+++ /dev/null
@@ -1,107 +0,0 @@
-# ELOG weblog application
-# rpmbuild -ba --define 'version 3.1.4' --define 'release 2' --define "date $(LC_TIME=En date '+%a %b %d %Y')" elog.spec
- 
-#define	date	$(LC_TIME=En date '+%a %b %d %Y')      
-%define build_timestamp %(LC_TIME=En date '+%a %b %d %Y')
-
-Name:       elog
-Summary:    elog is a standalone electronic web logbook
-Version:    %version
-Release:    %release%{?dist}
-License:    GPL
-Group:      Applications/Networking
-Source:     http://elog.psi.ch/elog/download/elog-%{version}.tar.gz
-Vendor:     Stefan Ritt <stefan.ritt@psi.ch>
-URL:        http://elog.psi.ch/elog
-BuildRoot:  /tmp/%{name}-root
-Prefix:     /usr/local
-BuildRequires: openssl-devel >= 0.9.8e
-
-%description
-ELOG is part of a family of applications known as weblogs. 
-Their general purpose is : 
-
-1. To make it easy for people to put information online in a chronological
-   fashion, in the form of short, time-stamped text messages ("entries") 
-   with optional HTML markup for presentation, and optional file attachments 
-   (images, archives, etc.) 
-
-2. To make it easy for other people to access this information through a 
-   Web interface, browse entries, search, download files, and optionally add, 
-   update, delete or comment on entries. 
-
-ELOG is a remarkable implementation of a weblog in at least two respects : 
-
-- Its simplicity of use: you don't need to be a seasoned server operator 
-and/or an experimented database administrator to run ELOG ; one executable 
-file (under Unix or Windows), a simple configuration text file, and it works. 
-No Web server or relational database required. It is also easy to translate 
-the interface to the appropriate language for your users. 
-
-- Its versatility: through its single configuration file, ELOG can be made 
-to display an infinity of variants of the weblog concept. There are options 
-for what to display, how to display it, what commands are available and to whom, 
-access control, etc. Moreover, a single server can host several weblogs, and 
-each weblog can be totally different from the rest. 
-
-%changelog
-* %{build_timestamp} Stefan Ritt <stefan.ritt@psi.ch> %version-%release
-- Updated from git 
-* Wed Sep 26 2018 Stefan Ritt <stefan.ritt@psi.ch>
-- Made adjustments for new elog server and RH7
-* Fri Aug 29 2014 Stefan Ritt <stefan.ritt@psi.ch>
-- Added BuildRequires, thanks to Stefan Roiser from CERN
-* Fri Oct 21 2005 Stefan Ritt <stefan.ritt@psi.ch>
-- Added resources/ directory
-* Fri Mar 14 2003 Stefan Ritt <stefan.ritt@psi.ch>
-- Added %post to change ownership of elog files
-* Thu Jan 30 2003 Stefan Ritt <stefan.ritt@psi.ch>
-- Added installation of man pages, thanks to Serge Droz <serge.droz@psi.ch>
-* Tue Aug 13 2002 Stefan Ritt <stefan.ritt@psi.ch>
-- Added elog group and user, thanks to Nicolas Chuche [nchuche@teaser.fr]
-* Tue Jun 18 2002 Stefan Ritt <stefan.ritt@psi.ch>
-- Put elogd.init into TAR file, add logbooks directory, put elogd in sbin/
-* Tue Jun 18 2002 Serge Droz <serge.droz@psi.ch>
-- Update to 2.0.0
-* Mon Jun  3 2002 Serge Droz <serge.droz@psi.ch>
-- Update to 1.3.6 
-* Fri May 31 2002 Serge Droz <serge.droz@psi.ch>
-- Initial RPM
-
-
-%prep
-%setup -q
-
-%pre
-%{_sbindir}/groupadd -r elog 2>/dev/null || :
-%{_sbindir}/useradd -d / -s /bin/false \
-   -g elog -M -r elog 2>/dev/null || :
-
-%build
-make CFLAGS='-O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml -g'
-sed "s#\@PREFIX\@#%{prefix}#g" elogd.init_template > elogd.init
-
-%install
-make install ROOT=$RPM_BUILD_ROOT MANDIR=$RPM_BUILD_ROOT%{_mandir}
-
-%post
-chown -R elog:elog $RPM_BUILD_ROOT%{prefix}/elog
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-/etc/rc.d/init.d/elogd
-%{_mandir}/man1/*
-%{_mandir}/man8/*
-%doc	README COPYING doc
-%defattr(-,elog,elog)
-%prefix/bin/*
-%prefix/sbin/elogd
-%prefix/elog/resources
-%prefix/elog/ssl
-%prefix/elog/themes
-%prefix/elog/scripts
-%prefix/elog/logbooks
-%config(noreplace) %prefix/elog/elogd.cfg
diff --git a/elog.spec.template b/elog.spec.template
--- a/elog.spec.template
+++ b/elog.spec.template
0a1,139
> # ELOG weblog application
> # rpmbuild -ba --define 'elogver 3.1.4' --define 'elogrel 2' --with ssl --with pam --with ldap --with krb5 --define 'factorydate date'
>  
> # define date of build for changelog and default release
> %define build_timestamp %(LC_TIME=C date '+%a %b %d %Y')
> %{!?factorydate: %define factorydate %build_timestamp}
> 
> # default version and release
> %{!?elogver: %define elogver __ELOGVER__ }
> %{!?elogrel: %define elogrel __ELOGREL__ }
> # default release is build date
> %{!?elogrel: %define elogrel %{build_timestamp} }
> 
> # Build options :
> # Read: If neither macro exists, then add the default definition.
> %{?_with_krb5: %define _with_krb5 USEKRB5=1}
> %{?_with_ldap: %define _with_ldap USELDAP=1}
> %{?_with_pam: %define _with_pam USEPAM=1}
> %{?_with_ssl: %define _with_ssl USESSL=1}
> # Default build options are with SSL 
> %{!?_with_ssl: %{!?_without_ssl: %define _with_ssl USESSL=1}}
> # builder info
> %define whoami %(eval who am i | awk '{print $1}')
> %define HOSTNAME %(hostname)
> %{!?packager: %define packager %{whoami} %{whoami}@%{HOSTNAME}}
> 
> Name:       elog
> Summary:    elog is a standalone electronic web logbook
> Version:    %elogver
> Release:    %elogrel%{?customrel}%{?dist}
> License:    GPL
> Group:      Applications/Networking
> Source:     http://elog.psi.ch/elog/download/elog-%{elogver}-%{elogrel}.tar.gz
> Vendor:     Stefan Ritt <stefan.ritt@psi.ch>
> URL:        http://elog.psi.ch/elog
> BuildRoot:  /tmp/%{name}-root
> Prefix:     /usr/local
> # Add build dependencies for pam, ssl and ldap features if enabled.
> # Note: Tag tokens must start at beginning-of-line.
> #
> # Read: If feature is enabled, then add the build dependency.
> %{?_with_krb5:BuildRequires: krb5-devel}
> %{?_with_krb5:Requires: krb5-libs}
> %{?_with_ldap:BuildRequires: openldap-devel >= 2.4.1}
> %{?_with_ldap:Requires: openldap >= 2.4.1}
> %{?_with_pam:BuildRequires: pam-devel >= 1.1.1}
> %{?_with_ssl:BuildRequires: openssl-devel >= 0.9.8e}
> 
> %description
> ELOG is part of a family of applications known as weblogs. 
> Their general purpose is : 
> 
> 1. To make it easy for people to put information online in a chronological
>    fashion, in the form of short, time-stamped text messages ("entries") 
>    with optional HTML markup for presentation, and optional file attachments 
>    (images, archives, etc.) 
> 
> 2. To make it easy for other people to access this information through a 
>    Web interface, browse entries, search, download files, and optionally add, 
>    update, delete or comment on entries. 
> 
> ELOG is a remarkable implementation of a weblog in at least two respects : 
> 
> - Its simplicity of use: you don't need to be a seasoned server operator 
> and/or an experimented database administrator to run ELOG ; one executable 
> file (under Unix or Windows), a simple configuration text file, and it works. 
... 74 more lines ...
  152   Wed Mar 4 18:40:57 2020 Laurent Jean-Rigaudlollspam@free.frOtherRe: Re: RPM build process enhancementsStableWed Mar 4 18:45:05 2020 by Laurent Jean-Rigaud

Sorry, the patch is malformed for the template file. Check PJ.

Bye,

Laurent

 

Laurent Jean-Rigaud wrote:

Hi Stefan,

2nd patch for RPM build which adds :

  • dynamic build options for krb5/ldap/pam/ssl support :
    • for git / non rpm users : 
      • buildrpm version release [-krb5] [-ldap] [-pam] [-ssl]
    • for rpm users using SRPMS (dependances are managed) :
      • rpm -i elog-ver-rel.src.rpm && rpmbuld -bb [--use krb5] [--use ldap] [--use pam] [--use ssl] ~/rpmbuild/SPECS/elog.spec
  • dynamic 2 last changelog entries :
    • last with build information with
      • dynamic user 's info (use your info if builded from PSI, or use %packager from ~/.rpmmacros if exists, or set to username username@ostname)
      • build options list (KBR5, LDAP, PAM, SSL)
    • before last for product changelog of current ELOG version-release
  • customrel flag for local rebuild :
    • release = %elogrel%{?customrel}%{?dist)
    • so custom builder can add --define 'customrel NSA'  at rpmbuild command or in .rpmmacros file -> elog-3.1.4-2.NSA.el7.x86_64.rpm by example.
  • elog version and release are delivered in specfile as default for rebuild (tarball name uses it so it can not be changed for local rebuild from SRPMS).
  • buildrpm uses ~/rpmbuild/SPECS/elog.spec generated from elog.spec.template (elog.spec is deleted in repo, replaced by elog.spec.template).

 

Tested on EL6 and EL7 x86_64 :-)

Bye

 

Laurent Jean-Rigaud wrote:

Hi Stefan,

I enclosed a patch for RPM build process available on GIT.

changes :

  • rpmbuild :
    • checks if provider or custom build (the rm/mv are done on your computers only :-))
    • call rpmbuild with version / release given as parameters
  • elog.spec :
    • last changelog entry date is set to build date
    • build with debug for debuginfo rpms (product rpms are normally automatically strimmed)
    • elog.init call /etc/ini.d/functions for RHEL/Centos/Fedora/? dists

 

Todo:

  • add RPMbuild options for ldap/pam/...
  • enclosed git log in changelog automatically (the dream :-))

 

 

Attachment 1: elog.spec.template
# ELOG weblog application
# rpmbuild -ba --define 'elogver 3.1.4' --define 'elogrel 2' --with ssl --with pam --with ldap --with krb5 --define 'factorydate date'
 
# define date of build for changelog and default release
%define build_timestamp %(LC_TIME=C date '+%a %b %d %Y')
%{!?factorydate: %define factorydate %build_timestamp}

# default version and release
%{!?elogver: %define elogver __ELOGVER__ }
%{!?elogrel: %define elogrel __ELOGREL__ }
# default release is build date
%{!?elogrel: %define elogrel %{build_timestamp} }

# Build options :
# Read: If neither macro exists, then add the default definition.
%{?_with_krb5: %define _with_krb5 USEKRB5=1}
%{?_with_ldap: %define _with_ldap USELDAP=1}
%{?_with_pam: %define _with_pam USEPAM=1}
%{?_with_ssl: %define _with_ssl USESSL=1}
# Default build options are with SSL 
%{!?_with_ssl: %{!?_without_ssl: %define _with_ssl USESSL=1}}
# builder info
%define whoami %(eval who am i | awk '{print $1}')
%define HOSTNAME %(hostname)
%{!?packager: %define packager %{whoami} %{whoami}@%{HOSTNAME}}

Name:       elog
Summary:    elog is a standalone electronic web logbook
Version:    %elogver
Release:    %elogrel%{?customrel}%{?dist}
License:    GPL
Group:      Applications/Networking
Source:     http://elog.psi.ch/elog/download/elog-%{elogver}-%{elogrel}.tar.gz
Vendor:     Stefan Ritt <stefan.ritt@psi.ch>
URL:        http://elog.psi.ch/elog
BuildRoot:  /tmp/%{name}-root
Prefix:     /usr/local
# Add build dependencies for pam, ssl and ldap features if enabled.
# Note: Tag tokens must start at beginning-of-line.
#
# Read: If feature is enabled, then add the build dependency.
%{?_with_krb5:BuildRequires: krb5-devel}
%{?_with_krb5:Requires: krb5-libs}
%{?_with_ldap:BuildRequires: openldap-devel >= 2.4.1}
%{?_with_ldap:Requires: openldap >= 2.4.1}
%{?_with_pam:BuildRequires: pam-devel >= 1.1.1}
%{?_with_ssl:BuildRequires: openssl-devel >= 0.9.8e}

%description
ELOG is part of a family of applications known as weblogs. 
Their general purpose is : 

1. To make it easy for people to put information online in a chronological
   fashion, in the form of short, time-stamped text messages ("entries") 
   with optional HTML markup for presentation, and optional file attachments 
   (images, archives, etc.) 

2. To make it easy for other people to access this information through a 
   Web interface, browse entries, search, download files, and optionally add, 
   update, delete or comment on entries. 

ELOG is a remarkable implementation of a weblog in at least two respects : 

- Its simplicity of use: you don't need to be a seasoned server operator 
and/or an experimented database administrator to run ELOG ; one executable 
file (under Unix or Windows), a simple configuration text file, and it works. 
No Web server or relational database required. It is also easy to translate 
the interface to the appropriate language for your users. 

- Its versatility: through its single configuration file, ELOG can be made 
to display an infinity of variants of the weblog concept. There are options 
for what to display, how to display it, what commands are available and to whom, 
access control, etc. Moreover, a single server can host several weblogs, and 
each weblog can be totally different from the rest. 

%changelog
* %{build_timestamp} %{packager} %{version}-%{release}
- rebuild with option(s): %{?_with_krb5:KRB5 }%{?_with_ldap:LDAP }%{?_with_pam:PAM }%{?_with_ssl:SSL}

* %{factorydate} Stefan Ritt <stefan.ritt@psi.ch> %{version}-%{release}
- Updated from git 
* Wed Sep 26 2018 Stefan Ritt <stefan.ritt@psi.ch>
- Made adjustments for new elog server and RH7
* Fri Aug 29 2014 Stefan Ritt <stefan.ritt@psi.ch>
- Added BuildRequires, thanks to Stefan Roiser from CERN
* Fri Oct 21 2005 Stefan Ritt <stefan.ritt@psi.ch>
- Added resources/ directory
* Fri Mar 14 2003 Stefan Ritt <stefan.ritt@psi.ch>
- Added %post to change ownership of elog files
* Thu Jan 30 2003 Stefan Ritt <stefan.ritt@psi.ch>
- Added installation of man pages, thanks to Serge Droz <serge.droz@psi.ch>
* Tue Aug 13 2002 Stefan Ritt <stefan.ritt@psi.ch>
- Added elog group and user, thanks to Nicolas Chuche [nchuche@teaser.fr]
* Tue Jun 18 2002 Stefan Ritt <stefan.ritt@psi.ch>
- Put elogd.init into TAR file, add logbooks directory, put elogd in sbin/
* Tue Jun 18 2002 Serge Droz <serge.droz@psi.ch>
- Update to 2.0.0
* Mon Jun  3 2002 Serge Droz <serge.droz@psi.ch>
- Update to 1.3.6 
* Fri May 31 2002 Serge Droz <serge.droz@psi.ch>
- Initial RPM


%prep
%setup -q

%pre
%{_sbindir}/groupadd -r elog 2>/dev/null || :
%{_sbindir}/useradd -d / -s /bin/false \
   -g elog -M -r elog 2>/dev/null || :

%build
make %{?_with_ssl} %{?_with_pam} %{?_with_ldap} %{?_with_krb5} CFLAGS='-O3 -funroll-loops -fomit-frame-pointer -W -Wall -Wno-deprecated-declarations -Imxml -g'
sed "s#\@PREFIX\@#%{prefix}#g" elogd.init_template > elogd.init

%install
make install ROOT=$RPM_BUILD_ROOT MANDIR=$RPM_BUILD_ROOT%{_mandir}

%post
chown -R elog:elog $RPM_BUILD_ROOT%{prefix}/elog

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/etc/rc.d/init.d/elogd
%{_mandir}/man1/*
%{_mandir}/man8/*
%doc	README COPYING doc
%defattr(-,elog,elog)
%prefix/bin/*
%prefix/sbin/elogd
%prefix/elog/resources
%prefix/elog/ssl
%prefix/elog/themes
%prefix/elog/scripts
%prefix/elog/logbooks
%config(noreplace) %prefix/elog/elogd.cfg
  154   Thu Mar 3 12:01:55 2022 rami khraisrami.khrais@sesame.org.joOtherFixing repeating first inline_image in emailStableThu Mar 10 11:30:20 2022 by rami khrais

Fixing repeating first image in email (email notification) when the user submit a new log with in_line images.

Attachment 1: elogd.c
/********************************************************************

   Name:         elogd.c
   Created by:   Stefan Ritt
   Copyright 2000 + Stefan Ritt

   ELOG is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   ELOG is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   In addition, as a special exception, the copyright holders give
   permission to link the code of portions of this program with the
   OpenSSL library under certain conditions as described in each
   individual source file, and distribute linked combinations
   including the two.
   You must obey the GNU General Public License in all respects
   for all of the code used other than OpenSSL.  If you modify
   file(s) with this exception, you may extend this exception to your
   version of the file(s), but you are not obligated to do so.  If you
   do not wish to do so, delete this exception statement from your
   version.  If you delete this exception statement from all source
   files in the program, then also delete it here.

   You should have received a copy of the GNU General Public License
   along with ELOG.  If not, see <http://www.gnu.org/licenses/>.


   Contents:     Web server program for Electronic Logbook ELOG

\********************************************************************/

#include "elogd.h"
#include "git-revision.h"

const char *_git_revision = GIT_REVISION;

BOOL running_as_daemon;         /* Running as a daemon/service? */
int elog_tcp_port;              /* Server's TCP port            */

static void (*printf_handler)(const char *);   /* Handler to printf for logging */
static void (*fputs_handler)(const char *);    /* Handler to fputs for logging  */
static FILE *current_output_stream = NULL;      /* Currently used output stream  */

char *return_buffer;
int return_buffer_size;
int strlen_retbuf;
int keep_alive;
char header_buffer[20000];
int return_length;
char host_name[256];
char referer[256];
char browser[256];
char config_file[256];
char resource_dir[256];
char logbook_dir[256];
char listen_interface[256];
char theme_name[80];
char http_host[256];
char http_user[256];

char _param[MAX_PARAM][NAME_LENGTH];
char _value[MAX_PARAM][NAME_LENGTH];
char _mtext[TEXT_SIZE];
char _cmdline[CMD_SIZE];
char *_attachment_buffer;
int _attachment_size;
int _max_content_length = MAX_CONTENT_LENGTH;
struct in_addr rem_addr;
char rem_host[256];
char rem_host_ip[256];
int _sock;
BOOL use_keepalive, enable_execute = FALSE;
BOOL ckedit_exist, image_magick_exist;
int _verbose_level, _current_message_id;
int _logging_level, _ssl_flag;

LOGBOOK *lb_list = NULL;

#define VERBOSE_URL     1
#define VERBOSE_INFO    2
#define VERBOSE_DEBUG   3

#ifdef HAVE_SSL
SSL *_ssl_con;
#endif

char *mname[] = {"January", "February", "March", "April", "May", "June", "July", "August", "September",
                 "October", "November", "December"
};

char attr_list[MAX_N_ATTR][NAME_LENGTH];
char attr_options[MAX_N_ATTR][MAX_N_LIST][NAME_LENGTH];
int attr_flags[MAX_N_ATTR];

char attr_list_default[][NAME_LENGTH] = {"Author", "Type", "Category", "Subject", ""};

char attr_options_default[][MAX_N_LIST][NAME_LENGTH] = {{""},
                                                        {"Routine", "Other"},
                                                        {"General", "Other"},
                                                        {""}
};

int attr_flags_default[] = {AF_REQUIRED, 0, 0, 0};

struct {
   char ext[32];
   char type[80];
} filetype[] = {

        {
                ".AI",   "application/postscript"},
        {
                ".ASC",  "text/plain"},
        {
                ".BZ2",  "application/x-bzip2"},
        {
                ".CFG",  "text/plain"},
        {
                ".CHRT", "application/x-kchart"},
        {
                ".CONF", "text/plain"},
        {
                ".CSH",  "application/x-csh"},
        {
                ".CSS",  "text/css"},
        {
                ".DOC",  "application/msword"},
        {
                ".DVI",  "application/x-dvi"},
        {
                ".EPS",  "application/postscript"},
        {
                ".GIF",  "image/gif"},
        {
                ".GZ",   "application/x-gzip"},
        {
                ".HTM",  "text/html"},
        {
                ".HTML", "text/html"},
        {
                ".ICO",  "image/x-icon"},
        {
                ".JPEG", "image/jpeg"},
        {
                ".JPG",  "image/jpeg"},
        {
                ".JS",   "application/x-javascript"},
        {
                ".KPR",  "application/x-kpresenter"},
        {
                ".KSP",  "application/x-kspread"},
        {
                ".KWD",  "application/x-kword"},
        {
                ".MP3",  "audio/mpeg"},
        {
                ".OGG",  "application/x-ogg"},
        {
                ".PDF",  "application/pdf"},
        {
                ".PNG",  "image/png"},
        {
                ".PS",   "application/postscript"},
        {
                ".RAM",  "audio/x-pn-realaudio"},
        {
                ".RM",   "audio/x-pn-realaudio"},
        {
                ".RM",   "audio/x-pn-realaudio"},
        {
                ".RM",   "audio/x-pn-realaudio"},
        {
                ".RPM",  "application/x-rpm"},
        {
                ".RTF",  "application/rtf"},
        {
                ".SH",   "application/x-sh"},
        {
                ".SVG",  "image/svg+xml"},
        {
                ".TAR",  "application/x-tar"},
        {
                ".TCL",  "application/x-tcl"},
        {
                ".TEX",  "application/x-tex"},
        {
                ".TGZ",  "application/x-gzip"},
        {
                ".TIF",  "image/tiff"},
        {
                ".TIFF", "image/tiff"},
        {
                ".TXT",  "text/plain"},
        {
                ".WAV",  "audio/x-wav"},
        {
                ".XLS",  "application/x-msexcel"},
        {
                ".XML",  "text/xml"},
        {
                ".XSL",  "text/xml"},
        {
                ".ZIP",  "application/x-zip-compressed"},
        {

                /* Open XML file types */
                ".DOCM", "application/vnd.ms-word.document.macroEnabled.12"},
        {
                ".DOCX", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"},
        {
                ".DOTM", "application/vnd.ms-word.template.macroEnabled.12"},
        {
                ".DOTX", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"},
        {
                ".PPSM", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12"},
        {
                ".PPSX", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"},
        {
                ".PPTM", "application/vnd.ms-powerpoint.presentation.macroEnabled.12"},
        {
                ".PPTX", "application/vnd.openxmlformats-officedocument.presentationml.presentation"},
        {
                ".XLSB", "application/vnd.ms-excel.sheet.binary.macroEnabled.12"},
        {
                ".XLSM", "application/vnd.ms-excel.sheet.macroEnabled.12"},
        {
                ".XLSX", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"},
        {
                ".XPS",  "application/vnd.ms-xpsdocument"},
        {

                "",      ""},};

struct {
   char language[32];
   char abbrev[32];
} lang_table[] = {

        {"brazilian",    "br"},
        {"bulgarian",    "bg"},
        {"czech",        "cz"},
        {"danish",       "dk"},
        {"dutch",        "nl"},
        {"french",       "fr"},
        {"german",       "de"},
        {"indonesia",    "id"},
        {"italian",      "it"},
        {"japanese",     "jp"},
        {"polish",       "pl"},
        {"ru_CP1251",    "ru"},
        {"slowak",       "sk"},
        {"spanish",      "es"},
        {"swedish",      "se"},
        {"turkish",      "tr"},
        {"zh_CN-GB2314", "zh"},
        {"zh_CN-UTF8",   "zh"},
        {"",             ""}
};

char _convert_cmd[256];
char _identify_cmd[256];

#ifdef OS_WINNT
int run_service(void);
#endif

#ifdef OS_UNIX
gid_t orig_gid;                 /* Original effective GID before dropping privilege */
uid_t orig_uid;                 /* Original effective UID before dropping privilege */
char pidfile[256];              /* Pidfile name                                     */
#endif

#ifdef __CYGWIN__               /* bug in cygwin, 'timezone' not linked automatically */
long _timezone;
#endif

/*---- Funcions from the MIDAS library -----------------------------*/

#define my_toupper(_c)    ( ((_c)>='a' && (_c)<='z') ? ((_c)-'a'+'A') : (_c) )
#define my_tolower(_c)    ( ((_c)>='A' && (_c)<='Z') ? ((_c)-'A'+'a') : (_c) )

BOOL strieq(const char *str1, const char *str2) {
   char c1, c2;

   if (str1 == NULL && str2 == NULL)
      return TRUE;
   if (str1 == NULL || str2 == NULL)
      return FALSE;
   if (strlen(str1) != strlen(str2))
      return FALSE;

   while (*str1) {
      c1 = *str1++;
      c2 = *str2++;
... 30972 more lines ...
  155   Fri Dec 1 16:30:46 2023 Stefan RittUnstefan.ritt@psi.chOtherRe: Fixing repeating first inline_image in emailStableFri Dec 1 16:31:37 2023 by Stefan Ritt

Unfortunately you made your changes against a pretty old version of elogd.c, so I can't see which changes you made (the diffs gives 100's of changes now). If you can apply your fix against the current elogd.cxx from the bitbucket repository, I would be happy to include the fix in the distribution.

Stefan

rami khrais wrote:

Fixing repeating first image in email (email notification) when the user submit a new log with in_line images.

 

  8   Wed Feb 4 11:24:14 2004 Fred Hooperfhooper@sushisoft.comScriptJavascript for Bookmark Link for one-click submission to elogAlphaFebruary 04, 2004 by Stefan Ritt
I have created a javascript to be used as a browser link that allows a one
step cut and paste from a web browser into a elog logbook. 

The intended application is allow a user to do a text selection in a web
browser, then click on a bookmark that automagically pastes the selected
text, the current browser page url, and the current browser page title into
a pre-defined elog logbook.   I do some research where I would like to save
some text from a webpage, but also have a record of where the webpage came
from.  However, you should find that you can extend this script in a varity
of ways for your own application.  

The script is a simple one: it uses javascript in a saved bookmark to get
your selected text, title, and url, and then creates a new browser window
with a elog form, and print the document variables into the form, and then
submits the form to elog.   The key advantage to this approach is that you
can use the "post" command, rather than "get", to submit to the text section
of an elog logbook.  The only way I found now to submit to elog via a
bookmark is using the "get" command, and it doesn't allow entry of the
"text" field, only attribute fields.    

The second major advantage to using POST is that you can submit a much 
large quanity of information ; However, some checking on this leads me to 
believe that the limit is browser and server depended, so YMMV.  However, a 
great discussion on the limits of browsers can be found here: 
http://www.squarefree.com/bookmarklets/browsers.html .

One of the major limits is that IE6.0 browsers have a maxium of 508 bytes
per bookmark - This book runs over 800 bytes, so I suspect tha IE6+ will 
not allow it. I tested the link with Mozilla and Firebird 0.7.

This script will need to edited for you to use with your elog logbook.
The script should be fairly self-explainitory, if you are used to html 
forms and have some exposure to javascript.

You will need to modifiy the following fields:

1) in form action = http://<your_domain.com>/elog/<logbook>/?cmd=New
   
   change the link to point to your specific logbook to be used for entry.

2) the attribute fields need match up with the ones in your logbook.

   The ones listed in the template are Author, Email, Title, and URL.

   If you have fixed fields (like Author and Email), then you can
   predefine these fields as shown.  

   I have the page title used as the entry for Title, and the page url is
   use as the URL attribute.

   Finally, I have the text selection used as the entry for the Text field.

   You can add additional fields by creating a new <input ...>  segment
   in the script.  For those more clever than me, you can concatinate the
   title, url and selection to paste into the Text area as well.  

3) once you have a edited version of the script (make sure you keep it as a
single line), you can then create a new bookmark in your browser, and then
paste the script into the properties->location field (for Mozilla/Firebird)
or the properites->url field (IE). Give it a good name like "post to elog"

4) once saved, you can then go a web page, select some text, and then go to
your bookmarks and click on the bookmark. It should then create a new
window in elog with a completed logbook entry.


some notes:

1) again, this may not work on IE6+ browsers due to M$ limitations.

2) You may have to be logged in already to elog for this work - I have not
tested the interaction using a password protected elog

3) You can only post to a single elog logbook - You'll need to have 
multiple bookmarks for multiple logbooks.

__________________________
Note added by Stefan Ritt:

I zipped the attached JavaScript, since our email router does not allow .js 
file name extensions.
Attachment 1: elogsubmit-template.zip
  9   Wed Jul 7 18:19:10 2004 Steve Jonessteve.jones@freescale.comScriptGeneric Unix elogd init scriptStableWed Jul 7 18:19:38 2004 by Steve Jones
The elogd.init script that ships in the elog distribution is Linux centric.
 This script is written to work in a generic Unix environment under 'sh' -
no frills!
Attachment 1: elogd.init
#!/bin/sh

# description: Start elog
# elog can have multiple instances run on the same server, pointing to different logbook areas.  This start
# script should be run from the root of each different elog area.

ELOGD="/_TOOLS_/dist/gnu-elog-2.5.3/sparc-sun-solaris2.8/bin/elogd"
ELOGDIR="/proj/sysadmin/ess/www/elog"
HOSTNAME=`hostname`

# Check for the config file
if [ ! -f $ELOGDIR/elogd.cfg ]; then
    exit 0
fi


# See how we were called.
case "$1" in
  start)
        if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
	   pid=`cat ./elogd-$HOSTNAME.pid`
	   if [ -d /proc/$pid ] ; then
	     echo "elogd already running"
	     exit 1
	   fi
	fi
####################################
# The full path *must* be specified
	echo "Starting elogd: "
	$ELOGD -f $ELOGDIR/elogd-$HOSTNAME.pid -c $ELOGDIR/elogd.cfg -D  > /dev/null 2>&1 &
	RETVAL=$?
        if [ $RETVAL -eq 0  ] ; then 
          echo "elog started" 
        else
          echo "Failed to start elog"
        fi
	echo
	;;
  stop)
     echo ""
      if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
        echo "Stopping elogd: "
        kill `cat $ELOGDIR/elogd-$HOSTNAME.pid`
	rm -f $ELOGDIR/elogd-$HOSTNAME.pid
        echo "elog stopped"
        echo
     else
        echo "No elogd running?"
	echo "Failed to start elog"
	echo
     fi
     
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0

  10   Fri Sep 24 23:14:47 2004 Sridhar Anandakrishnansak@essc.psu.eduScriptPerl script to forwar emails to elogAlpha 
Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into /tmp.  The parts
are sent to elog as attachments.
Attachment 1: doelog
#!/usr/bin/perl -w

=head1 NAME

doelog - save a mime message to elog

=head1 SYNOPSIS

    doelog <mime-msg-file> <mime-msg-file> ...
    
    someprocess | doelog -

=head1 DESCRIPTION

Takes one or more files from the command line that contain MIME
messages, and explodes their contents out into /tmp.  The parts
are sent to elog as attachments.

Modified mimeexplode of the MIME::Tools in perl


This was written as an example of the MIME:: modules in the
MIME-parser package I wrote.  It may prove useful as a quick-and-dirty
way of splitting a MIME message if you need to decode something, and
you don't have a MIME mail reader on hand.

=head1 COMMAND LINE OPTIONS

None yet.  

=head1 AUTHOR

sak@essc.psu.edu

=cut

BEGIN { unshift @INC, ".." }    # to test MIME:: stuff before installing it!

require 5.001;

use strict;
use vars qw($Msgno $cmd);

use MIME::Parser;
use Getopt::Std;

## these should be options too?
## base elog cmd
$cmd = "~/elog -h localhost -p 8080 ";

#------------------------------------------------------------
# dump_entity - dump an entity's file info
#------------------------------------------------------------
sub dump_entity {
    my $ent = shift;
    my @parts = $ent->parts;
    my $file;
    
    die "too many attachments\n" if ($#parts>10);

    if (@parts) {        # multipart...
	map { dump_entity($_) } @parts;
    }
    else {               # single part...append to elog cmd
	$file = $ent->bodyhandle->path;
	$cmd .= "-f \"$file\" ";
##	print $cmd, "\n";
##	print "    Part: ", $ent->bodyhandle->path, 
##	      " (", scalar($ent->head->mime_type), ")\n";
    }
}

#------------------------------------------------------------
# main
#------------------------------------------------------------
sub main {
    my $file;
    my $entity;
    my $subject;
    my $logbook;
    our($opt_l);

    # Sanity:
    ## (-w ".") or die "cwd not writable, you naughty boy...";

    ## check if user wants a particular logbook
    ## fix to add host and port?
    getopts('l:');
    if($opt_l) { $logbook=$opt_l;} else {$logbook="emails";}
    $cmd .= "-l $logbook ";
    
    # Go through messages:
    @ARGV or unshift @ARGV, "-";
    while (defined($file = shift @ARGV)) {


	# Create a new parser object:
	my $parser = new MIME::Parser;
    
	# Optional: set up parameters that will affect how it extracts 
	#   documents from the input stream:
	$parser->output_under("/tmp");
    
	# Parse an input stream:
	open FILE, $file or die "couldn't open $file";
	$entity = $parser->read(\*FILE) or 
	    print STDERR "Couldn't parse MIME in $file; continuing...\n";
	close FILE;

	## get the subject, assumes all logbooks have a subject 
	## attribute - not necessarily true.  Mine do...
	chomp($subject = $entity->head->get('Subject', 0));
	$cmd .= "-a subject=\"$subject\" ";
	print $cmd, "\n";

	# Congratulations: you now have a (possibly multipart) MIME entity!
	dump_entity($entity) if $entity;
	### $entity->dump_skeleton if $entity;
	### print $cmd, "\n";
	exec $cmd;
    }
    1;
}

exit (&main ? 0 : -1);
#------------------------------------------------------------
1;





  12   Wed Feb 23 11:25:51 2005 Emiliano GabrielliAlberT@SuperAlberT.itScriptbash script for thumbnails creation, version: 0.2.0StableMon May 2 14:51:29 2005 by Emiliano Gabrielli
The following script creates a thumbnail for image/ps/pdf files.  
it can be used with "Execute edit" and "Execute new" configuration commands  
in order to get resized thumbs of attachments.  
  
It uses file(1), convert(1) for images, gs(1) is also required for ps and pdf.  
  
You have to start elogd with the "-x" option to enable execution and put  
something similar to the following in you configuration elog file:  
  
Execute new = /path/to/make_thumbs -s 650 -q 95 $attachments  
Execute edit = /path/to/make_thumbs -s 100 $attachments  
  
make_thumbs have to be executable by the user running elogd, of course.  
 
 
ChangeLog: 
* version 0.2.0 Fixes a BUG in PDF creation 
Attachment 1: make_thumbs
#!/bin/bash
#
# Makes thumbnails (a jpeg image) from a given set of input files.
# Supported input file types are those supported by 'convert',
# plus PDF.
# Requires convert(1), gs(1) and file(1)
#
# Usage:      make_thumbs [options] [ file1 file2 ... ]
# Author:     Emiliano Gabrielli
# License:    GPL
# Latest Version at http://SuperAlberT.it/download/command_line_scripts/elog/
#
# $Id: make_thumbs,v 1.7 2005/04/14 10:01:37 albert Exp $

function parse_cmdline()
{
	export OPTERR=1
	while getopts "s:q:Vh" "option" ; do
		case "$option" in
		s)
			MAXSIZE=$OPTARG
			;;
		q)
			QUALITY=$OPTARG
			;;
		V)
			echo "$0 version $VERSION by $AUTHOR"
			exit 1
			;;
		h|*)
			echo -e "\nUsage: make_thumb [options] [ file1 file2 ... ]"
			echo -e "Options:\n"\
			        " -s MAXSIZE  the size of the thumbnail to be created\n"\
			        " -q QUALITY  the quality of the JPEG image created\n"\
				    " -V          print version and exit\n"\
				    " -h          print this help and exit\n"
			exit 1
			;;
		esac
	done
}

function make_thumb()
{
	[ ! -z "$1" ] || exit 1
	FILE="$1"

	# Test if file is readable
	if ! [ -r "$FILE" ] ; then
		echo "ERROR in $0: $FILE is not readable."
		exit 1
	fi
	THUMBFILE="$FILE.thumb"
	EXTENSION="`echo \"$FILE\" | sed 's/.*\.\([^.]*\)$/\1/'`"

	# we need this extension in order to instruct 'convert'
	# will be renamed at the end of the job
	JPEGFILE="$THUMBFILE.jpg"
	ROTATE=""

	# PDF needs special handling
	if [[ `file $FILE | grep "PDF document"` ]] ||
	   [[ `file $FILE | grep "PostScript document"` ]]
	then
	    # look if we should rotate
		DEG=`head -200 $FILE | strings | grep "/Rotate " | head -1 | sed -e 's#.*/Rotate \([0-9]\+\).*#\1#'`
		[ ! -z "$DEG" ] && ROTATE="-rotate $DEG"
		# Extract first page and convert: PDF -> PS -> JPEG (needs 'gs' and 'convert')
		gs -q -dNOPAUSE -dBATCH -r75 -dLastPage=1 -sDEVICE=jpeg -sOutputFile=\|cat "$FILE" | \
		convert - $ROTATE -size ${MAXSIZE}x${MAXSIZE} -resize ${MAXSIZE}x${MAXSIZE} -quality $QUALITY +profile "*" "$JPEGFILE" &&
		mv "$JPEGFILE" "$THUMBFILE" &

	# Else it must be one of the following: postscript, JPEG, GIF, TIFF, RS
	elif [[ `file $FILE | grep "\(JPEG\|GIF\|PNG\|TIFF\) image data"` ]] ||
		 [[ "$EXTENSION" == "rs" ]]   || [[ "$EXTENSION" == "RS" ]]
	then
		convert -size ${MAXSIZE}x${MAXSIZE} "$FILE" -resize ${MAXSIZE}x${MAXSIZE} -quality $QUALITY +profile "*" "$JPEGFILE" &&
		mv "$JPEGFILE" "$THUMBFILE" &
	fi
}


AUTHOR="Emiliano 'AlberT' Gabrielli"
VERSION="0.2.0"
MAXSIZE=600   # default value
QUALITY=70    # default value

parse_cmdline $@
shift `expr $OPTIND - 1`

for file in "$@" ; do
	make_thumb $file
done

# vim:ai:ts=4:sw=4:
  14   Fri Jul 8 17:34:02 2005 Emiliano GabrielliAlberT@SuperAlberT.itScriptJavaScript list auto-refreshStableTue Jul 12 12:36:16 2005 by Emiliano Gabrielli
Here is a simple piece of JS code to accomplish a smart page reload.
We don't reload if in some kind of editing mode.

You can put the code everywhere you like in the elog html page, my suggestion is to put it in Bottom Text (or Top Text):

;auto-refresh
Bottom text = [I]<script language="JavaScript">if (null==window.location.href.match('/[0-9]+$|.*(cmd|select)=.*') ) { window.setTimeout("location.reload();", 2*60*1000); now=new Date(); document.write('<br/>Last reload at '+now.getFullYear()+'/'+(now.getMonth()+1)+'/'+now.getDate()+', '+( ((h=now.getHours())<10) ? '0'+h :h)+':'+( ((m=now.getMinutes())<10) ? '0'+m :m)+':'+( ((s=now.getSeconds())<10) ? '0'+s :s)) }</script>[/I]


the timer is a product of # of minutes, #of seconds and milliseconds... 2 minutes in the above example Smile



Revision Tue Jul 12 12:36:16 2005 wrote:

modified regular expression in order to not activate the auto-refresh in the signle entry view
ELOG V3.1.5-2eba886