Browse Source

fix first jirafeau

pull/3/head
François 2 years ago
parent
commit
63b97032a2
  1. 39
      dockers/jirafeau/build.sh
  2. 47
      dockers/jirafeau/config/config.local.php.dist
  3. 53
      dockers/jirafeau/first.sh

39
dockers/jirafeau/build.sh

@ -5,6 +5,11 @@ KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
setKazVars
cd "${SERV_DIR}"
CONF_FILE="config/config.local.php"
touch "${CONF_FILE}"
chown 33:33 "${CONF_FILE}"
SRC_JIR="https://gitlab.com/mojo42/Jirafeau.git"
JIR_VER="4.3.0"
@ -25,37 +30,3 @@ cd "${KAZ_ROOT}"
# Pour permettre la copy de git il faut que le répertoire soit visible de la racine qui lance la construction
docker build -t filekaz . -f dockers/jirafeau/Dockerfile
. "${DOCKERS_ENV}"
cd "${SERV_DIR}"
CONF_FILE="config/config.local.php"
cp "${CONF_FILE}.dist" "${CONF_FILE}"
updatePhpVar(){
# $1 key
# $2 val
# $3 file
if grep -q "$1" "$3" ; then
sed -i \
-e "s%\([\"']$1[\"']\s*=>\s*\)[^,]*,%\1$2,%" \
"$3"
fi
}
updatePhpVar "web_root" "'${httpProto}://${fileHost}.${domain}/'" "${CONF_FILE}"
updatePhpVar "var_root" "'${jirafeauDir}'" "${CONF_FILE}"
updatePhpVar "style" "'kaz'" "${CONF_FILE}"
updatePhpVar "organisation" "'KAZ'" "${CONF_FILE}"
updatePhpVar "admin_password" "'$(echo -n "${HTTPD_PASSWORD}" | sha256sum | awk '{print $1}')'" "${CONF_FILE}"
updatePhpVar "installation_done" "true" "${CONF_FILE}"
# 'web_root' => 'https://depot.kaz.local/',
# 'var_root' => '/var/jirafeauData/lkuDM16R5Sp4QHr/',
# 'lang' => 'auto',
# 'style' => 'kaz',
# 'organisation' => 'ACME',
# 'admin_password' => 'b5b6bc0196ba130c9c1d7eae9312f1d743dafe793348181653720fa12713e126',
# 'installation_done' => false,

47
dockers/jirafeau/config/config.local.php.dist

@ -1,47 +0,0 @@
<?php
/* This file was generated by the install process. You can edit it. Please see config.original.php to understand the configuration items. */
$cfg = array (
'web_root' => 'XXX',
'var_root' => 'XXX',
'lang' => 'auto',
'style' => 'XXX',
'organisation' => 'XXX',
'contactperson' => '',
'title' => '',
'preview' => true,
'enable_crypt' => false,
'link_name_length' => 8,
'upload_password' =>
array (
),
'upload_ip' =>
array (
),
'upload_ip_nopassword' =>
array (
),
'admin_password' => 'XXX',
'admin_http_auth_user' => '',
'availabilities' =>
array (
'minute' => true,
'hour' => true,
'day' => true,
'week' => true,
'month' => true,
'quarter' => false,
'year' => false,
'none' => false,
),
'availability_default' => 'month',
'one_time_download' => true,
'maximal_upload_size' => 0,
'proxy_ip' =>
array (
),
'file_hash' => 'md5',
'litespeed_workaround' => false,
'store_uploader_ip' => true,
'installation_done' => false /* force first Kaz install*/,
'debug' => false,
);

53
dockers/jirafeau/first.sh

@ -10,26 +10,45 @@ cd $(dirname $0)
. "${DOCKERS_ENV}"
. "${KAZ_KEY_DIR}/env-${jirafeauServName}"
CONF_FILE="${DOCK_LIB}/volumes/jirafeau_config/_data/config.local.php"
CONF_FILE="config/config.local.php"
if grep -q "'installation_done'\s*=>\s*true" "${CONF_FILE}" 2>/dev/null ; then
exit;
fi
printKazMsg "\n *** Premier lancement de Jirafeau"
# if ! [[ "$(docker ps -f name=${jirafeauServName} | grep -w ${jirafeauServName})" ]]; then
# printKazError "Jirafeau not running... abort"
# exit
# fi
# curl -X POST \
# -d "jirafeau=${JIR_VER}" \
# -d "step=1" \
# -d "admin_password=${HTTPD_PASSWORD}" \
# -d "next=1" \
# "${httpProto}://${fileHost}.${domain}/install.php"
# curl -X POST -d "jirafeau=${JIR_VER}" \
# -d "step=2" \
# -d "web_root=${httpProto}://${fileHost}.${domain}/" \
# -d "var_root=${jirafeauDir}" \
# -d "next=1" \
# "${httpProto}://${fileHost}.${domain}/install.php"
if ! [[ "$(docker ps -f name=${jirafeauServName} | grep -w ${jirafeauServName})" ]]; then
printKazError "Jirafeau not running... abort"
exit
fi
curl -X POST \
-d "jirafeau=${JIR_VER}" \
-d "step=1" \
-d "admin_password=${HTTPD_PASSWORD}" \
-d "next=1" \
"${httpProto}://${fileHost}.${domain}/install.php"
curl -X POST -d "jirafeau=${JIR_VER}" \
-d "step=2" \
-d "web_root=${httpProto}://${fileHost}.${domain}/" \
-d "var_root=${jirafeauDir}" \
-d "next=1" \
"${httpProto}://${fileHost}.${domain}/install.php"
updatePhpVar(){
# $1 key
# $2 val
# $3 file
if grep -q "$1" "$3" ; then
sed -i \
-e "s%\([\"']$1[\"']\s*=>\s*\)[^,]*,%\1$2,%" \
"$3"
fi
}
updatePhpVar "style" "'kaz'" "${CONF_FILE}"
updatePhpVar "organisation" "'KAZ'" "${CONF_FILE}"
#updatePhpVar "web_root" "'${httpProto}://${fileHost}.${domain}/'" "${CONF_FILE}"
#updatePhpVar "admin_password" "'$(echo -n "${HTTPD_PASSWORD}" | sha256sum | awk '{print $1}')'" "${CONF_FILE}"
#updatePhpVar "var_root" "'${jirafeauDir}'" "${CONF_FILE}"
#updatePhpVar "installation_done" "true" "${CONF_FILE}"

Loading…
Cancel
Save