ebuild for UTM5

This commit is contained in:
Sergey Popov 2011-10-28 17:13:27 +04:00
parent 02d2a047e3
commit 49d12dad37
9 changed files with 293 additions and 0 deletions

9
net-misc/utm5/Manifest Normal file
View File

@ -0,0 +1,9 @@
AUX ChangeLog 628 RMD160 9d88ec42231f87a5ed918b5b133122ade9740b1d SHA1 13bd25d13b944808215b96a067385f1df5ef0ce3 SHA256 3e3b044a9336a947b8a74cd1370271c4b2c16bb4b25ee2642961527bada87925
AUX metadata.xml 341 RMD160 59b65504557741bbe383ff1ef1918cd2335b8639 SHA1 1b5a55497e996a07034358605e8c30c6b8270e2b SHA256 902fa324bd29d6602d7c57815fd13f50be92b5ba72039f7d0a272f63f4b7436f
AUX utm5_core 1464 RMD160 e418c7aef1cf7866a6c97163afd70d76fd08102c SHA1 a7aadf5f42c12133d106eaa1a17c37baf9b6724e SHA256 cc40f8b63fc3b85b86ebd5a00a5eacdc1902729c5077c87896f63609df09e406
AUX utm5_radius 423 RMD160 2abfbba6d09773ef9bc2a2545b52997897739074 SHA1 be20f3ab10fd160c04ad669f8085a02f6f92bb92 SHA256 b752190f0b7670eef82c5040181fb103a2584e65ce9761de058ba8789458ff4c
AUX utm5_rfw 2024 RMD160 103c023b69c34fb9dc36a85977dab966e517592c SHA1 a15e554be1cca82b73894adcdc7c99a52af7a9df SHA256 c150a4876d9918691df007972f8cbfe32fb1a12c5c67c9f86a520a53079225e2
AUX utm5_rfw.conf 457 RMD160 6bf2d9cd9977f6631c8216149cdbb0fab83eb2db SHA1 c1d0709c6febde513bf40af3c303ecca3e2ba501 SHA256 196ed4f742e41500d6d9db0f55e69dffbf502a682bd1601fa9e107d9d3f69b69
DIST utm5-2.1.008.tar.bz2 8726702 RMD160 96efc2384256bb011d2924ecf05418b2ab8c219d SHA1 55c07457509de1c9fd841febe9cf12f9cf866ed7 SHA256 6d6b6307022c768f90726362d2a70869d19feb797b8d3888817c424afde98b15
EBUILD utm5-2.1.008.ebuild 2732 RMD160 a599f26e75910ea43ea52a1afd3fd549b5de09b6 SHA1 2a89353ccdffb28502d4d23e22b18fdc74dbe114 SHA256 0539e9c21110d5f9e33784646cf71d1b77562e6c1bd2dbcf53f8a229d1fd708f
MISC metadata.xml 0 RMD160 9c1185a5c5e9fc54612808977ee8f548b2258d31 SHA1 da39a3ee5e6b4b0d3255bfef95601890afd80709 SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

View File

@ -0,0 +1,17 @@
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
*utm5-1.10.009 (07 Mar 2005)
07 Mar 2005; Peter Volkov <pvolkov@mics.msu.su> utm5-1.10.009.ebuild:
The begining.
Added initial ChangeLog which should be updated whenever the package is
updated in any way. This changelog is targetted to users. This means that
the comments should well explained and written in clean English. The
details about writing correct changelogs are explained in the
skel.ChangeLog file which you can find in the root directory of the
portage repository.

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>no-herd</herd>
<maintainer>
<email>info@netup.ru</email>
<description>NetUP Inc</description>
</maintainer>
<longdescription>UTM5 billing system, see www.netup.ru for details.</longdescription>
</pkgmetadata>

51
net-misc/utm5/files/utm5_core Executable file
View File

