Is it possible to write a script that copies things from /foo/
into /home/user/foo/
before a an AppVM shuts down or reboots?
Same question for launch, copies things from /home/user/foo
back into /foo
.
Is it possible to write a script that copies things from /foo/
into /home/user/foo/
before a an AppVM shuts down or reboots?
Same question for launch, copies things from /home/user/foo
back into /foo
.
Can’t you symlink /foo in rc.local when the system boots?
It might be easier to use bind-dirs feature.
This is what I really want to do:
/nix/store/
. There are lots of items in there./nix/store/
is up-to-date as I want it./nix/store/
obviously (that’s how Qubes works by default)./nix/store/
./nix/store/
should ever get deleted, regardless of whether it was added from the TemplateVM or the AppVM.This is where my original idea of copying new things added to /nix/store/
in the AppVM at shutdown and copy them back again during launch comes from. But is this really the best way to do it?
The problem is that if you copy back to /nix/store in the template
based qube, any changes wont appear in the template. This is because
of the way that Qubes implements templates and template based qubes.
I suspect that the best you could do is to set up rsync between qubes
and the template, and sync from the qube to the template on shut down.
Any changes using bind-dirs will result in a “massive” private disk and
will only apply in that qube. Not what you want.
I never presume to speak for the Qubes team.
When I comment in the Forum or in the mailing lists I speak for myself.
It occurs to me that no one has as yet answered your title question.
Yes, there are hooks implemented for “on exit” and “on boot”.
You’ll find them here
You could leverage these for dom0 actions.
A script called in /rw/config/rc.local will run at start.
You can define a systemd service to run at startup.
You can define a systemd service to run at shutdown, using
Before=shutdown.target
in the Unit stanza.
There are other approaches in systemd - all easily searchable online.
Ah, what an elegant and simple solution to all of my problems! It was right there, in plain sight. Thanks