apk: new option --no-scripts

to not run any per-package scripts. useful for managing buildroot
when cross-compiling.
cute-signatures
Timo Teräs 2013-09-10 13:51:30 +03:00
parent 462bb3b8d3
commit 1c4223124d
3 changed files with 7 additions and 2 deletions

View File

@ -66,6 +66,7 @@ static struct apk_option generic_options[] = {
{ 0x108, "repositories-file", "Override repositories file",
required_argument, "REPOFILE" },
{ 0x109, "no-network", "Do not use network (cache is still used)" },
{ 0x113, "no-scripts", "Do not execute any scripts" },
{ 0x111, "overlay-from-stdin", "Read list of overlay files from stdin" },
{ 0x112, "arch", "Use architecture with --root",
required_argument, "ARCH" },
@ -409,6 +410,9 @@ int main(int argc, char **argv)
case 0x109:
apk_flags |= APK_NO_NETWORK;
break;
case 0x113:
apk_flags |= APK_NO_SCRIPTS;
break;
case 0x111:
apk_flags |= APK_OVERLAY_FROM_STDIN;
break;

View File

@ -66,6 +66,7 @@ extern char **apk_argv;
#define APK_INTERACTIVE 0x0400
#define APK_NO_NETWORK 0x1000
#define APK_OVERLAY_FROM_STDIN 0x2000
#define APK_NO_SCRIPTS 0x4000
/* default architecture for APK packages. */
#if defined(__x86_64__)

View File

@ -995,10 +995,10 @@ void apk_ipkg_run_script(struct apk_installed_package *ipkg,
PKG_VER_PRINTF(pkg),
apk_script_types[type]);
apk_message("Executing %s", &fn[15]);
if (apk_flags & APK_SIMULATE)
if ((apk_flags & (APK_NO_SCRIPTS | APK_SIMULATE)) != 0)
return;
apk_message("Executing %s", &fn[15]);
fd = openat(root_fd, fn, O_CREAT|O_RDWR|O_TRUNC|O_CLOEXEC, 0755);
if (fd < 0) {
mkdirat(root_fd, "var/cache/misc", 0755);