common/environment/setup: properly handle symlinks in vsv

This commit is contained in:
Joel Beckmeyer 2021-10-07 09:44:32 -04:00 committed by Leah Neukirchen
parent cae433ca17
commit f694021f76

View file

@ -20,6 +20,7 @@ done
_vsv() {
local service="$1"
local LN_OPTS="-s"
local svdir="${PKGDESTDIR}/etc/sv/${service}"
if [ $# -lt 1 ]; then
msg_red "$pkgver: vsv: 1 argument expected: <service>\n"
@ -32,14 +33,18 @@ _vsv() {
vmkdir etc/sv
vcopy "${FILESDIR}/$service" etc/sv
chmod 755 ${PKGDESTDIR}/etc/sv/${service}/run
if [ -r ${PKGDESTDIR}/etc/sv/${service}/finish ]; then
chmod 755 ${PKGDESTDIR}/etc/sv/${service}/finish
if [ ! -L $svdir/run ]; then
chmod 755 $svdir/run
fi
ln ${LN_OPTS} /run/runit/supervise.${service} ${PKGDESTDIR}/etc/sv/${service}/supervise
if [ -r ${PKGDESTDIR}/etc/sv/${service}/log/run ]; then
chmod 755 ${PKGDESTDIR}/etc/sv/${service}/log/run
ln ${LN_OPTS} /run/runit/supervise.${service}-log ${PKGDESTDIR}/etc/sv/${service}/log/supervise
if [ -e $svdir/finish ] && [ ! -L $svdir/finish ]; then
chmod 755 $svdir/finish
fi
ln ${LN_OPTS} /run/runit/supervise.${service} $svdir/supervise
if [ -d $svdir/log ]; then
ln ${LN_OPTS} /run/runit/supervise.${service}-log $svdir/log/supervise
if [ -e $svdir/log/run ] && [ ! -L $svdir/log/run ]; then
chmod 755 ${PKGDESTDIR}/etc/sv/${service}/log/run
fi
fi
}