anchor.diff:          subversion
         ];
         preStart = ''
  -        # ensure cache directory exists for db:migrate command
  -        mkdir -p "${cfg.stateDir}/cache"
  -
  -        # create the basic directory layout the redmine package expects
  -        mkdir -p /run/redmine/public
  -
  -        for i in config files log plugins tmp; do
  -          mkdir -p "${cfg.stateDir}/$i"
  -          ln -fs "${cfg.stateDir}/$i" /run/redmine/
  -        done
  -
  -        for i in plugin_assets themes; do
  -          mkdir -p "${cfg.stateDir}/public/$i"
  -          ln -fs "${cfg.stateDir}/public/$i" /run/redmine/public/
  -        done
  -
  +        rm -rf "${cfg.stateDir}/plugins/"*
  +        rm -rf "${cfg.stateDir}/public/themes/"*
   
           # start with a fresh config directory
           # the config directory is copied instead of linked as some mutable data is stored in there
  -        rm -rf "${cfg.stateDir}/config/"*
  +        find "${cfg.stateDir}/config" ! -name "secret_token.rb" -type f -exec rm -f {} +
           cp -r ${cfg.package}/share/redmine/config.dist/* "${cfg.stateDir}/config/"
  +
  +        chmod -R u+w "${cfg.stateDir}/config"
   
           # link in the application configuration
           ln -fs ${configurationYml} "${cfg.stateDir}/config/configuration.yml"
  
positive.code: 
  
          # link in all user specified plugins
          rm -rf "${cfg.stateDir}/plugins/"*
          for plugin in ${concatStringsSep " " (mapAttrsToList unpackPlugin cfg.plugins)}; do
            ln -fs $plugin/* "${cfg.stateDir}/plugins/''${plugin##*-redmine-plugin-}"
          done
  
  
          # ensure correct permissions for most files
          chmod -R ug+rwX,o-rwx+x "${cfg.stateDir}/"
  
  
          # handle database.passwordFile & permissions
  
negative.code: 
  
          # link in all user specified themes
          for theme in ${concatStringsSep " " (mapAttrsToList unpackTheme cfg.themes)}; do
            ln -fs $theme/* "${cfg.stateDir}/public/themes"
          done
  