preload: simplify log script and use make_dirs
This commit is contained in:
parent
45241f4758
commit
13192fa29c
3 changed files with 9 additions and 58 deletions
55
srcpkgs/preload/files/preload/log/run
Executable file → Normal file
55
srcpkgs/preload/files/preload/log/run
Executable file → Normal file
|
@ -1,55 +1,2 @@
|
|||
#!/bin/sh
|
||||
# Author: TJ Vanderpoel
|
||||
# Licence: MIT
|
||||
# This is a generic 'run' script meant to be linked in a log/ directory
|
||||
# of a runit, daemontools, s6, or similar service.
|
||||
# It requires svlogd available in the path.
|
||||
|
||||
# If the file './conf' exists, it can modify the behavior
|
||||
# of the svlogd in these ways:
|
||||
|
||||
# USERGROUP=user:group (default rsvlog:adm)
|
||||
# SV_LOGDIR=/path/to/log (default `basename $(dirname $PWD)`)
|
||||
# CURRENT_LOG_FILE=filename.log (default 'current')
|
||||
|
||||
set -e
|
||||
if [ $0 != "./run" ];then
|
||||
echo "This script meant to be linked as ./run in a service/log directory only!"
|
||||
exit 1
|
||||
fi
|
||||
curdir=$(basename $(pwd))
|
||||
if [ "$curdir" != "log" ];then
|
||||
echo "This script meant to be run from a service/log directory only!"
|
||||
exit 1
|
||||
fi
|
||||
if [ -f ./conf ];then
|
||||
. ./conf
|
||||
fi
|
||||
if [ "x$SV_LOGDIR" != "x" ];then
|
||||
logdir=$SV_LOGDIR
|
||||
fi
|
||||
if [ -w /var/log ];then
|
||||
user_group=${USERGROUP:-rsvlog:adm}
|
||||
if [ "x$logdir" = "x" ];then
|
||||
logdir=$(basename $(dirname $(pwd)))
|
||||
fi
|
||||
[ -d "/var/log/$logdir" ] || mkdir -p "/var/log/$logdir"
|
||||
[ -L ./main ] || [ -d ./main ] || ln -s "/var/log/$logdir" ./main
|
||||
[ -L ./current ] || ln -s main/current
|
||||
if [ "x$CURRENT_LOG_FILE" != "x" ];then
|
||||
[ -L "/var/log/$logdir/$CURRENT_LOG_FILE" ] || ln -s current "/var/log/$logdir/$CURRENT_LOG_FILE"
|
||||
fi
|
||||
usergroup=$(stat -c "%U:%G" "/var/log/$logdir")
|
||||
if [ "$usergroup" != "$user_group" ];then
|
||||
chown -R $user_group "/var/log/$logdir"
|
||||
fi
|
||||
echo Logging as $user_group to /var/log/$logdir
|
||||
exec chpst -u $user_group svlogd -t ./main
|
||||
else
|
||||
echo Logging in $PWD
|
||||
if [ "x$CURRENT_LOG_FILE" != "x" ];then
|
||||
[ -L "$CURRENT_LOG_FILE" ] || ln -s current "$CURRENT_LOG_FILE"
|
||||
fi
|
||||
exec svlogd -t ./
|
||||
fi
|
||||
|
||||
exec svlogd -t /var/log/preload
|
||||
|
|
0
srcpkgs/preload/files/preload/run
Executable file → Normal file
0
srcpkgs/preload/files/preload/run
Executable file → Normal file
|
@ -1,18 +1,22 @@
|
|||
# Template file for 'preload'
|
||||
pkgname=preload
|
||||
version=0.6.4
|
||||
revision=9
|
||||
revision=10
|
||||
build_style=gnu-configure
|
||||
hostmakedepends="pkg-config"
|
||||
makedepends="libglib-devel"
|
||||
disable_parallel_build=yes
|
||||
conf_files="/etc/preload.conf"
|
||||
short_desc="An adaptive readahead daemon"
|
||||
short_desc="Adaptive readahead daemon"
|
||||
maintainer="bougyman <bougyman@voidlinux.org>"
|
||||
license="GPL-2"
|
||||
homepage="http://sourceforge.net/projects/preload"
|
||||
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
|
||||
checksum=d0a558e83cb29a51d9d96736ef39f4b4e55e43a589ad1aec594a048ca22f816b
|
||||
disable_parallel_build=yes
|
||||
|
||||
conf_files="/etc/preload.conf"
|
||||
|
||||
make_dirs="
|
||||
/var/log/preload 0755 root root"
|
||||
|
||||
post_install() {
|
||||
rm -rf ${DESTDIR}/etc/rc.d
|
||||
|
|
Loading…
Reference in a new issue