xbps: workaround script calls when the sh alternative is not available.

This commit is contained in:
Enno Boland 2019-08-13 09:37:34 +02:00
parent 9e85793e6a
commit d2c4f5cdbb
No known key found for this signature in database
GPG key ID: D09964719BDE9971
3 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,30 @@
diff --git lib/package_script.c lib/package_script.c
index a8c05dcf..919f821b 100644
--- lib/package_script.c
+++ lib/package_script.c
@@ -40,9 +40,10 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
bool update)
{
ssize_t ret;
- const char *tmpdir, *version;
+ const char *tmpdir, *version, *shell;
char *pkgname, *fpath;
int fd, rv;
+ struct stat st;
assert(blob);
assert(pkgver);
@@ -100,7 +101,12 @@ xbps_pkg_exec_buffer(struct xbps_handle *xhp,
version = xbps_pkg_version(pkgver);
assert(version);
- rv = xbps_file_exec(xhp, "/bin/sh", fpath, action, pkgname, version,
+ // Fallback
+ shell = "/bin/sh";
+ if (stat(shell, &st) < 0) {
+ shell = "/bin/dash";
+ }
+ rv = xbps_file_exec(xhp, shell, fpath, action, pkgname, version,
update ? "yes" : "no",
"no", xhp->native_arch, NULL);
free(pkgname);

View file

@ -3,3 +3,4 @@ d72091a20.patch
7b728f5ac.patch
44692f28d8.patch
bb96486b127.patch
fix-missing-sh.patch

View file

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.56
revision=5
revision=6
bootstrap=yes
build_style=configure
short_desc="XBPS package system utilities"