misc-post.sh 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/sh
  2. if [ -f /var/run/qubes-service/yum-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 ] ; then
  13. mount /rw
  14. if ! [ -d /rw/home ] ; then
  15. echo
  16. echo "--> Virgin boot of the VM: Linking /home to /rw/home"
  17. mkdir -p /rw/config
  18. touch /rw/config/rc.local
  19. mkdir -p /rw/home
  20. cp -a /home.orig/user /home
  21. mkdir -p /rw/usrlocal
  22. cp -a /usr/local.orig/* /usr/local
  23. touch /var/lib/qubes/first_boot_completed
  24. fi
  25. # Chown home if user UID have changed - can be the case on template switch
  26. HOME_USER_UID=`ls -dn /home/user | awk '{print $3}'`
  27. if [ "`id -u user`" -ne "$HOME_USER_UID" ]; then
  28. find /home/user -uid "$HOME_USER_UID" -print0 | xargs -0 chown user:user
  29. fi
  30. fi
  31. [ -x /rw/config/rc.local ] && /rw/config/rc.local
  32. if ! [ -f /home/user/.gnome2/nautilus-scripts/.scripts_created ] ; then
  33. echo "Creating symlinks for nautilus actions..."
  34. su user -c 'mkdir -p /home/user/.gnome2/nautilus-scripts'
  35. su user -c 'ln -s /usr/lib/qubes/qvm-copy-to-vm.gnome /home/user/.gnome2/nautilus-scripts/"Copy to other AppVM"'
  36. su user -c 'ln -s /usr/bin/qvm-open-in-dvm /home/user/.gnome2/nautilus-scripts/"Open in DisposableVM"'
  37. su user -c 'touch /home/user/.gnome2/nautilus-scripts/.scripts_created'
  38. fi
  39. if ! [ -f /home/user/.gnome2/nautilus-scripts/.scripts_created2 ] ; then
  40. # as we have recently renamed tools, the symlinks would need to be fixed for older templates
  41. su user -c 'ln -sf /usr/lib/qubes/qvm-copy-to-vm.gnome /home/user/.gnome2/nautilus-scripts/"Copy to other AppVM"'
  42. su user -c 'ln -sf /usr/bin/qvm-open-in-dvm /home/user/.gnome2/nautilus-scripts/"Open in DisposableVM"'
  43. su user -c 'touch /home/user/.gnome2/nautilus-scripts/.scripts_created2'
  44. fi
  45. # Start services which haven't own proper systemd unit:
  46. # Start AppVM specific services
  47. if [ ! -f /etc/systemd/system/cups.service ]; then
  48. if [ -f /var/run/qubes-service/cups ]; then
  49. /sbin/service cups start
  50. # Allow also notification icon
  51. sed -i -e '/^NotShowIn=.*QUBES/s/;QUBES//' /etc/xdg/autostart/print-applet.desktop
  52. else
  53. # Disable notification icon
  54. sed -i -e '/QUBES/!s/^NotShowIn=.*/\1QUBES;/' /etc/xdg/autostart/print-applet.desktop
  55. fi
  56. fi
  57. exit 0