Commit be747dbc authored by David Coutadeur's avatar David Coutadeur
Browse files

start plugins installation (unfinished) (#5)

parent 723594e0
#!/bin/sh
# input: $1 = name of the plugin to install
################################################################################
# Variables
################################################################################
FD_HOME_PATH="/usr/local/share/fusiondirectory"
FD_ETC_PATH="/etc/fusiondirectory"
FD_VAR_PATH="/var/cache/fusiondirectory"
PLUGINS_PATH="/usr/src/fd-plugins"
PLUGIN="${1}"
CLASSCACHE_FILENAME="class.cache"
################################################################################
# Functions
################################################################################
copy_dir()
{
SRC="${1}"
DST="${2}"
if [ -d "${SRC}" ]; then
mkdir -p "${DST}"
cp -r ${SRC}/* ${DST}/
chown root:root -R ${DST}
find ${DST} -type d -exec chmod 755 {} \;
find ${DST} -type f -exec chmod 644 {} \;
fi
}
write_classcache()
{
# TODO: write class.cache
# Example:
#<?php
# $class_mapping= array(
# "NonExistingBranchException" => "/include/class_exceptions.inc",
# "setupStepLanguage" => "/setup/class_setupStepLanguage.inc",
# [...]
# );
#?>
# from every file in FD_HOME_PATH matching:
# if ( ( $file =~ /.*\.inc$/ ) && ( $file !~ /.*smarty.*/ ) ) {
# classes are extracted from these lines (2nd arg)
# /^interface\s*(\w+).*/
# and
# /^(abstract )?class\s*(\w+).*/
}
write_i18n()
{
# TODO: write function
# # hash that will contain the result of the "get_i18n" function
# my %get_i18n_result = get_i18n ($locale_dir);
#
# while ( my ($lang, $files) = each %get_i18n_result ) {
#
# # directory wich will contain the .mo file for each language
# my $lang_cache_dir = dir ("$locale_cache_dir/$lang/LC_MESSAGES");
#
# # if $lang_cache_dir doesn't already exists, creating it
# if ( !-d $lang_cache_dir ) {
# $lang_cache_dir->mkpath or die ("! Can't create $locale_cache_dir/$lang/LC_MESSAGES");
# }
#
# # glue .po files's names
# my $po_files = join(" ", @{$files});
# chomp $po_files;
#
# # merging .po files
# system ( "msgcat --use-first ".$po_files.">".$lang_cache_dir."/fusiondirectory.po" ) and die ("! Unable to merge .po files for $lang with msgcat, is it already installed?\n");
#
# # compiling .po files in .mo files
# system ( "msgfmt -o $lang_cache_dir/fusiondirectory.mo $lang_cache_dir/fusiondirectory.po && rm $lang_cache_dir/fusiondirectory.po" ) and die ("! Unable to compile .mo files with msgfmt, is it already installed?\n");
# }
}
################################################################################
# Entry point
################################################################################
printf "%s\n" "Installing plugin: ${PLUGIN}"
copy_dir "${PLUGINS_PATH}/addons" "${FD_HOME_PATH}/plugins/addons"
copy_dir "${PLUGINS_PATH}/admin" "${FD_HOME_PATH}/plugins/admin"
copy_dir "${PLUGINS_PATH}/config" "${FD_HOME_PATH}/plugins/config"
copy_dir "${PLUGINS_PATH}/personal" "${FD_HOME_PATH}/plugins/personal"
copy_dir "${PLUGINS_PATH}/html" "${FD_HOME_PATH}/html"
copy_dir "${PLUGINS_PATH}/ihtml" "${FD_HOME_PATH}/ihtml"
copy_dir "${PLUGINS_PATH}/include" "${FD_HOME_PATH}/include"
copy_dir "${PLUGINS_PATH}/contrib/openldap" "${FD_HOME_PATH}/contrib/openldap"
copy_dir "${PLUGINS_PATH}/contrib/etc" "${FD_ETC_PATH}/${PLUGIN}"
copy_dir "${PLUGINS_PATH}/contrib/doc" "${FD_HOME_PATH}/contrib/doc"
copy_dir "${PLUGINS_PATH}/locale" "${FD_HOME_PATH}/locale/plugins/${PLUGIN}/locale"
write_classcache
......@@ -185,5 +185,16 @@
- name: Check directories
command: /usr/local/bin/fusiondirectory-setup --set-fd_home=/usr/local/share/fusiondirectory --yes --check-directories
- name: Include plugins
include_tasks: "{{ item }}"
loop:
- plugins.yaml
- name: Install personal plugin
shell: /install-plugin.sh "{{ item }}"
loop:
- personal
- name: Update cache and locales
command: /usr/local/bin/fusiondirectory-setup --set-fd_home=/usr/local/share/fusiondirectory --yes --update-cache --update-locales --write-vars
---
- name: Clone FD-plugins git repository
git:
repo: 'https://gitlab.fusiondirectory.org/fusiondirectory/fd-plugins.git'
dest: '/usr/src/fd-plugins'
version: '1.4-dev'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment