From ee52e37b36b936eb1a6003a35897aeeb5de4cfc7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 24 Feb 2020 13:11:58 +0100 Subject: [PATCH] [libcalamares] Don't hard-code full paths - See editorial in the code-comment. Still need to test that chroot(8) doesn't need a full path, otherwise this will go to /usr/bin/env udevadm to force lookup (redundantly if not in a chroot) --- src/libcalamares/partition/Sync.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/partition/Sync.cpp b/src/libcalamares/partition/Sync.cpp index c5e131cfa..c71c6a172 100644 --- a/src/libcalamares/partition/Sync.cpp +++ b/src/libcalamares/partition/Sync.cpp @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * Copyright 2019, Adriaan de Groot + * Copyright 2019-2020, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,14 @@ void CalamaresUtils::Partition::sync() { - auto r = CalamaresUtils::System::runCommand( { "/sbin/udevadm", "settle" }, std::chrono::seconds( 10 ) ); + /* I would normally use full paths here, e.g. /sbin/udevadm and /bin/sync, + * but there's enough variation / opinion on where these executables + * should live, that full paths would need to be configurable. + * Instead, just run them and assume they're found in PATH; + * either chroot(8) or env(1) is used to run the command, + * and they do suitable lookup. + */ + auto r = CalamaresUtils::System::runCommand( { "udevadm", "settle" }, std::chrono::seconds( 10 ) ); if ( r.getExitCode() != 0 ) { @@ -32,5 +39,5 @@ CalamaresUtils::Partition::sync() r.explainProcess( "udevadm", std::chrono::seconds( 10 ) ); } - CalamaresUtils::System::runCommand( { "/bin/sync" }, std::chrono::seconds( 10 ) ); + CalamaresUtils::System::runCommand( { "sync" }, std::chrono::seconds( 10 ) ); }