#
# Handle the user home directory on the server
#
directories:
    debian.server::
      # Make sure /skole/tjener/home0/ exists even if using manual partitioning:
      /skole/tjener/home0 mode=755 owner=root group=root
      # Make sure /srv/nfs4/home0 exists:
      /srv/nfs4/home0 mode=755 owner=root group=root

editfiles:
    debian.installation.!standalone::
      { /etc/krb5.conf
      	## FIXME: needed because of #521878:
        BeginGroupIfNoSuchLine '        allow_weak_crypto = true'
          LocateLineMatching '.*\[libdefaults\].*'
          InsertLine '        allow_weak_crypto = true'
          InsertLine '        permitted_enctypes = des-cbc-crc rc4-hmac des3-cbc-sha1-kd aes128-cts-hmac-sha1-96 aes256-cts-hmac-sha1-96'
        EndGroup
      }	
      { /etc/default/nfs-common
        ## start the idmapd daemon:
        BeginGroupIfNoSuchLine 'NEED_IDMAPD=yes'
          HashCommentLinesStarting 'NEED_IDMAPD='
          LocateLineMatching '#.*NEED_IDMAPD=.*'
          InsertLine 'NEED_IDMAPD=yes'
        EndGroup
        ## start the gssd daemon:
        BeginGroupIfNoSuchLine 'NEED_GSSD=yes'
          HashCommentLinesStarting 'NEED_GSSD='
          LocateLineMatching '#.*NEED_GSSD=.*'
          InsertLine 'NEED_GSSD=yes'
        EndGroup
      }
      { /etc/idmapd.conf
        ## needed for correct ID mapping:
        BeginGroupIfNoSuchLine 'Domain = intern'
          HashCommentLinesStarting 'Domain ='
          LocateLineMatching '#.*Domain =.*'
          InsertLine 'Domain = intern'
        EndGroup
      }


    debian.server::
      { /etc/exports
        ## NFS4 without the need to use kerberos for now:
        AppendIfNoSuchLine "/srv/nfs4 @ltsp-server-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,fsid=0,crossmnt,no_subtree_check) @workstation-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,fsid=0,crossmnt,no_subtree_check) @server-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,fsid=0,crossmnt,no_subtree_check)"
        AppendIfNoSuchLine "/srv/nfs4/home0 @ltsp-server-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,no_subtree_check) @workstation-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,no_subtree_check) @server-hosts(sec=krb5p:krb5i:krb5:sys,rw,sync,no_subtree_check)"
      }
      { /etc/fstab
        ## bind the shared directory to the exported tree:
        AppendIfNoSuchLine "/skole/tjener/home0	     /srv/nfs4/home0	none	bind	0	0"
      }
      { /etc/default/nfs-kernel-server
        ## start the svcgssd daemon:
        BeginGroupIfNoSuchLine 'NEED_SVCGSSD=yes'
          HashCommentLinesStarting 'NEED_SVCGSSD='
          LocateLineMatching '#.*NEED_SVCGSSD=.*'
          InsertLine 'NEED_SVCGSSD=yes'
        EndGroup
      }

    # Enable autofs using LDAP unless running the server.  
    # This is done by enabling autofs. Use SRV RRs to find ldap.
    debian.!server.!standalone.!roaming::
      { /etc/default/autofs
        AppendIfNoSuchLine "LDAPURI=ldap://$(ldapserver)"
      }

    # Make sure to disable autofs on the main-server, to avoid hiding
    # local file systems.
    debian.server::

      { /etc/default/autofs
        AppendIfNoSuchLine "exit 0"
      }


    # Just by logging in, each user by default fill up 144 MiB of disk
    # space.  Most of it is spend by akonadi.  Following instructions
    # in
    # <URL: http://techbase.kde.org/Projects/PIM/Akonadi#Akonadi_needs_too_much_space_in_my_home_directory.21 >,
    # we reduce this to 24 MiB by reducing the mysql innodb log file
    # size.  Enabling for GUI profiles, but not for Standalone where
    # most likely only one user will be created.
    debian.installation.workstation::
      { /etc/akonadi/mysql-global.conf
        ReplaceAll 'innodb_log_file_size=64M' With 'innodb_log_file_size=4M'
      }

    # Enable our menu overrides on standalone installations
    debian.standalone::

      { /etc/debian-edu/config
        AppendIfNoSuchLine "MENUREORDER=true"
      }

