Mailinglist Archive: opensuse-buildservice (312 mails)

< Previous Next >
[opensuse-buildservice] Need help to build package - ramlog
  • From: <doiggl@xxxxxxxxxxxxxxxxxx>
  • Date: Mon, 20 Jul 2009 18:21:58 +1000
  • Message-id: <6a683c4f3658f9a403acc96600cc829f@xxxxxxxxxxxxxxxxxxxxxxx>
I would like to build the following application in opensuse build service
(against factory repo both 32 and 64 bit) and I need step by step guide to
setup, compile and build the rpms in the build service .

So far I have got some details.
- Details of the project >

- An account on opensuse build service on which to build it.

- Rpm source code
(I don't know which one to use out of these to use for the build
> or
> or

- Changelog details >

- Contents of the spec file gotten from source (see below)

#rpm -qlp ramlog-1.1.0-1.src.rpm

# rpm -ivhU ramlog-1.1.0-1.src.rpm
1:ramlog warning: user jandrejkovic does not exist -
using root
warning: group jandrejkovic does not exist
warning: user jandrejkovic does not exist
warning: group jandrejkovic does not exist

# ramlog.spec contents
# cat /usr/src/packages/SPECS/ramlog.spec

Summary: ramlog daemon places /var/log into ramdisk on startup and copies
it back to harddisk on shutdown
Name: ramlog

Version: 1.1.0

Release: 1

License: GPL v3

Group: System Environment/Daemons

Source: %{name}-%{version}-%{release}.tar.gz

#Source0: %{name}-%{version}-%{release}.tar.gz

#Source1: ramlog.8.gz

#Source2: ramlog.cron

#Source3: %{name}-%{version}-%{release}

##Patch: ramlog1.0.0.patch

BuildRoot: /var/tmp/%{name}-buildroot

Requires: coreutils, e2fsprogs, util-linux, gawk, lsof, grep, chkconfig

Packager: Jan Andrejkovic

BuildArch: noarch

ramlog act as system daemon. On startup it creates ramdisk, it copies
files from /var/log into ramdisk and mounts ramdisk as /var/log.
All logs after that will be updated on ramdisk.
On shutdown it saves log files back to harddisk so logs are consistent.
If you restart the service, ramlog saves content of ramdisk do harddisk,
so logs are not lost in case of power outage or kernel panic.

Install ramlog if you have enough of free memory and you want to keep your
on ramdisk. It is good for notebook users, for systems with UPS or for
running from flash - to save some write cycles.

[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT
mkdir -p -m 755 $RPM_BUILD_ROOT/etc/rc.d/init.d
mkdir -p -m 755 $RPM_BUILD_ROOT/usr/share/man/man8/
mkdir -p -m 755 $RPM_BUILD_ROOT/etc/cron.daily
install -m 644 ramlog.8.gz $RPM_BUILD_ROOT/usr/share/man/man8/ramlog.8.gz
install -m 755 ramlog.cron $RPM_BUILD_ROOT/etc/cron.daily/ramlog
install -m 755 %{name}-%{version}-%{release}
[ $? -ne 0 ] && (echo Error: ramlog was not installed successfully; exit 1)

#Below check is not needed if the same version of ramlog is beeing
installed, however if new version is installed
#it is always better to uninstall properly first, otherwise if new feature
is introduced, uninstall may not work properly
if [ -f /var/tmp/ramlog_uninstall_flag_file ]; then

echo ramlog was not completely uninstalled, you have to restart the
system first\!
exit 1


#[ -f /var/tmp/ramlog_uninstall_flag_file ] && rm -f
exit 0

logsize=`du -c /var/log | tail -1 | awk {'print $1'}`
logsizemax=$(($logsize+$logsize/100*35)) #add 35%
logsizemax=$(($logsizemax/1000*1000+1000)) #round to megabytes
memtotal=`cat /proc/meminfo | grep MemTotal: | awk '{print $2}'`
#My formula: (Total memory - (logsize + 35%)) > 256 M
[ $memleft -lt 256000 ] && { echo Error: Not enough memory - Total memory
is $memtotal kbytes, logsize is $logsize kbytes; exit 1; }
if [ -f /sbin/new-kernel-pkg ]; then

if [ `/sbin/new-kernel-pkg --help 2>&1 | grep -e --update | wc -l`
-eq 1 ]; then
/sbin/new-kernel-pkg --kernel-args=ramdisk_size=$logsizemax
--update `uname -r`

/sbin/new-kernel-pkg --kernel-args=ramdisk_size=$logsizemax
--install `uname -r`

echo "ramlog: Warning: You have to add kernel parameter
ramdisk_size manually. Estimated value is $memleft, so you add
\"ramdisk_size=$memleft\" as a kernel paramter to your boot manager
configuration file - such as grub.conf or lilo.conf"


#/bin/sed -i -e "s/^RAMDISKSIZE=[0-9][0-9]*/RAMDISKSIZE=${logsizemax}/g"

/sbin/chkconfig --add %{name}
/sbin/chkconfig %{name} on

cp /etc/rc.d/init.d/ramlog /etc/rc.d/init.d/ramlog.uninst

if [ -f /sbin/new-kernel-pkg ]; then
/sbin/new-kernel-pkg --remove-args=ramdisk_size --update `uname -r`
echo "ramlog: Warning: You have to remove/update kernel parameter
ramdisk_size in your grub.conf or lilo.conf manually."

mv /etc/rc.d/init.d/ramlog.uninst /etc/rc.d/init.d/ramlog

/sbin/chkconfig --add %{name}

/sbin/chkconfig %{name} on

/sbin/service %{name} uninstall

[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT



* Sun Jun 08 2008 Jan Andrejkovic <jandrejkovic@xxxxxxxxx>
- version 1.1.0 released:
- added support for Ubuntu
- added support for SELinux - now ramlog saves security context
of all files in /var/log
- logs are saved to HDD even if stop is not successful
- added logging feature
- created .deb package for Ubuntu
- fixed some bugs

* Wed Jan 13 2008 Jan Andrejkovic <jandrejkovic@xxxxxxxxx>
- first version 1.0.0 released
- created .rpm package

To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >