Change value in configuration file in template via dom0

run_cmd ()
        qvm-run --pass-io --nogui --user $1 $2 "$3"

run_cmd root $TEMPLATE "

        PATH=$(find /usr/lib -type d -name 'python*' -print -quit)

        if [ -f '$PATH/site-packages/qubesidle/' ]; then

echo $PATH >> /home/user/dom0-log

        # backup the config file
        /usr/bin/cp '$PATH' '${PATH}.bak'

        /usr/bin/sed -i 's/TIMEOUT_SECONDS = .*/TIMEOUT_SECONDS = 9/' $PATH


dom0 error message:

/usr/bin/cp: cannot stat '/home/user/.local/bin:/home/user/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin': No such file or directory
/usr/bin/sed: can't read /home/user/.local/bin:/home/user/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin: No such file or directory

What am I doing wrong?

$PATH is already used by the system, use something else for your variable name.

1 Like

You want to ${PATH} to be evaluated inside the VM, not dom0? Change the exterior double quotes to singles quotes and interior single quotes to double quotes. With exterior double quotes, the find command is executed inside dom0. Not inside $TEMPLATE

p.s. and as DVM mentioned, $PATH is a system variable. Use something else.

1 Like