Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 376da712fa262d26887fb3b8ab59cc0c > files > 13

plusd-1.2.3-2mdk.src.rpm

%define name	plusd
%define version	1.2.3
%define release	2mdk

Summary:	BananaPOS bhpos plu server daemon.
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	GPL
Group:		System/Servers
URL:		http://www.bananahead.com
Source0:	%{name}-%{version}.tar.bz2
Source1:	db.tar.bz2
Source2:	plusd.conf.bz2
Source3:	plusd.init.bz2
Source4:	plucacheall_mysql.pl.bz2
Source5:	reconcile_stock_mysql.pl.bz2
Source6:	scripts.tar.gz
Source7:	keystrokes_short.sxw.bz2
Source8:	keystrokes.sxw.bz2
Source9:	usermanual.sxw.bz2
Source100:	fix_files.sh.bz2
Source101:	fix_db_embed_changes.txt.bz2
Source102:	fix_db_changes.txt.bz2
Patch0:		plusd-1.2.3-mdk_conf.diff.bz2
Patch1:		plusd-1.2.3-plusd_user.diff.bz2
PreReq:		rpm-helper
Requires:	bhposbase >= 1.2.3
Requires:	MySQL
#Requires:	perl-DBD-mysql
#Requires:	perl-DBI
BuildRequires:	bhposbase-devel >= 1.2.3
BuildRequires:	bhposcommonlibs-devel >= 1.4.0
BuildRequires:	bhposserverlibs-devel >= 1.6.0
BuildRequires:	pkgconfig
BuildRequires:	gcc3.3
BuildRequires:	gcc3.3-c++
BuildRequires:	MySQL-devel
BuildRoot:	%{_tmppath}/%{name}-%{version}

%description
BananaPOS is a point of sale system aimed at the Linux operating
system. This package contains the BananaPOS server dameon.

%package	devel
Summary:	Development files for plusd.
Group:		Development/C
Requires:	libtool >= 1.5
Requires:	bhposbase-devel >= 1.2.3
Requires:	bhposcommonlibs-devel >= 1.4.0
Requires:	bhposserverlibs-devel >= 1.6.0

%description	devel
The plusd devel package contains headers required for developing
server plug-ins.

%prep

%setup -q -n %{name}-%{version} -a1
%patch0 -p0
%patch1 -p0

bzcat %{SOURCE2} > plusd.conf
bzcat %{SOURCE3} > plusd.init
bzcat %{SOURCE4} > plucacheall_mysql.pl
bzcat %{SOURCE5} > reconcile_stock_mysql.pl
cp %{SOURCE6} .
bzcat %{SOURCE7} > keystrokes_short.sxw
bzcat %{SOURCE8} > keystrokes.sxw
bzcat %{SOURCE9} > usermanual.sxw

# fix install
perl -pi -e "s|^SUBDIRS.*|SUBDIRS = src|g" Makefile*

# dynamic "patch" system by Kort E Patterson
bzcat %{SOURCE100} > fix_files.sh
bzcat %{SOURCE101} > fix_db_embed_changes.txt
bzcat %{SOURCE102} > fix_db_changes.txt
chmod 755 fix_files.sh

cp ./db/accounts-US.mysql accounts-US.sql
cp ./db/dbdump_v1.2.3.mysql dbdump_v1.2.3.sql
cp ./db/dbdata.mysql dbdata_v1.2.3.sql

echo "A *.cpp ./fix_db_embed_changes.txt ." > files_to_fix
echo "A *.h ./fix_db_embed_changes.txt ." >> files_to_fix
echo "A ./accounts-US.sql ./fix_db_changes.txt ./" >> files_to_fix
echo "A ./dbdump_v1.2.3.sql ./fix_db_changes.txt ./" >> files_to_fix
./fix_files.sh ./files_to_fix

cat ./dbdump_v1.2.3.sql | sed "s/DB DEFAULT CHARSET/DB CHARSET/g" > ./dbdump_v1.2.3.sql.tmp-sed
cat ./dbdata_v1.2.3.sql | sed -e /"INSERT INTO taxrate VALUES (1, 1"/d > ./dbdata_v1.2.3.sql.tmp-sed

