From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-devel@lists.openembedded.org
Subject: Re: [PATCH][meta-networking] systemd.bbclass: delete dangling symblink
Date: Wed, 8 Jul 2015 12:43:28 +0200 [thread overview]
Message-ID: <20150708104328.GD2398@jama> (raw)
In-Reply-To: <1436325795-22322-1-git-send-email-jian.liu@windriver.com>
[-- Attachment #1: Type: text/plain, Size: 2729 bytes --]
On Wed, Jul 08, 2015 at 11:23:15AM +0800, Jian Liu wrote:
> If only systemd is enabled, scripts of sysvinit under "/etc/init.d/"
> will be deleted. But there may be some symblinks /etc/rc*/ that
> points to the files under "/etc/init.d/". We need to delete them.
Wrong ML
> Signed-off-by: Jian Liu <jian.liu@windriver.com>
> ---
> meta/classes/systemd.bbclass | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
> index c34884b..ff3e0f8 100644
> --- a/meta/classes/systemd.bbclass
> +++ b/meta/classes/systemd.bbclass
> @@ -184,6 +184,31 @@ do_install[postfuncs] += "rm_systemd_unitdir "
> python rm_sysvinit_initddir (){
> import shutil
> sysv_initddir = oe.path.join(d.getVar("D", True), (d.getVar('INIT_D_DIR', True) or "/etc/init.d"))
> + sysv_rcdirs = []
> + cpath = oe.cachedpath.CachedPath()
> +
> + def check_dangling_sym(file,inst_root):
> + if not cpath.islink(file):
> + return False
> +
> + rtarget = cpath.realpath(file, inst_root, True, assume_dir = True)
> + if not cpath.lexists(rtarget):
> + return True
> +
> + return False
> +
> + # delete dangling symblink under rc*
> + def rm_sysv_rcdirs():
> + dest = d.getVar("D", True)
> + rcdirs = "rc.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rcS.d"
> +
> + for rcdir in rcdirs.split():
> + path = dest + "/etc/" + rcdir
> + for walk_root, walk_dirs, walk_files in cpath.walk(path):
> + for file in walk_files:
> + file = walk_root + "/" + file
> + if check_dangling_sym(file, walk_root):
> + sysv_rcdirs.append(file)
>
> if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \
> not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \
> @@ -193,5 +218,9 @@ python rm_sysvinit_initddir (){
> # If systemd_unitdir contains anything, delete sysv_initddir
> if (os.path.exists(systemd_unitdir) and os.listdir(systemd_unitdir)):
> shutil.rmtree(sysv_initddir)
> +
> + rm_sysv_rcdirs()
> + for rcdir in sysv_rcdirs:
> + os.remove(rcdir)
> }
> do_install[postfuncs] += "rm_sysvinit_initddir "
> --
> 1.8.5.2.233.g932f7e4
>
> --
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-devel
--
Martin 'JaMa' Jansa jabber: Martin.Jansa@gmail.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]
prev parent reply other threads:[~2015-07-08 10:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-08 3:23 [PATCH][meta-networking] systemd.bbclass: delete dangling symblink Jian Liu
2015-07-08 10:43 ` Martin Jansa [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150708104328.GD2398@jama \
--to=martin.jansa@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.