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>
Hello,
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 .
Thankyou
Glenn

So far I have got some details.
- Details of the project > http://freshmeat.net/projects/ramlog/
and
http://tofu3.szm.sk/ramlog/

- 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
process)
> http://tofu3.szm.sk/ramlog/1.1.0/rpm/ramlog-1.1.0-1.noarch.rpm
> or http://tofu3.szm.sk/ramlog/1.1.0/rpm/ramlog-1.1.0-1.src.rpm
> or
http://tofu3.szm.sk/ramlog/1.1.0/ramlog-1.1.0-1.tar.gz

- Changelog details > http://tofu3.szm.sk/ramlog/changelog.txt

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

#rpm -qlp ramlog-1.1.0-1.src.rpm
ramlog-1.1.0-1.tar.gz
ramlog.spec

# 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


%description
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
logs
on ramdisk. It is good for notebook users, for systems with UPS or for
systems
running from flash - to save some write cycles.


%install
[ "$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}
$RPM_BUILD_ROOT/etc/rc.d/init.d/ramlog
[ $? -ne 0 ] && (echo Error: ramlog was not installed successfully; exit 1)


%pre
#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

fi

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


%post
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}'`
memleft=$(($memtotal-$logsizemax))
#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`
else

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


else
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"

fi


#/bin/sed -i -e "s/^RAMDISKSIZE=[0-9][0-9]*/RAMDISKSIZE=${logsizemax}/g"
/etc/rc.d/init.d/ramlog

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

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

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

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


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

%files
%defattr(-,root,root)
#%doc README TODO COPYING ChangeLog
%doc README COPYING ChangeLog INSTALL FAQ VERSION

/etc/rc.d/init.d/ramlog
/etc/cron.daily/ramlog
/usr/share/man/man8/ramlog.8.gz

%changelog
* 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 >