]> code.ossystems Code Review - openembedded-core.git/commitdiff
package_rpm.bbclass: handle pre/post remove scriptlets
authorLaurentiu Palcu <laurentiu.palcu@intel.com>
Wed, 5 Jun 2013 09:16:50 +0000 (12:16 +0300)
committerSaul Wold <sgw@linux.intel.com>
Mon, 10 Jun 2013 21:51:29 +0000 (14:51 -0700)
Currently the scriptlet_wrapper is designed to handle only pre/post
install scriptlets. This patch will slightly change the wrapper script
to handle also pre/post remove scriptlets when we want to remove
packages from the final image.

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/classes/package_rpm.bbclass

index 648327f41de0f5897b33302ed4758d95d9dfe469..c654cdb5e8b310cc95d15bb06d2d6b163c214a18 100644 (file)
@@ -382,12 +382,16 @@ export NATIVE_ROOT=${STAGING_DIR_NATIVE}
 
 \$2 \$1/\$3 \$4
 if [ \$? -ne 0 ]; then
-  mkdir -p \$1/etc/rpm-postinsts
-  name=\`head -1 \$1/\$3 | cut -d' ' -f 2\`
-  echo "#!\$2" > \$1/etc/rpm-postinsts/\${name}
-  echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${name}
-  cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${name}
-  chmod +x \$1/etc/rpm-postinsts/\${name}
+  if [ \$4 -eq 1 ]; then
+    mkdir -p \$1/etc/rpm-postinsts
+    name=\`head -1 \$1/\$3 | cut -d' ' -f 2\`
+    echo "#!\$2" > \$1/etc/rpm-postinsts/\${name}
+    echo "# Arg: \$4" >> \$1/etc/rpm-postinsts/\${name}
+    cat \$1/\$3 >> \$1/etc/rpm-postinsts/\${name}
+    chmod +x \$1/etc/rpm-postinsts/\${name}
+  else
+    echo "Error: pre/post remove scriptlet failed"
+  fi
 fi
 EOF