core: Use abroot if installed

main
Mirko Brombin 2 years ago
parent 79cf13be53
commit d64c2c27fd

@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
import logging
import tempfile
import subprocess
@ -28,6 +29,7 @@ class Processor:
@staticmethod
def run(log_path, pre_run, post_run, commands):
commands = pre_run + commands + post_run
abroot_bin = shutil.which("abroot")
logger.info("processing the following commands: \n%s" %
'\n'.join(commands))
@ -39,9 +41,15 @@ class Processor:
f.write("# This file was created by FirstSetup\n")
f.write("# Do not edit this file manually\n\n")
if abroot_bin := shutil.which("abroot"):
f.write("abroot exec <<EOF\n")
for command in commands:
f.write(f"{command}\n")
if abroot_bin := shutil.which("abroot"):
f.write("EOF\n")
f.flush()
f.close()

Loading…
Cancel
Save