Skip to contentSkip to conversation

recipes-connectivity/samba: Only rmdir directories that exist

PATCH In review Mike Looijmans 2 participants 6 messages Jan 11, 2016 – Jan 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 recipes-connectivity/samba: Only rmdir directories that exist

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created. Make the do_install_append handle both situations by checking whether these directories exist before attempting to remove them.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
 meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +6 -2
index a51d31f..8e89e49 100644
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \
 LDFLAGS += "-Wl,-z,relro,-z,now"
 
 do_install_append() {
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi
 
     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_unitdir}/system
Signature · 1 line
2.1.4
#1 lore raw
Quoted 24 lines · Mike Looijmans

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created. Make the do_install_append handle both situations by checking whether these directories exist before attempting to remove them.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--

1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +0 -0
index a51d31f..8e89e49 100644
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \

LDFLAGS += "-Wl,-z,relro,-z,now"

do_install_append() {

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb EXTRA_OECONF += "--enable-fhs \ · line 112

Quoted 8 lines
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +6 -2
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi

why don’t we delete /run completely ? it won’t work if package contents are in there anyway

Quoted 11 lines
    if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
        install -d ${D}${systemd_unitdir}/system

--
2.1.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#2 lore raw
Quoted 23 lines · Khem Raj
Quoted 23 lines · Mike Looijmans

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created. Make the do_install_append handle both situations by checking whether these directories exist before attempting to remove them.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--

1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +0 -0
index a51d31f..8e89e49 100644
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \

LDFLAGS += "-Wl,-z,relro,-z,now"

Quoted 12 lines

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb EXTRA_OECONF += "--enable-fhs \ · line 112

Quoted 9 lines

do_install_append() {

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +6 -2
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi

why don’t we delete /run completely ? it won’t work if package contents are in there anyway

That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace the non-functional startup script, but that's distro specific), but I thought that it might serve some purpose for the one who wrote the recipe.

/run is usually volatile, so putting files in there is pointless, right?

#3 lore raw
Quoted 40 lines · Mike Looijmans
Quoted 23 lines · Khem Raj
Quoted 23 lines · Mike Looijmans

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created. Make the do_install_append handle both situations by checking whether these directories exist before attempting to remove them.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--

1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +0 -0
index a51d31f..8e89e49 100644
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \

LDFLAGS += "-Wl,-z,relro,-z,now"

Quoted 12 lines

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb EXTRA_OECONF += "--enable-fhs \ · line 112

Quoted 9 lines

do_install_append() {

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +6 -2
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi

why don’t we delete /run completely ? it won’t work if package contents are in there anyway

Quoted 3 lines

That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace the non-functional startup script, but that's distro specific), but I thought that it might serve some purpose for the one who wrote the recipe.

/run is usually volatile, so putting files in there is pointless, right?

yes although, you should add code to generate those files during post_inst

Quoted 5 lines

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#4 lore raw
Quoted 40 lines · Khem Raj
Quoted 40 lines · Mike Looijmans
Quoted 35 lines · Khem Raj
Quoted 24 lines · Mike Looijmans

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created. Make the do_install_append handle both situations by checking whether these directories exist before attempting to remove them.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 8 ++++++--

1 file changed, 6 insertions(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +0 -0
index a51d31f..8e89e49 100644
@@ -104,8 +104,12 @@ EXTRA_OECONF += "--enable-fhs \

LDFLAGS += "-Wl,-z,relro,-z,now"

do_install_append() {

meta-networking/recipes-connectivity/samba/samba_4.1.12.bb EXTRA_OECONF += "--enable-fhs \ · line 112

Quoted 8 lines
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +6 -2
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    if [ -d "${D}/run" ]; then
+        if [ -d "${D}/run/samba" ]; then
+            rmdir --ignore-fail-on-non-empty "${D}/run/samba"
+        fi
+        rmdir --ignore-fail-on-non-empty "${D}/run"
+    fi

why don’t we delete /run completely ? it won’t work if package contents are in there anyway

Quoted 5 lines
Quoted 3 lines

That's what I do in a bbappend, just "rm -rf ${D}/run" (and also replace the non-functional startup script, but that's distro specific), but I thought that it might serve some purpose for the one who wrote the recipe.

/run is usually volatile, so putting files in there is pointless, right?

yes although, you should add code to generate those files during post_inst

That wouldn't work, they'll be gone when the system boots. Only way to create files there would be to use the 'volatiles' system.

Just removing /run with "rm -rf ${D}/run" will work just fine. The code above will generate a QA warning if something gets installed into /run.

Just let me know which you prefer, I'll send a v2 patch.

#5 lore raw

PATCH v2 1/1 recipes-connectivity/samba: Remove /run directory tree

In reply to Khem Raj

Depending on PACKAGECONFIG selection, the /run/samba directory may not have been created, causing build errors.

Since the /run directory is volatile on target, anything installed there will vanish anyway, so just remove the /run tree if it exists.

This fixes do_install failing with an error like this:
rmdir: failed to remove '/.../samba/4.1.12-r0/image/run/samba': No such file or directory

---
Alternative patch that just removes /run unconditionally.

 meta-networking/recipes-connectivity/samba/samba_4.1.12.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta-networking/recipes-connectivity/samba/samba_4.1.12.bb +1 -2
index e51f518..49df0f4 100644
@@ -104,8 +104,7 @@ EXTRA_OECONF += "--enable-fhs \
 LDFLAGS += "-Wl,-z,relro,-z,now"
 
 do_install_append() {
-    rmdir --ignore-fail-on-non-empty "${D}/run/samba"
-    rmdir --ignore-fail-on-non-empty "${D}/run"
+    rm -rf "${D}/run"
 
     if ${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'true', 'false', d)}; then
         install -d ${D}${systemd_unitdir}/system
Signature · 1 line
2.1.4