# Tanım: Apache Cassandra NoSQL veritabanı
# URL: http://cassandra.apache.org/
# Paketçi: milisarge
# Gerekler: gnupg openjdk 
# Grup: geliştirme

isim=cassandra
surum=3.11.3
devir=1
kaynak=(https://www.apache.org/dist/cassandra/3.11.3/apache-cassandra-3.11.3-bin.tar.gz
		01_fix_cassandra_home_path.patch
		cassandra-tmpfile.conf
		cassandra-user.conf)

derle() {
	cd ${SRC}/apache-cassandra-${surum}
	patch -p0 < ${SRC}/01_fix_cassandra_home_path.patch
	mkdir -p ${PKG}/{etc/cassandra,var/log/cassandra}
	mkdir -p ${PKG}/{usr/bin,usr/share/cassandra,usr/share/java/cassandra}
	cp -a interface pylib tools ${PKG}/usr/share/cassandra/
	mkdir -p ${PKG}/usr/share/cassandra/bin/
	for f in bin/*; do
	if [[ ! "${f}" == *.bat && ! "${f}" == *.ps1 && -x ${f} ]]; then
	  cp -a ${f} ${PKG}/usr/share/cassandra/bin/
	  ln -s /usr/share/cassandra/${f} ${PKG}/usr/${f}
	fi
	done
	unlink ${PKG}/usr/bin/cqlsh.py
	cp -a bin/cassandra.in.sh ${PKG}/usr/share/cassandra/
	cp -a lib/* ${PKG}/usr/share/java/cassandra/
	ln -s ../java/cassandra ${PKG}/usr/share/cassandra/lib
	cp -a conf/* ${PKG}/etc/cassandra/
	rm  ${PKG}/etc/cassandra/*.ps1
	ln -s /etc/cassandra ${PKG}/usr/share/cassandra/conf
	install -Dm644 ${SRC}/cassandra-tmpfile.conf ${PKG}/usr/lib/tmpfiles.d/cassandra.conf
	install -Dm644 ${SRC}/cassandra-user.conf ${PKG}/usr/lib/sysusers.d/cassandra.conf
}