@ -0,0 +1,51 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
check_db_is_running() {
if ! `/etc/init.d/mysql status 2>/dev/null | grep "started" > /dev/null 2>&1 ` ; then
if ! `/etc/init.d/postgresql status 2>/dev/null | grep "started" > /dev/null 2>&1` ; then
ewarn "You have not started neither mysql nor postgresql!"
eerror "Please start anything."
return 1
fi
fi
}
depend() {
after mysql postgresql
}
start() {
check_db_is_running || return 1
ebegin "Starting utm5_core"
start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/safe_utm5_core.pid \
--background --exec /netup/utm5/bin/safe_utm5_core -- start
eend $?
}
stop() {
ebegin "Stopping safe_utm5_core"
start-stop-daemon --stop --quiet --signal 9 --pidfile /var/run/safe_utm5_core.pid
eend $?
ebegin "Stopping utm5_core"
killall -s USR1 utm5_core
# Now we need to check that the processes are really stoped.
for i in 1 2 3 4 5 ; do
sleep 2
my_status=`ps aux | grep -v "grep utm5_core" | grep -v "stop" | grep utm5_core >/dev/null 2>&1; echo $?`
if [ "$my_status" = "1" ] ;then
echo -n "All process dead..."
break;
fi
done
my_status=`ps aux | grep -v "grep utm5_core" | grep -v "stop" | grep utm5_core >/dev/null 2>&1; echo $?`
if [ $my_status = "0" ] ; then
echo -n "Wated for 10 sec and no result... Killing!"
killall -9 utm5_core
fi
eend 0
}

16
net-misc/utm5/files/utm5_radius Executable file
View File

@ -0,0 +1,16 @@
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
start() {
ebegin "Starting utm5_radius"
start-stop-daemon --start --quiet --background --exec /netup/utm5/bin/safe_utm5_radius -- start
eend $?
}
stop() {
ebegin "Stopping utm5_radius"
start-stop-daemon --start --quiet --exec /netup/utm5/bin/safe_utm5_radius -- stop
eend $?
}

74
net-misc/utm5/files/utm5_rfw Executable file
View File

@ -0,0 +1,74 @@
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
checkconfig() {
if [ ! -f /etc/conf.d/utm5_rfw.conf ] ; then
eerror "You will need an /etc/conf.d/utm5_rfw.conf."
return 1
fi
. /etc/conf.d/utm5_rfw.conf
# Checking for valid shell for supplied user.
SHELL=`grep ^$USERNAME: /etc/passwd | awk -F : '{print $7}'`
if [ -z "$SHELL" ] ; then
eerror "Supply user with valid shell in /etc/conf.d/utm5_rfw.conf."
return 1
fi
# This is durty and assumes that shell is in /bin directory. But in most cases this is true.
shell_exist=false
rm -f /tmp/tmp.shells ; grep "^/bin/" /etc/shells > /tmp/tmp.shells
while read shell
do
if [ "$shell" = "$SHELL" ] ; then
shell_exist=true
fi
done < /tmp/tmp.shells
if [ "$shell_exist" = "false" ] ; then
eerror "Supply user with a valid shell in /etc/conf.d/utm5_rfw.conf."
return 1
fi
if [ "$shell_exist" = "true" ] ; then
return 0
fi
eerror Init script error? Please submit a report at support@netup.ru.
}
start() {
checkconfig || return 1
ebegin "Starting utm5_rfw"
. /etc/conf.d/utm5_rfw.conf
if [ -z "$GROUPNAME" ] ; then
GROUPID=`grep ^$USERNAME: /etc/passwd | awk -F : '{print $4}'`
GROUPNAME=`grep :$GROUPID: /etc/group | awk -F : '{print $1}'`
fi
LOG_FILENAME=`grep "log_file_main" /etc/utm5/rfw5.cfg | grep "=" | awk -F= '{print $2}'`
if [ ! -f $LOG_FILENAME ] ; then
mkdir -p `dirname $LOG_FILENAME`
touch $LOG_FILENAME
chown $USERNAME:$GROUPNAME $LOG_FILENAME
fi
# Checking the possibility to write in log file.
if ! `/bin/su $USERNAME -c "/bin/echo \">>>\" \`date\` Starting utm5_rfw. >> $LOG_FILENAME"`
then
eerror "Can not write into $LOG_FILENAME. Please check permitions."
fi
/bin/su $USERNAME -c "/netup/utm5/bin/utm5_rfw $ARGS -c /etc/utm5/rfw5.cfg >> $LOG_FILENAME 2>&1 &"
eend $?
}
stop() {
ebegin "Stopping utm5_rfw"
killall -s 9 utm5_rfw
eend $?
}

