From f694021f761d6ebcc0e7093dd2bd040f5db2a8a7 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Thu, 7 Oct 2021 09:44:32 -0400 Subject: [PATCH] common/environment/setup: properly handle symlinks in vsv --- common/environment/setup/install.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/common/environment/setup/install.sh b/common/environment/setup/install.sh index a6b68435eb..5f0571de14 100644 --- a/common/environment/setup/install.sh +++ b/common/environment/setup/install.sh @@ -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: \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 }