Patchwork systemd.bbclass: move disable operation into prerm() script

login
register
mail settings
Submitter Enrico Scholz
Date Nov. 16, 2012, 4:21 p.m.
Message ID <1353082893-16665-1-git-send-email-enrico.scholz@sigma-chemnitz.de>
Download mbox | patch
Permalink /patch/39161/
State Accepted, archived
Commit 38a5cf3fa06972992f473027658d5b0cffff3a33
Headers show

Comments

Enrico Scholz - Nov. 16, 2012, 4:21 p.m.
The 'systemctl disable' operation should not be done in postrm() because
the .service file does not exist anymore and the script will fail hence.

After moving this command into prerm(), postrm() becomes empty and can
be removed completely.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 meta-systemd/classes/systemd.bbclass | 8 --------
 1 file changed, 8 deletions(-)
Otavio Salvador - Nov. 16, 2012, 5:34 p.m.
On Fri, Nov 16, 2012 at 2:21 PM, Enrico Scholz <
enrico.scholz@sigma-chemnitz.de> wrote:

> The 'systemctl disable' operation should not be done in postrm() because
> the .service file does not exist anymore and the script will fail hence.
>
> After moving this command into prerm(), postrm() becomes empty and can
> be removed completely.
>
> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
>

Acked-by: Otavio Salvador <otavio@ossystems.com.br>

Eric, this might be backported to denzil too IMO.

Patch

diff --git a/meta-systemd/classes/systemd.bbclass b/meta-systemd/classes/systemd.bbclass
index f26c6d1..e1916a0 100644
--- a/meta-systemd/classes/systemd.bbclass
+++ b/meta-systemd/classes/systemd.bbclass
@@ -22,9 +22,7 @@  systemd_prerm() {
 if [ -z "$D" ]; then
     systemctl stop ${SYSTEMD_SERVICE}
 fi
-}
 
-systemd_postrm() {
 systemctl disable ${SYSTEMD_SERVICE}
 }
 
@@ -116,12 +114,6 @@  python populate_packages_prepend () {
         prerm += localdata.getVar('systemd_prerm', 1)
         d.setVar('pkg_prerm_%s' % pkg, prerm)
 
-        postrm = localdata.getVar('pkg_postrm', 1)
-        if not postrm:
-            postrm = '#!/bin/sh\n'
-        postrm += localdata.getVar('systemd_postrm', 1)
-        d.setVar('pkg_postrm_%s' % pkg, postrm)
-
     # add files to FILES_*-systemd if existent and not already done
     def systemd_append_file(pkg_systemd, file_append):
         appended = False