misc-post.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. if [ -f /var/run/qubes-service/yum-proxy-setup -o -f /var/run/qubes-service/updates-proxy-setup ]; then
  3. echo proxy=http://10.137.255.254:8082/ > /etc/yum.conf.d/qubes-proxy.conf
  4. else
  5. echo > /etc/yum.conf.d/qubes-proxy.conf
  6. fi
  7. # Set IP address again (besides action in udev rules); this is needed by
  8. # DispVM (to override DispVM-template IP) and in case when qubes-ip was
  9. # called by udev before loading evtchn kernel module - in which case
  10. # xenstore-read fails
  11. INTERFACE=eth0 /usr/lib/qubes/setup-ip
  12. if [ -e /dev/xvdb -a ! -e /etc/this-is-dvm ] ; then
  13. resize2fs /dev/xvdb 2> /dev/null || echo "'resize2fs /dev/xvdb' failed"
  14. tune2fs -m 0 /dev/xvdb
  15. mount /rw
  16. if ! [ -d /rw/home ] ; then
  17. echo
  18. echo "--> Virgin boot of the VM: Linking /home to /rw/home"
  19. mkdir -p /rw/config
  20. touch /rw/config/rc.local
  21. touch /rw/config/rc.local-early
  22. mkdir -p /rw/home
  23. cp -a /home.orig/user /rw/home
  24. mkdir -p /rw/usrlocal
  25. cp -a /usr/local.orig/* /rw/usrlocal
  26. touch /var/lib/qubes/first-boot-completed
  27. fi
  28. # Chown home if user UID have changed - can be the case on template switch
  29. HOME_USER_UID=`ls -dn /rw/home/user | awk '{print $3}'`
  30. if [ "`id -u user`" -ne "$HOME_USER_UID" ]; then
  31. find /rw/home/user -uid "$HOME_USER_UID" -print0 | xargs -0 chown user:user
  32. fi
  33. if [ -L /home ]; then
  34. rm /home
  35. mkdir /home
  36. fi
  37. mount /home
  38. fi
  39. [ -x /rw/config/rc.local ] && /rw/config/rc.local
  40. # Start services which haven't own proper systemd unit:
  41. # Start AppVM specific services
  42. if [ ! -f /etc/systemd/system/cups.service ]; then
  43. if [ -f /var/run/qubes-service/cups ]; then
  44. /sbin/service cups start
  45. # Allow also notification icon
  46. sed -i -e '/^NotShowIn=.*QUBES/s/;QUBES//' /etc/xdg/autostart/print-applet.desktop
  47. else
  48. # Disable notification icon
  49. sed -i -e '/QUBES/!s/^NotShowIn=.*/\1QUBES;/' /etc/xdg/autostart/print-applet.desktop
  50. fi
  51. fi
  52. if [ -f /var/run/qubes-service/network-manager ]; then
  53. # Allow also notification icon
  54. sed -i -e '/QUBES/!s/^OnlyShowIn=.*/\0QUBES;/' /etc/xdg/autostart/nm-applet.desktop
  55. sed -i -e '/^NotShowIn=.*/s/QUBES;//' /etc/xdg/autostart/nm-applet.desktop
  56. else
  57. # Disable notification icon
  58. sed -i -e '/^OnlyShowIn=.*/s/QUBES;//' /etc/xdg/autostart/nm-applet.desktop
  59. sed -i -e '/QUBES/!s/^NotShowIn=.*/\0QUBES;/' /etc/xdg/autostart/nm-applet.desktop
  60. fi
  61. exit 0