misc-post.sh 2.6 KB

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