mv ./dbdump_v1.2.3.sql.tmp-sed ./dbdump_v1.2.3.sql
mv ./dbdata_v1.2.3.sql.tmp-sed ./dbdata_v1.2.3.sql

%build
export CCC=gcc-3.3.4
export CXX=g++-3.3.4

%configure2_5x

%make

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

# don't fiddle with the initscript!
export DONT_GPRINTIFY=1

install -d %{buildroot}%{_initrddir}
install -d %{buildroot}/var/run/plusd
install -d %{buildroot}/var/log/plusd
install -d %{buildroot}%{_datadir}/bhpos/scripts
install -d %{buildroot}%{_libdir}/bhpos/modules

%makeinstall_std

install -m0755 plusd.init %{buildroot}%{_initrddir}/plusd
install -m0644 plusd.conf %{buildroot}%{_sysconfdir}/plusd.conf

install -m0755 plucacheall_mysql.pl %{buildroot}%{_datadir}/bhpos/scripts/plucacheall.pl
install -m0755 reconcile_stock_mysql.pl %{buildroot}%{_datadir}/bhpos/scripts/reconcile_stock.pl


cat > README.MDK << EOF
B a n a n a P O S
-----------------

There exist very little documentation for BananaPOS. Live with it.

Please visit the online forum at: http://bananahead.com/pos/forum.html

I found this thread somewhat useful:

http://bananahead.com/pos/forum/index.php?t=msg&th=80&start=0&rid=0&S=78b41790d47a40e0b7eb9688f3fc84e1

Install the database like this:

mysql -u root -p < %{_docdir}/%{name}-%{version}/dbdump_v1.2.3.sql
mysql -u root -p < %{_docdir}/%{name}-%{version}/dbdata_v1.2.3.sql
mysql -u root -p < %{_docdir}/%{name}-%{version}/accounts-US.sql

I have to recite the words of Kort E Patterson here:

"you must now log into mysql and enter the following commands
to set database permissions, and identify host and at least one
client terminal by their MAC addresses.  The following assumes
both host and client are on the same machine/MAC address.

Substitute the actual MAC addresses of your hardware for the hex
strings in the following examples that start with 00045A...

Note: the following commands grant access from any ip address

mysql -u root -p

>grant all on bananas.* to banana@"%" identified by "banana";
>use bananas
>update posts set mac="00045A7DFE19" where ID=1;
>update posts set mac="00045A7DFE19" where ID=2;
>select * from posts;
(should display id records with MAC addresses)"

Good luck!

Regards // Oden Eriksson
EOF

%pre
%_pre_useradd plusd /var/log/plusd /bin/sh

%post
%_post_service plusd

%preun
%_preun_service plusd

%postun
%_postun_userdel plusd

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc ChangeLog NEWS README README.MDK
%doc dbdump_v1.2.3.sql dbdata_v1.2.3.sql accounts-US.sql
%doc keystrokes_short.sxw keystrokes.sxw usermanual.sxw
%attr(0755,root,root) %config(noreplace) %{_initrddir}/plusd
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/plusd.conf
%attr(0755,root,root) %{_sbindir}/plusd
%attr(0755,root,root) %{_datadir}/bhpos/scripts/*.pl
%attr(0755,plusd,plusd) %dir /var/run/plusd
%attr(0755,plusd,plusd) %dir /var/log/plusd
%attr(0755,root,root) %dir %{_libdir}/bhpos/modules

%files devel
%defattr(-, root, root)  
%doc db scripts.tar.gz
%{_libdir}/pkgconfig/plusd.pc
%{_includedir}/bhpos/plus/*.h

%changelog
* Mon Jan 24 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 1.2.3-2mdk
- rebuilt against MySQL-4.1.x system libs

* Fri Oct 15 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 1.2.3-1mdk
- initial mandrake package