misc-post.sh 2.8 KB

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