Changed: add subscription key check

This commit is contained in:
Daniel Del Rio Figueira 2021-04-22 16:23:15 +02:00
parent 178f97e434
commit c2173e37e2
No known key found for this signature in database
GPG Key ID: DCB25219AF061D1B
1 changed files with 27 additions and 0 deletions

View File

@ -11,6 +11,8 @@ ssl_cert='/etc/ssl/certs/certificate.crt'
deprecation_message=""
subscription_key_file_paths=("/etc/passbolt/subscription_key.txt" "/etc/passbolt/license")
entropy_check() {
local entropy_avail
@ -70,6 +72,29 @@ gen_ssl_cert() {
-keyout $ssl_key -out $ssl_cert
}
get_subscription_file() {
if [ "${PASSBOLT_FLAVOUR}" == 'ce' ]; then
return 1
fi
# Look for subscription key on possible paths
for path in "${subscription_key_file_paths[@]}";
do
if [ -f "${path}" ]; then
SUBSCRIPTION_FILE="${path}"
return 0
fi
done
return 1
}
check_subscription() {
if get_subscription_file; then
su -c "/usr/share/php/passbolt/bin/cake passbolt subscription_import $SUBSCRIPTION_FILE" -s /bin/bash www-data
fi
}
install() {
if [ ! -f "$passbolt_config/app.php" ]; then
su -c "cp $passbolt_config/app.default.php $passbolt_config/app.php" -s /bin/bash www-data
@ -80,6 +105,8 @@ install() {
export PASSBOLT_GPG_SERVER_KEY_FINGERPRINT=$gpg_auto_fingerprint
fi
check_subscription
su -c '/usr/share/php/passbolt/bin/cake passbolt install --no-admin' -s /bin/bash www-data || su -c '/usr/share/php/passbolt/bin/cake passbolt migrate' -s /bin/bash www-data && echo "Enjoy! ☮"
}