View File

@ -0,0 +1,13 @@
# This is configuration file for /etc/init.d/utm5_rfw.
# Username we should start service from. If you do not know what to do just issue the commands:
# groupadd rfw
# useradd -g rfw rfw
USERNAME="rfw"
# Name of group, log file will be owned by. If not specified, will be primary group for rfw user.
# GROUPNAME="users"
# You may add here additional parameters.
# For example -f will issue rules for Connected users with the start of utm5_rfw.
ARGS="-f"

View File

View File

@ -0,0 +1,103 @@
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
DESCRIPTION="NetUP UTM - universal billing system for Internet Service Providers."
HOMEPAGE="www.netup.ru"
SRC_URI="${P}.tar.bz2"
LICENSE="NETUP"
SLOT="0"
KEYWORDS="x86"
IUSE=""
RESTRICT="fetch nostrip"
RDEPEND="virtual/libc
dev-libs/openssl
sys-libs/zlib
dev-libs/libxslt
|| ( dev-db/mysql
dev-db/postgresql )"
pkg_nofetch() {
einfo "Please download ${A} from:"
einfo "http://www.netup.ru/"
einfo "and move it to ${DISTDIR}"
}
PREVIOUS_INSTALLED="${T}/previous_installed"
pkg_setup() {
for process in utm5_radius utm5_rfw utm5_core
do
if `ps aux | grep -v "grep ${process}" | grep ${process} >/dev/null 2>&1` ; then
ewarn "You did not stop ${process}."
ewarn "Please stop all process with ${process} in"
ewarn "their names and then try again."
die "Processes are not stoped."
fi
done
echo "false" > ${PREVIOUS_INSTALLED}
if [ -x /netup/utm5/bin/utm5_core ] ; then
einfo "Previous installation found."
echo "true" > ${PREVIOUS_INSTALLED}
fi
}
src_install() {
cd ${WORKDIR}
cp -a usr ${D} || die "install failed"
dodir /etc/utm5
dodir /netup/utm5
keepdir /netup/utm5/backup
keepdir /netup/utm5/db
keepdir /netup/utm5/log
keepdir /netup/utm5/templates
for conf in utm5.cfg radius5.cfg rfw5.cfg web5.cfg
do
if [ -x netup/utm5/${conf} ] ; then
chmod ugo-x netup/utm5/${conf}
fi
mv netup/utm5/${conf} ${D}/etc/utm5/
dosym /etc/utm5/${conf} /netup/utm5/${conf}
done
cp -a netup ${D}
doinitd ${FILESDIR}/utm5_core ${FILESDIR}/utm5_radius ${FILESDIR}/utm5_rfw
doconfd ${FILESDIR}/utm5_rfw.conf
}
pkg_postinst() {
echo
if [ "`cat $PREVIOUS_INSTALLED`" = "false" ] ; then
einfo "If this is your first instalation of utm5 please run:"
einfo "mysqladmin create UTM5"
einfo "mysql UTM5 < /netup/utm5/UTM5_MYSQL.sql"
einfo "mysql UTM5 < your_reg_file.sql"
einfo "to initialise mysql database. Or"
einfo "createdb -U postgres UTM5"
einfo "psql UTM5 < /netup/utm5/UTM5_MYSQL.sql"
einfo "psql UTM5 < your_reg_file.sql"
einfo "to initialise postgresql database."
else
einfo "Now, please, update your database with command"
einfo "mysql -f UTM5 < /netup/utm5/UTM5_MYSQL_update.sql"
einfo "if you are using mysql database or"
einfo "psql -f /netup/utm5/UTM5_PG_update.sql UTM5"
einfo "if you are using postgresql."
einfo ""
einfo "Please note. You need to update your UTM5_Admin.jar also."
fi
echo
einfo "To start utm5_core automaticaly during booting you need to run:"
einfo "rc-update add utm5_core default"
echo
ewarn "Note: Configuration files are in /etc/utm5."
echo
einfo "Thank you for choosing utm5."
}