Move mounting /rw and /home to separate service
Many services depended on misc-post only because this was where /home gets mounted. Move that to separate service, started earlier.
This commit is contained in:
parent
5c4e88a765
commit
88d7ca7940
@ -32,10 +32,4 @@ echo "Closing windows..."
|
|||||||
sleep 1
|
sleep 1
|
||||||
fuser -vkm /rw
|
fuser -vkm /rw
|
||||||
|
|
||||||
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
|
|
||||||
cp -af /rw/home/user /home/
|
|
||||||
else
|
|
||||||
cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >>/tmp/dispvm-dotfiles-errors.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo done.
|
echo done.
|
||||||
|
@ -546,6 +546,7 @@ The Qubes core startup configuration for SystemD init.
|
|||||||
/lib/systemd/system/qubes-dvm.service
|
/lib/systemd/system/qubes-dvm.service
|
||||||
/lib/systemd/system/qubes-misc-post.service
|
/lib/systemd/system/qubes-misc-post.service
|
||||||
/lib/systemd/system/qubes-firewall.service
|
/lib/systemd/system/qubes-firewall.service
|
||||||
|
/lib/systemd/system/qubes-mount-home.service
|
||||||
/lib/systemd/system/qubes-netwatcher.service
|
/lib/systemd/system/qubes-netwatcher.service
|
||||||
/lib/systemd/system/qubes-network.service
|
/lib/systemd/system/qubes-network.service
|
||||||
/lib/systemd/system/qubes-sysinit.service
|
/lib/systemd/system/qubes-sysinit.service
|
||||||
@ -561,6 +562,7 @@ The Qubes core startup configuration for SystemD init.
|
|||||||
/usr/lib/qubes/init/network-proxy-setup.sh
|
/usr/lib/qubes/init/network-proxy-setup.sh
|
||||||
/usr/lib/qubes/init/misc-post.sh
|
/usr/lib/qubes/init/misc-post.sh
|
||||||
/usr/lib/qubes/init/misc-post-stop.sh
|
/usr/lib/qubes/init/misc-post-stop.sh
|
||||||
|
/usr/lib/qubes/init/mount-home.sh
|
||||||
/usr/lib/qubes/init/qubes-sysinit.sh
|
/usr/lib/qubes/init/qubes-sysinit.sh
|
||||||
/usr/lib/qubes/init/ModemManager.service
|
/usr/lib/qubes/init/ModemManager.service
|
||||||
/usr/lib/qubes/init/NetworkManager.service
|
/usr/lib/qubes/init/NetworkManager.service
|
||||||
@ -580,7 +582,7 @@ The Qubes core startup configuration for SystemD init.
|
|||||||
|
|
||||||
%post systemd
|
%post systemd
|
||||||
|
|
||||||
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-firewall qubes-updates-proxy qubes-qrexec-agent; do
|
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-mount-home qubes-netwatcher qubes-network qubes-firewall qubes-updates-proxy qubes-qrexec-agent; do
|
||||||
/bin/systemctl --no-reload enable $srv.service 2> /dev/null
|
/bin/systemctl --no-reload enable $srv.service 2> /dev/null
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -648,6 +650,6 @@ if [ "$1" != 0 ] ; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-netwatcher qubes-network qubes-qrexec-agent; do
|
for srv in qubes-dvm qubes-sysinit qubes-misc-post qubes-mount-home qubes-netwatcher qubes-network qubes-qrexec-agent; do
|
||||||
/bin/systemctl disable $srv.service
|
/bin/systemctl disable $srv.service
|
||||||
do
|
do
|
||||||
|
@ -22,39 +22,6 @@ fi
|
|||||||
# qubesdb-read fails
|
# qubesdb-read fails
|
||||||
INTERFACE=eth0 /usr/lib/qubes/setup-ip
|
INTERFACE=eth0 /usr/lib/qubes/setup-ip
|
||||||
|
|
||||||
if [ -e /dev/xvdb -a ! -e /etc/this-is-dvm ] ; then
|
|
||||||
resize2fs /dev/xvdb 2> /dev/null || echo "'resize2fs /dev/xvdb' failed"
|
|
||||||
tune2fs -m 0 /dev/xvdb
|
|
||||||
mount /rw
|
|
||||||
|
|
||||||
if ! [ -d /rw/home ] ; then
|
|
||||||
echo
|
|
||||||
echo "--> Virgin boot of the VM: Linking /home to /rw/home"
|
|
||||||
|
|
||||||
mkdir -p /rw/config
|
|
||||||
touch /rw/config/rc.local
|
|
||||||
touch /rw/config/rc.local-early
|
|
||||||
|
|
||||||
mkdir -p /rw/home
|
|
||||||
cp -a /home.orig/user /rw/home
|
|
||||||
|
|
||||||
mkdir -p /rw/usrlocal
|
|
||||||
cp -a /usr/local.orig/* /rw/usrlocal
|
|
||||||
|
|
||||||
touch /var/lib/qubes/first-boot-completed
|
|
||||||
fi
|
|
||||||
# Chown home if user UID have changed - can be the case on template switch
|
|
||||||
HOME_USER_UID=`ls -dn /rw/home/user | awk '{print $3}'`
|
|
||||||
if [ "`id -u user`" -ne "$HOME_USER_UID" ]; then
|
|
||||||
find /rw/home/user -uid "$HOME_USER_UID" -print0 | xargs -0 chown user:user
|
|
||||||
fi
|
|
||||||
if [ -L /home ]; then
|
|
||||||
rm /home
|
|
||||||
mkdir /home
|
|
||||||
fi
|
|
||||||
mount /home
|
|
||||||
fi
|
|
||||||
|
|
||||||
[ -x /rw/config/rc.local ] && /rw/config/rc.local
|
[ -x /rw/config/rc.local ] && /rw/config/rc.local
|
||||||
|
|
||||||
# Start services which haven't own proper systemd unit:
|
# Start services which haven't own proper systemd unit:
|
||||||
|
48
vm-systemd/mount-home.sh
Normal file
48
vm-systemd/mount-home.sh
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
resize2fs /dev/xvdb 2> /dev/null || echo "'resize2fs /dev/xvdb' failed"
|
||||||
|
tune2fs -m 0 /dev/xvdb
|
||||||
|
mount /rw
|
||||||
|
|
||||||
|
if ! [ -d /rw/home ] ; then
|
||||||
|
echo
|
||||||
|
echo "--> Virgin boot of the VM: Populating /rw/home"
|
||||||
|
|
||||||
|
mkdir -p /rw/config
|
||||||
|
touch /rw/config/rc.local
|
||||||
|
touch /rw/config/rc.local-early
|
||||||
|
|
||||||
|
mkdir -p /rw/home
|
||||||
|
cp -a /home.orig/user /rw/home
|
||||||
|
|
||||||
|
mkdir -p /rw/usrlocal
|
||||||
|
cp -a /usr/local.orig/* /rw/usrlocal
|
||||||
|
|
||||||
|
touch /var/lib/qubes/first-boot-completed
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Chown home if user UID have changed - can be the case on template switch
|
||||||
|
HOME_USER_UID=`ls -dn /rw/home/user | awk '{print $3}'`
|
||||||
|
if [ "`id -u user`" -ne "$HOME_USER_UID" ]; then
|
||||||
|
find /rw/home/user -uid "$HOME_USER_UID" -print0 | xargs -0 chown user:user
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Old Qubes versions had symlink /home -> /rw/home; now we use mount --bind
|
||||||
|
if [ -L /home ]; then
|
||||||
|
rm /home
|
||||||
|
mkdir /home
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e /var/run/qubes-service/qubes-dvm ]; then
|
||||||
|
mount --bind /home_volatile /home
|
||||||
|
touch /etc/this-is-dvm
|
||||||
|
|
||||||
|
#If user have customized DispVM settings, use its home instead of default dotfiles
|
||||||
|
if [ -e /rw/home/user/.qubes-dispvm-customized ]; then
|
||||||
|
cp -af /rw/home/user /home/
|
||||||
|
else
|
||||||
|
cat /etc/dispvm-dotfiles.tbz | tar -xjf- --overwrite -C /home/user --owner user 2>&1 >/tmp/dispvm-dotfiles-errors.log
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
mount /home
|
||||||
|
fi
|
@ -11,17 +11,10 @@ possibly_run_save_script()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if true; then
|
if true; then
|
||||||
if [ -L /home ]; then
|
|
||||||
rm /home
|
|
||||||
mkdir /home
|
|
||||||
fi
|
|
||||||
mount --bind /home_volatile /home
|
|
||||||
touch /etc/this-is-dvm
|
|
||||||
systemctl --ignore-dependencies start qubes-gui-agent.service
|
systemctl --ignore-dependencies start qubes-gui-agent.service
|
||||||
while ! xenstore-read qubes-save-request 2>/dev/null ; do
|
while ! xenstore-read qubes-save-request 2>/dev/null ; do
|
||||||
usleep 10
|
usleep 10
|
||||||
done
|
done
|
||||||
mount /rw
|
|
||||||
possibly_run_save_script
|
possibly_run_save_script
|
||||||
umount /rw
|
umount /rw
|
||||||
dmesg -c >/dev/null
|
dmesg -c >/dev/null
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Qubes misc post-boot actions
|
Description=Qubes misc post-boot actions
|
||||||
After=qubes-dvm.service
|
After=qubes-dvm.service qubes-mount-home.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
13
vm-systemd/qubes-mount-home.service
Normal file
13
vm-systemd/qubes-mount-home.service
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Mount /rw and /home, initialize them if needed
|
||||||
|
Before=qubes-gui-agent.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/lib/qubes/init/mount-home.sh
|
||||||
|
ExecStop=/sbin/fuser -kMm /home ; /bin/umount /home
|
||||||
|
ExecStopPost=-/bin/umount /rw
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user