Files
void-packages/srcpkgs/xbps/patches/fix-missing-sh.patch

31 lines
1016 B
Diff

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);