diff options
author | wang biao <biao716.wang@samsung.com> | 2023-10-18 16:51:50 +0800 |
---|---|---|
committer | wang biao <biao716.wang@samsung.com> | 2023-10-23 15:59:29 +0800 |
commit | ef3ea08bd583218e5697ddd7b04f30ecf12ab643 (patch) | |
tree | 4df934ba69904551e71f33c90a7933f52aad5fb2 | |
parent | 521440975a4d45281de5498574751fd2dddf3d78 (diff) | |
download | build-ef3ea08bd583218e5697ddd7b04f30ecf12ab643.tar.gz build-ef3ea08bd583218e5697ddd7b04f30ecf12ab643.tar.bz2 build-ef3ea08bd583218e5697ddd7b04f30ecf12ab643.zip |
Support different interpreters in prein/postin scriptlets
In default, it use /bin/sh as prein/postin scriptlets interpreter, but it also
allow lua or perl other kinds of interpeter to run scripts.
Change-Id: Ie01ee8af5154c2f7b73c55a897722b4cb6031928
Signed-off-by: wang biao <biao716.wang@samsung.com>
-rw-r--r-- | build-pkg-rpm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/build-pkg-rpm b/build-pkg-rpm index 0b31576..607edf7 100644 --- a/build-pkg-rpm +++ b/build-pkg-rpm @@ -186,7 +186,9 @@ pkg_preinstall_rpm() { fi if test -e ".init_b_cache/scripts/$PKG.run" ; then rpm -qp --nodigest --nosignature --qf "%{PREIN}" "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.rpm" > ".init_b_cache/scripts/$PKG.pre" + rpm -qp --nodigest --nosignature --qf "%{PREINPROG}" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" > ".init_b_cache/scripts/$PKG.preprog" rpm -qp --nodigest --nosignature --qf "%{POSTIN}" "'$BUILD_ROOT'/.init_b_cache/rpms/$PKG.rpm" > ".init_b_cache/scripts/$PKG.post" + rpm -qp --nodigest --nosignature --qf "%{POSTINPROG}" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" > ".init_b_cache/scripts/$PKG.postprog" echo -n '(none)' > .init_b_cache/scripts/.none cmp -s ".init_b_cache/scripts/$PKG.pre" .init_b_cache/scripts/.none && rm -f ".init_b_cache/scripts/$PKG.pre" cmp -s ".init_b_cache/scripts/$PKG.post" .init_b_cache/scripts/.none && rm -f ".init_b_cache/scripts/$PKG.post" @@ -204,12 +206,16 @@ pkg_preinstall_rpm() { pkg_runscripts_rpm() { if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then echo "running $PKG preinstall script" - (cd "$BUILD_ROOT" && chroot "$BUILD_ROOT" sh ".init_b_cache/scripts/$PKG.pre" 0) - rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" + local prog + read prog < "$BUILD_ROOT/.init_b_cache/scripts/$PKG.preprog" + (cd $BUILD_ROOT && chroot $BUILD_ROOT "${prog:-sh}" ".init_b_cache/scripts/$PKG.pre" 0) + rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" "$BUILD_ROOT/.init_b_cache/scripts/$PKG.preprog" fi if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then echo "running $PKG postinstall script" - (cd "$BUILD_ROOT" && chroot "$BUILD_ROOT" sh ".init_b_cache/scripts/$PKG.post" 1) - rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" + local prog + read prog < "$BUILD_ROOT/.init_b_cache/scripts/$PKG.postprog" + (cd $BUILD_ROOT && chroot $BUILD_ROOT "${prog:-sh}" ".init_b_cache/scripts/$PKG.post" 1) + rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" "$BUILD_ROOT/.init_b_cache/scripts/$PKG.postprog" fi } |