1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jenkins_ynh.git synced 2024-09-03 19:26:18 +02:00

Normalization from example_ynh

This commit is contained in:
Maniack Crudelis 2019-05-28 00:28:01 +02:00
parent 9c4ed0be92
commit d751deb89e
17 changed files with 317 additions and 591 deletions

View file

@ -40,9 +40,9 @@ Supported, with LDAP and SSO.
#### Supported architectures #### Supported architectures
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/) * x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/) * ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/jenkins%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/jenkins/) * Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/jenkins/)
## Limitations ## Limitations
@ -54,6 +54,7 @@ Supported, with LDAP and SSO.
* Report a bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues
* Jenkins website: https://jenkins.io * Jenkins website: https://jenkins.io
* Jenkins repository: https://github.com/jenkinsci/jenkins
* YunoHost website: https://yunohost.org/ * YunoHost website: https://yunohost.org/
--- ---

View file

@ -40,9 +40,9 @@ Supportée, avec LDAP et SSO.
#### Architectures supportées. #### Architectures supportées.
* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Community%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/) * x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jenkins/)
* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Community%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/) * ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jenkins/)
* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/jenkins%20%28Community%29.svg)](https://ci-stretch.nohost.me/ci/apps/jenkins/) * Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/jenkins%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/jenkins/)
## Limitations ## Limitations
@ -54,6 +54,7 @@ Supportée, avec LDAP et SSO.
* Reporter un bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues * Reporter un bug: https://github.com/YunoHost-Apps/jenkins_ynh/issues
* Site de jenkins: https://jenkins.io * Site de jenkins: https://jenkins.io
* Dépôt git de jenkins: https://github.com/jenkinsci/jenkins
* Site de YunoHost: https://yunohost.org/ * Site de YunoHost: https://yunohost.org/
--- ---

View file

@ -18,18 +18,7 @@
port_already_use=1 (8080) port_already_use=1 (8080)
change_url=1 change_url=1
;;; Levels ;;; Levels
Level 1=auto Level 5=auto
Level 2=auto
Level 3=auto
# Level 4: https://github.com/YunoHost-Apps/jenkins_ynh/blob/master/conf/config.xml#L11-L26
Level 4=1
# Level 5: https://github.com/YunoHost/package_linter/issues/36
Level 5=1
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email= Email=
Notification=down Notification=down

7
conf/app.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.164.2_all.deb
SOURCE_SUM=4ccafc1854231f43fc9e44bd224755d2
SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=jenkins.deb
SOURCE_EXTRACT=false

View file

@ -1,4 +0,0 @@
FILE_URL=https://pkg.jenkins.io/debian-stable/binary/jenkins_2.164.2_all.deb
FILE_SUM=4ccafc1854231f43fc9e44bd224755d2
FILE_SUM_PRG=md5sum
FILENAME=jenkins.deb

View file

@ -1,4 +1,5 @@
location __PATH__ { location __PATH__ {
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
proxy_redirect http://127.0.0.1:__PORT__ https://__DOMAIN____PATH__; proxy_redirect http://127.0.0.1:__PORT__ https://__DOMAIN____PATH__;

View file

@ -14,7 +14,7 @@
"email": "maniackc_dev@crudelis.fr" "email": "maniackc_dev@crudelis.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.4" "yunohost": ">= 3.5.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -48,7 +48,11 @@
"en": "Is it a public site?", "en": "Is it a public site?",
"fr": "Est-ce un site public ?" "fr": "Est-ce un site public ?"
}, },
"default": true "default": true,
"help": {
"en": "A public Jenkins will be accessible by everyone unless you configure the security into jenkins admin panel.",
"fr": "Un Jenkins public sera accessible par tout le monde à moins que vous ne configuriez la sécurité dans le panneau d'administration de jenkins."
}
} }
] ]
} }

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
#=================================================
# PERSONAL HELPERS
#=================================================
#================================================= #=================================================
# BACKUP # BACKUP
#================================================= #=================================================
@ -27,7 +31,12 @@ CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
#================================================= #=================================================
IS_PACKAGE_CHECK () { IS_PACKAGE_CHECK () {
return $(env | grep -c container=lxc) if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]
then
return 0
else
return 1
fi
} }
#================================================= #=================================================
@ -129,359 +138,6 @@ ynh_multimedia_addaccess () {
usermod -a -G multimedia $user_name usermod -a -G multimedia $user_name
} }
#=================================================
# Create a dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]]
# | arg: -l, --logpath= - Log file to be checked by fail2ban
# | arg: -r, --failregex= - Failregex to be looked for by fail2ban
# | arg: -m, --max_retry= - Maximum number of retries allowed before banning IP address - default: 3
# | arg: -p, --ports= - Ports blocked for a banned IP address - default: http,https
ynh_add_fail2ban_config () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= )
local logpath
local failregex
local max_retry
local ports
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
max_retry=${max_retry:-3}
ports=${ports:-http,https}
test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing."
test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing."
finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf"
finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf"
ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1
ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1
tee $finalfail2banjailconf <<EOF
[$app]
enabled = true
port = $ports
filter = $app
logpath = $logpath
maxretry = $max_retry
EOF
tee $finalfail2banfilterconf <<EOF
[INCLUDES]
before = common.conf
[Definition]
failregex = $failregex
ignoreregex =
EOF
ynh_store_file_checksum "$finalfail2banjailconf"
ynh_store_file_checksum "$finalfail2banfilterconf"
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
systemctl reload fail2ban
else
systemctl restart fail2ban
fi
local fail2ban_error="$(journalctl -u fail2ban | tail -n50 | grep "WARNING.*$app.*")"
if [ -n "$fail2ban_error" ]
then
echo "[ERR] Fail2ban failed to load the jail for $app" >&2
echo "WARNING${fail2ban_error#*WARNING}" >&2
fi
}
# Remove the dedicated fail2ban config (jail and filter conf files)
#
# usage: ynh_remove_fail2ban_config
ynh_remove_fail2ban_config () {
ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf"
ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf"
if [ "$(lsb_release --codename --short)" != "jessie" ]; then
systemctl reload fail2ban
else
systemctl restart fail2ban
fi
}
#=================================================
# Read the value of a key in a ynh manifest file
#
# usage: ynh_read_manifest manifest key
# | arg: -m, --manifest= - Path of the manifest to read
# | arg: -k, --key= - Name of the key to find
ynh_read_manifest () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=manifest= [k]=manifest_key= )
local manifest
local manifest_key
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$manifest_key'])"
}
# Read the upstream version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number before ~ynh
# In the last example it return 4.3-2
#
# usage: ynh_app_upstream_version [-m manifest]
# | arg: -m, --manifest= - Path of the manifest to read
ynh_app_upstream_version () {
declare -Ar args_array=( [m]=manifest= )
local manifest
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
manifest="${manifest:-../manifest.json}"
if [ ! -e "$manifest" ]; then
manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version")
echo "${version_key/~ynh*/}"
}
# Read package version from the manifest
# The version number in the manifest is defined by <upstreamversion>~ynh<packageversion>
# For example : 4.3-2~ynh3
# This include the number after ~ynh
# In the last example it return 3
#
# usage: ynh_app_package_version [-m manifest]
# | arg: -m, --manifest= - Path of the manifest to read
ynh_app_package_version () {
declare -Ar args_array=( [m]=manifest= )
local manifest
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
manifest="${manifest:-../manifest.json}"
if [ ! -e "$manifest" ]; then
manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place
fi
version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version")
echo "${version_key/*~ynh/}"
}
# Checks the app version to upgrade with the existing app version and returns:
# - UPGRADE_APP if the upstream app version has changed
# - UPGRADE_PACKAGE if only the YunoHost package has changed
#
## It stops the current script without error if the package is up-to-date
#
# This helper should be used to avoid an upgrade of an app, or the upstream part
# of it, when it's not needed
#
# To force an upgrade, even if the package is up to date,
# you have to set the variable YNH_FORCE_UPGRADE before.
# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp
#
# usage: ynh_check_app_version_changed
ynh_check_app_version_changed () {
local force_upgrade=${YNH_FORCE_UPGRADE:-0}
local package_check=${PACKAGE_CHECK_EXEC:-0}
# By default, upstream app version has changed
local return_value="UPGRADE_APP"
local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0)
local current_upstream_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json")"
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version" || echo 1.0)
local update_upstream_version="$(ynh_app_upstream_version)"
if [ "$current_version" == "$update_version" ] ; then
# Complete versions are the same
if [ "$force_upgrade" != "0" ]
then
echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2
unset YNH_FORCE_UPGRADE
elif [ "$package_check" != "0" ]
then
echo "Upgrade forced for package check." >&2
else
ynh_die "Up-to-date, nothing to do" 0
fi
elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then
# Upstream versions are the same, only YunoHost package versions differ
return_value="UPGRADE_PACKAGE"
fi
echo $return_value
}
#=================================================
# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started
#
# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]
# | arg: -n, --service_name= - Name of the service to reload. Default : $app
# | arg: -a, --action= - Action to perform with systemctl. Default: start
# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot.
# If not defined it don't wait until the service is completely started.
# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log
# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds.
# | arg: -e, --length= - Length of the error log : Default : 20
ynh_systemd_action() {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= )
local service_name
local action
local line_match
local length
local log_path
local timeout
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
local service_name="${service_name:-$app}"
local action=${action:-start}
local log_path="${log_path:-/var/log/$service_name/$service_name.log}"
local length=${length:-20}
local timeout=${timeout:-300}
# Start to read the log
if [[ -n "${line_match:-}" ]]
then
local templog="$(mktemp)"
# Following the starting of the app in its log
if [ "$log_path" == "systemd" ] ; then
# Read the systemd journal
journalctl -u $service_name -f --since=-45 > "$templog" &
else
# Read the specified log file
tail -F -n0 "$log_path" > "$templog" &
fi
# Get the PID of the tail command
local pid_tail=$!
fi
echo "${action^} the service $service_name" >&2
systemctl $action $service_name \
|| ( journalctl --lines=$length -u $service_name >&2 \
; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \
; false )
# Start the timeout and try to find line_match
if [[ -n "${line_match:-}" ]]
then
local i=0
for i in $(seq 1 $timeout)
do
# Read the log until the sentence is found, that means the app finished to start. Or run until the timeout
if grep --quiet "$line_match" "$templog"
then
echo "The service $service_name has correctly started." >&2
break
fi
echo -n "." >&2
sleep 1
done
if [ $i -eq $timeout ]
then
echo "The service $service_name didn't fully started before the timeout." >&2
echo "Please find here an extract of the end of the log of the service $service_name:"
journalctl --lines=$length -u $service_name >&2
test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2
fi
echo ""
ynh_clean_check_starting
fi
}
# Clean temporary process and file used by ynh_check_starting
# (usually used in ynh_clean_setup scripts)
#
# usage: ynh_clean_check_starting
ynh_clean_check_starting () {
# Stop the execution of tail.
kill -s 15 $pid_tail 2>&1
ynh_secure_remove "$templog" 2>&1
}
#=================================================
# Print a message as INFO and show progression during an app script
#
# usage: ynh_script_progression --message=message [--weight=weight] [--time]
# | arg: -m, --message= - The text to print
# | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script.
# | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights.
# | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar.
increment_progression=0
previous_weight=0
# Define base_time when the file is sourced
base_time=$(date +%s)
ynh_script_progression () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [m]=message= [w]=weight= [t]=time [l]=last )
local message
local weight
local time
local last
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
weight=${weight:-1}
time=${time:-0}
last=${last:-0}
# Get execution time since the last $base_time
local exec_time=$(( $(date +%s) - $base_time ))
base_time=$(date +%s)
# Get the number of occurrences of 'ynh_script_progression' in the script. Except those are commented.
local helper_calls="$(grep --count "^[^#]*ynh_script_progression" $0)"
# Get the number of call with a weight value
local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0)
# Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight
local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')"
# Get the weight of each occurrences of 'ynh_script_progression' in the script using -w
local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')"
# Each value will be on a different line.
# Remove each 'end of line' and replace it by a '+' to sum the values.
local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 ))
# max_progression is a total number of calls to this helper.
# Less the number of calls with a weight value.
# Plus the total of weight values
local max_progression=$(( $helper_calls - $weight_calls + $weight_values ))
# Increment each execution of ynh_script_progression in this script by the weight of the previous call.
increment_progression=$(( $increment_progression + $previous_weight ))
# Store the weight of the current call in $previous_weight for next call
previous_weight=$weight
# Set the scale of the progression bar
local scale=20
# progress_string(1,2) should have the size of the scale.
local progress_string1="####################"
local progress_string0="...................."
# Reduce $increment_progression to the size of the scale
if [ $last -eq 0 ]
then
local effective_progression=$(( $increment_progression * $scale / $max_progression ))
# If last is specified, fill immediately the progression_bar
else
local effective_progression=$scale
fi
# Build $progression_bar from progress_string(1,2) according to $effective_progression
local progression_bar="${progress_string1:0:$effective_progression}${progress_string0:0:$(( $scale - $effective_progression ))}"
local print_exec_time=""
if [ $time -eq 1 ]
then
print_exec_time=" [$(date +%Hh%Mm,%Ss --date="0 + $exec_time sec")]"
fi
ynh_print_info "[$progression_bar] > ${message}${print_exec_time}"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
@ -660,6 +316,8 @@ ynh_maintenance_mode_ON () {
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
fi fi
mkdir -p /var/www/html/
# Create an html to serve as maintenance notice # Create an html to serve as maintenance notice
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
@ -730,72 +388,6 @@ ynh_maintenance_mode_OFF () {
#================================================= #=================================================
# Download and check integrity of a file from app.src_file
#
# The file conf/app.src_file need to contains:
#
# FILE_URL=Address to download the file
# FILE_SUM=Control sum
# # (Optional) Program to check the integrity (sha256sum, md5sum...)
# # default: sha256
# FILE_SUM_PRG=sha256
# # (Optionnal) Name of the local archive (offline setup support)
# # default: Name of the downloaded file.
# FILENAME=example.deb
#
# usage: ynh_download_file --dest_dir="/destination/directory" [--source_id=myfile]
# | arg: -d, --dest_dir= - Directory where to download the file
# | arg: -s, --source_id= - Name of the source file 'app.src_file' if it isn't '$app'
ynh_download_file () {
# Declare an array to define the options of this helper.
declare -Ar args_array=( [d]=dest_dir= [s]=source_id= )
local dest_dir
local source_id
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
source_id=${source_id:-app} # If the argument is not given, source_id equals "$app"
# Load value from configuration file (see above for a small doc about this file
# format)
local src_file="$YNH_CWD/../conf/${source_id}.src_file"
# If the src_file doesn't exist, use the backup path instead, with a "settings" directory
if [ ! -e "$src_file" ]
then
src_file="$YNH_CWD/../settings/conf/${source_id}.src_file"
fi
local file_url=$(grep 'FILE_URL=' "$src_file" | cut -d= -f2-)
local file_sum=$(grep 'FILE_SUM=' "$src_file" | cut -d= -f2-)
local file_sumprg=$(grep 'FILE_SUM_PRG=' "$src_file" | cut -d= -f2-)
local filename=$(grep 'FILENAME=' "$src_file" | cut -d= -f2-)
# Default value
file_sumprg=${file_sumprg:-sha256sum}
if [ "$filename" = "" ] ; then
filename="$(basename "$file_url")"
fi
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${filename}"
if test -e "$local_src"
then # Use the local source file if it is present
cp $local_src $filename
else # If not, download the source
local out=`wget -nv -O $filename $file_url 2>&1` || ynh_print_err $out
fi
# Check the control sum
echo "${file_sum} ${filename}" | ${file_sumprg} -c --status \
|| ynh_die "Corrupt file"
# Create the destination directory, if it's not already.
mkdir -p "$dest_dir"
# Move the file to its destination
mv $filename $dest_dir
}
#=================================================
# Create a changelog for an app after an upgrade. # Create a changelog for an app after an upgrade.
# #
# The changelog is printed into the file ./changelog for the time of the upgrade. # The changelog is printed into the file ./changelog for the time of the upgrade.

View file

@ -0,0 +1,148 @@
#!/bin/bash
# Download, check integrity, uncompress and patch the source from app.src
#
# The file conf/app.src need to contains:
#
# SOURCE_URL=Address to download the app archive
# SOURCE_SUM=Control sum
# # (Optional) Program to check the integrity (sha256sum, md5sum...)
# # default: sha256
# SOURCE_SUM_PRG=sha256
# # (Optional) Archive format
# # default: tar.gz
# SOURCE_FORMAT=tar.gz
# # (Optional) Put false if sources are directly in the archive root
# # default: true
# # Instead of true, SOURCE_IN_SUBDIR could be the number of sub directories
# # to remove.
# SOURCE_IN_SUBDIR=false
# # (Optionnal) Name of the local archive (offline setup support)
# # default: ${src_id}.${src_format}
# SOURCE_FILENAME=example.tar.gz
# # (Optional) If it set as false don't extract the source.
# # (Useful to get a debian package or a python wheel.)
# # default: true
# SOURCE_EXTRACT=(true|false)
#
# Details:
# This helper downloads sources from SOURCE_URL if there is no local source
# archive in /opt/yunohost-apps-src/APP_ID/SOURCE_FILENAME
#
# Next, it checks the integrity with "SOURCE_SUM_PRG -c --status" command.
#
# If it's ok, the source archive will be uncompressed in $dest_dir. If the
# SOURCE_IN_SUBDIR is true, the first level directory of the archive will be
# removed.
# If SOURCE_IN_SUBDIR is a numeric value, 2 for example, the 2 first level
# directories will be removed
#
# Finally, patches named sources/patches/${src_id}-*.patch and extra files in
# sources/extra_files/$src_id will be applied to dest_dir
#
#
# usage: ynh_setup_source --dest_dir=dest_dir [--source_id=source_id]
# | arg: -d, --dest_dir - Directory where to setup sources
# | arg: -s, --source_id - Name of the app, if the package contains more than one app
#
# Requires YunoHost version 2.6.4 or higher.
ynh_setup_source () {
# Declare an array to define the options of this helper.
local legacy_args=ds
declare -Ar args_array=( [d]=dest_dir= [s]=source_id= )
local dest_dir
local source_id
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
source_id="${source_id:-app}" # If the argument is not given, source_id equals "app"
local src_file_path="$YNH_CWD/../conf/${source_id}.src"
# In case of restore script the src file is in an other path.
# So try to use the restore path if the general path point to no file.
if [ ! -e "$src_file_path" ]; then
src_file_path="$YNH_CWD/../settings/conf/${source_id}.src"
fi
# Load value from configuration file (see above for a small doc about this file
# format)
local src_url=$(grep 'SOURCE_URL=' "$src_file_path" | cut -d= -f2-)
local src_sum=$(grep 'SOURCE_SUM=' "$src_file_path" | cut -d= -f2-)
local src_sumprg=$(grep 'SOURCE_SUM_PRG=' "$src_file_path" | cut -d= -f2-)
local src_format=$(grep 'SOURCE_FORMAT=' "$src_file_path" | cut -d= -f2-)
local src_extract=$(grep 'SOURCE_EXTRACT=' "$src_file_path" | cut -d= -f2-)
local src_in_subdir=$(grep 'SOURCE_IN_SUBDIR=' "$src_file_path" | cut -d= -f2-)
local src_filename=$(grep 'SOURCE_FILENAME=' "$src_file_path" | cut -d= -f2-)
# Default value
src_sumprg=${src_sumprg:-sha256sum}
src_in_subdir=${src_in_subdir:-true}
src_format=${src_format:-tar.gz}
src_format=$(echo "$src_format" | tr '[:upper:]' '[:lower:]')
src_extract=${src_extract:-true}
if [ "$src_filename" = "" ] ; then
src_filename="${source_id}.${src_format}"
fi
local local_src="/opt/yunohost-apps-src/${YNH_APP_ID}/${src_filename}"
if test -e "$local_src"
then # Use the local source file if it is present
cp $local_src $src_filename
else # If not, download the source
local out=`wget -nv -O $src_filename $src_url 2>&1` || ynh_print_err --message="$out"
fi
# Check the control sum
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \
|| ynh_die --message="Corrupt source"
# Extract source into the app dir
mkdir -p "$dest_dir"
if ! "$src_extract"
then
mv $src_filename $dest_dir
elif [ "$src_format" = "zip" ]
then
# Zip format
# Using of a temp directory, because unzip doesn't manage --strip-components
if $src_in_subdir ; then
local tmp_dir=$(mktemp -d)
unzip -quo $src_filename -d "$tmp_dir"
cp -a $tmp_dir/*/. "$dest_dir"
ynh_secure_remove --file="$tmp_dir"
else
unzip -quo $src_filename -d "$dest_dir"
fi
else
local strip=""
if [ "$src_in_subdir" != "false" ]
then
if [ "$src_in_subdir" == "true" ]; then
local sub_dirs=1
else
local sub_dirs="$src_in_subdir"
fi
strip="--strip-components $sub_dirs"
fi
if [[ "$src_format" =~ ^tar.gz|tar.bz2|tar.xz$ ]] ; then
tar -xf $src_filename -C "$dest_dir" $strip
else
ynh_die --message="Archive format unrecognized."
fi
fi
# Apply patches
if (( $(find $YNH_CWD/../sources/patches/ -type f -name "${source_id}-*.patch" 2> /dev/null | wc -l) > "0" )); then
local old_dir=$(pwd)
(cd "$dest_dir" \
&& for p in $YNH_CWD/../sources/patches/${source_id}-*.patch; do \
patch -p1 < $p; done) \
|| ynh_die --message="Unable to apply patches"
cd $old_dir
fi
# Add supplementary files
if test -e "$YNH_CWD/../sources/extra_files/${source_id}"; then
cp -a $YNH_CWD/../sources/extra_files/$source_id/. "$dest_dir"
fi
}

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
# Get is_public # Get is_public
is_public=${YNH_ACTION_IS_PUBLIC} is_public=${YNH_ACTION_IS_PUBLIC}
@ -27,11 +26,11 @@ app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
# CHECK IF AN ACTION HAS TO BE DONE # CHECK IF AN ACTION HAS TO BE DONE
#================================================= #=================================================
is_public_old=$(ynh_app_setting_get $app is_public) is_public_old=$(ynh_app_setting_get --app=$app --key=is_public)
if [ $is_public -eq $is_public_old ] if [ $is_public -eq $is_public_old ]
then then
ynh_die "is_public is already set as $is_public." 0 ynh_die --message="is_public is already set as $is_public." 0
fi fi
#================================================= #=================================================
@ -44,16 +43,16 @@ if [ $is_public -eq 0 ]; then
else else
public_private="public" public_private="public"
fi fi
ynh_script_progression --message="Move the application to $public_private" --weight=3 ynh_script_progression --message="Moving the application to $public_private..." --weight=3
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then then
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete --app=$app --key=unprotected_uris
# /path/github-webhook has to be accessible for github's webhooks # /path/github-webhook has to be accessible for github's webhooks
ynh_app_setting_set $app skipped_uris "/github-webhook" pour les webhooks de github. ynh_app_setting_set --app=$app --key=skipped_uris --value="/github-webhook"
else else
ynh_app_setting_delete $app skipped_uris ynh_app_setting_delete --app=$app --key=skipped_uris
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi fi
ynh_script_progression --message="Reconfigure SSOwat" ynh_script_progression --message="Reconfigure SSOwat"
@ -61,7 +60,7 @@ ynh_script_progression --message="Reconfigure SSOwat"
yunohost app ssowatconf yunohost app ssowatconf
# Update the config of the app # Update the config of the app
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -22,32 +22,32 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=3 ynh_script_progression --message="Loading installation settings..." --weight=3
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# STANDARD BACKUP STEPS # STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backup the app main dir" --weight=15 ynh_script_progression --message="Backing up the main app directory..." --weight=15
ynh_systemd_action --action=stop --service_name=jenkins ynh_systemd_action --action=stop --service_name=jenkins
sleep 1 sleep 1
CHECK_SIZE "$final_path" CHECK_SIZE "$final_path"
ynh_backup "$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backup nginx configuration" ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# SPECIFIC BACKUP # SPECIFIC BACKUP
@ -55,12 +55,12 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP THE JENKINS' BOOT CONFIG # BACKUP THE JENKINS' BOOT CONFIG
#================================================= #=================================================
ynh_backup /etc/default/$app ynh_backup --src_path=/etc/default/$app
#================================================= #=================================================
# CHECK JENKINS STARTING # CHECK JENKINS STARTING
#================================================= #=================================================
ynh_script_progression --message="Restart Jenkins" --weight=20 ynh_script_progression --message="Restarting Jenkins..." --weight=20
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300" ynh_systemd_action --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300"
@ -69,4 +69,4 @@ ynh_systemd_action --line_match="Jenkins is fully up and running" --log_path="/v
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup completed" --last ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# RETRIEVE ARGUMENTS # RETRIEVE ARGUMENTS
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest" --weight=2
old_domain=$YNH_APP_OLD_DOMAIN old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH old_path=$YNH_APP_OLD_PATH
@ -25,24 +24,14 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading installation settings..." --weight=2
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
ynh_script_progression --message="Check the syntax of the paths"
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2 ynh_script_progression --message="Activating maintenance mode..." --weight=2
path_url=$old_path path_url=$old_path
domain=$old_domain domain=$old_domain
@ -79,7 +68,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Modify url in nginx configuration" --weight=5 ynh_script_progression --message="Updating nginx web server configuration..." --weight=5
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -87,14 +76,14 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper # Set global variables for nginx helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Store path_url setting # Store path_url setting
ynh_app_setting_set $app path_url "$path_url" ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -104,11 +93,11 @@ fi
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path" ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location # Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#================================================= #=================================================
@ -116,7 +105,7 @@ fi
#================================================= #=================================================
# MODIFY JENKINS SETUP # MODIFY JENKINS SETUP
#================================================= #=================================================
ynh_script_progression --message="Modify jenkins setup" ynh_script_progression --message="Updating jenkins setup..."
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
@ -140,7 +129,7 @@ fi
#================================================= #=================================================
# RESTART JENKINS IN BACKGROUND # RESTART JENKINS IN BACKGROUND
#================================================= #=================================================
ynh_script_progression --message="Restart Jenkins" --weight=30 ynh_script_progression --message="Restarting Jenkins..." --weight=30
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300" ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="300"
@ -148,14 +137,14 @@ ynh_systemd_action --action=restart --line_match="Jenkins is fully up and runnin
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" --weight=2 ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=5 ynh_script_progression --message="Disabling maintenance mode..." --weight=5
path_url=$old_path path_url=$old_path
domain=$old_domain domain=$old_domain
@ -165,4 +154,4 @@ ynh_maintenance_mode_OFF
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of url completed" --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -17,7 +17,7 @@ source _variables
app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID}
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# SPECIFIC CODE # SPECIFIC CODE
@ -31,17 +31,17 @@ final_path=$(ynh_app_setting_get $app final_path)
# Otherwise, keep the value from the app config. # Otherwise, keep the value from the app config.
# is_public # is_public
old_is_public="$(ynh_app_setting_get $app is_public)" old_is_public="$(ynh_app_setting_get --app=$app --key=is_public)"
old_is_public=$(bool_to_true_false $old_is_public) old_is_public=$(bool_to_true_false $old_is_public)
is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}" is_public="${YNH_CONFIG_MAIN_IS_PUBLIC_IS_PUBLIC:-$old_is_public}"
# Overwrite nginx configuration # Overwrite nginx configuration
old_overwrite_nginx="$(ynh_app_setting_get $app overwrite_nginx)" old_overwrite_nginx="$(ynh_app_setting_get --app=$app --key=overwrite_nginx)"
old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx) old_overwrite_nginx=$(bool_to_true_false $old_overwrite_nginx)
overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}" overwrite_nginx="${YNH_CONFIG_MAIN_OVERWRITE_FILES_OVERWRITE_NGINX:-$old_overwrite_nginx}"
# Type of admin mail configuration # Type of admin mail configuration
old_admin_mail_html="$(ynh_app_setting_get $app admin_mail_html)" old_admin_mail_html="$(ynh_app_setting_get --app=$app --key=admin_mail_html)"
old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html) old_admin_mail_html=$(bool_to_true_false $old_admin_mail_html)
admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}" admin_mail_html="${YNH_CONFIG_MAIN_GLOBAL_CONFIG_EMAIL_TYPE:-$old_admin_mail_html}"
@ -76,11 +76,11 @@ apply_config() {
# Set overwrite_nginx # Set overwrite_nginx
overwrite_nginx=$(bool_to_01 $overwrite_nginx) overwrite_nginx=$(bool_to_01 $overwrite_nginx)
ynh_app_setting_set $app overwrite_nginx "$overwrite_nginx" ynh_app_setting_set --app=$app --key=overwrite_nginx --value="$overwrite_nginx"
# Set admin_mail_html # Set admin_mail_html
admin_mail_html=$(bool_to_01 $admin_mail_html) admin_mail_html=$(bool_to_01 $admin_mail_html)
ynh_app_setting_set $app admin_mail_html "$admin_mail_html" ynh_app_setting_set --app=$app --key=admin_mail_html --value="$admin_mail_html"
} }
#================================================= #=================================================

View file

@ -30,7 +30,6 @@ ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Retrieve arguments from the manifest"
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
@ -41,52 +40,49 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
#================================================= #=================================================
ynh_script_progression --message="Check if the app can be installed" ynh_script_progression --message="Validating installation parameters..."
final_path=/var/lib/$app final_path=/var/lib/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Store settings from manifest" --weight=3 ynh_script_progression --message="Storing installation settings..." --weight=3
ynh_app_setting_set $app domain $domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set $app path $path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set $app is_public $is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set $app overwrite_nginx "1" ynh_app_setting_set --app=$app --key=overwrite_nginx --value=1
ynh_app_setting_set $app admin_mail_html "1" ynh_app_setting_set --app=$app --key=admin_mail_html --value=1
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# FIND AND OPEN A PORT # FIND AND OPEN A PORT
#================================================= #=================================================
ynh_script_progression --message="Find a free port" --weight=2 ynh_script_progression --message="Configuring firewall..." --weight=2
# Find a free port # Find a free port
port=$(ynh_find_port 8080) port=$(ynh_find_port --port=8080)
ynh_app_setting_set $app port $port ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Install dependencies" --weight=30 ynh_script_progression --message="Installing dependencies..." --weight=30
ynh_install_app_dependencies $app_depencencies ynh_install_app_dependencies $app_depencencies
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configure nginx" --weight=2 ynh_script_progression --message="Configuring nginx web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -96,7 +92,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# FIX THE PORT TO USE # FIX THE PORT TO USE
#================================================= #=================================================
ynh_script_progression --message="Fix the port to use" --weight=2 ynh_script_progression --message="Fixing the port in Jenkins config..." --weight=2
change_port() { change_port() {
# Wait for the creation of the jenkins service file # Wait for the creation of the jenkins service file
@ -111,7 +107,7 @@ change_port() {
fi fi
done done
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used. # And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins ynh_replace_string --match_string="^HTTP_PORT=.*" --replace_string="HTTP_PORT=$port" --target_file=/etc/default/jenkins
} }
change_port & change_port &
pid_change_port=$! pid_change_port=$!
@ -119,21 +115,21 @@ pid_change_port=$!
#================================================= #=================================================
# INSTALL JENKINS # INSTALL JENKINS
#================================================= #=================================================
ynh_script_progression --message="Install Jenkins" --weight=30 ynh_script_progression --message="Installing Jenkins..." --weight=30
# Download jenkins deb file and install it. # Download jenkins deb file and install it.
ynh_download_file --dest_dir="../conf" ynh_setup_source --dest_dir="../conf"
dpkg --install --force-confnew ../conf/jenkins.deb dpkg --install --force-confnew ../conf/jenkins.deb
#================================================= #=================================================
# SETUP JENKINS # SETUP JENKINS
#================================================= #=================================================
ynh_script_progression --message="Configure Jenkins" ynh_script_progression --message="Configuring Jenkins..."
# Ignore Setup Wizard # Ignore Setup Wizard
ynh_replace_string "\-Djava.awt.headless=true" "& -Djenkins.install.runSetupWizard=false" /etc/default/jenkins ynh_replace_string --match_string="\-Djava.awt.headless=true" --replace_string="& -Djenkins.install.runSetupWizard=false" --target_file=/etc/default/jenkins
if [ "$path_url" != "/" ]; if [ "$path_url" != "/" ]
then then
# Add the path, in case of sub-path installation, into jenkins' boot options # Add the path, in case of sub-path installation, into jenkins' boot options
sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins sed -i "$ s@--httpPort=\$HTTP_PORT@& --prefix=$path_url@g" /etc/default/jenkins
@ -142,10 +138,10 @@ fi
#================================================= #=================================================
# FORCE PUBLIC ACCESS # FORCE PUBLIC ACCESS
#================================================= #=================================================
ynh_script_progression --message="Force public access for the installation" --weight=5 ynh_script_progression --message="Forcing public access for the installation..." --weight=5
# Jenkins has to be public, at least for jenkins-cli.jar # Jenkins has to be public, at least for jenkins-cli.jar
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
yunohost app ssowatconf yunohost app ssowatconf
@ -159,7 +155,7 @@ yunohost service add $app --log /var/log/$app/$app.log
#================================================= #=================================================
# CHECK JENKINS STARTING # CHECK JENKINS STARTING
#================================================= #=================================================
ynh_script_progression --message="Start Jenkins" --weight=25 ynh_script_progression --message="Starting Jenkins..." --weight=25
config_OK=0 config_OK=0
timeout=3600 timeout=3600
@ -171,12 +167,12 @@ ynh_systemd_action --action=restart --line_match="Jenkins is fully up and runnin
# Enable Jenkins CLI Protocol/2 for jenkins-cli # Enable Jenkins CLI Protocol/2 for jenkins-cli
# That the only protocol that allow connection without an authenticated user... # That the only protocol that allow connection without an authenticated user...
ynh_replace_string "<slaveAgentPort>0</slaveAgentPort>" "&\n<enabledAgentProtocols><string>CLI2-connect</string></enabledAgentProtocols>" /var/lib/jenkins/config.xml ynh_replace_string --match_string="<slaveAgentPort>0</slaveAgentPort>" --replace_string="&\n<enabledAgentProtocols><string>CLI2-connect</string></enabledAgentProtocols>" --target_file=/var/lib/jenkins/config.xml
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout" ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
ynh_script_progression --message="Install plugins" --weight=60 ynh_script_progression --message="Installing plugins..." --weight=60
# If the log says that jenkins has started, install the plugins # If the log says that jenkins has started, install the plugins
wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar
@ -227,7 +223,7 @@ $jenkins_cli install-plugin fstrigger
cp ../conf/config.xml /var/lib/jenkins/ cp ../conf/config.xml /var/lib/jenkins/
chown jenkins: /var/lib/jenkins/config.xml chown jenkins: /var/lib/jenkins/config.xml
ynh_script_progression --message="Restart Jenkins" --weight=20 ynh_script_progression --message="Restarting Jenkins..." --weight=20
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout" ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="$timeout"
@ -235,14 +231,14 @@ ynh_systemd_action --action=restart --line_match="Jenkins is fully up and runnin
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Setup SSOwat" --weight=9 ynh_script_progression --message="Configuring SSOwat..." --weight=9
if [ $is_public -eq 0 ] if [ $is_public -eq 0 ]
then then
# Remove the public access # Remove the public access
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete --app=$app --key=unprotected_uris
# /path/github-webhook has to be accessible for github's webhooks # /path/github-webhook has to be accessible for github's webhooks
ynh_app_setting_set $app skipped_uris "/github-webhook" ynh_app_setting_set --app=$app --key=skipped_uris --value="/github-webhook"
fi fi
#================================================= #=================================================
@ -263,10 +259,10 @@ You can also find some specific actions for this app by using the experimental _
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/jenkins_ynh__URL_TAG3__." > mail_to_send If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/jenkins_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="install" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=install
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,11 +12,11 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=4 ynh_script_progression --message="Loading installation settings..." --weight=4
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -25,26 +25,26 @@ domain=$(ynh_app_setting_get $app domain)
#================================================= #=================================================
# Check if the service is declared in YunoHost # Check if the service is declared in YunoHost
if yunohost service status | grep -q $app if yunohost service status $app >/dev/null 2>&1
then then
ynh_print_info "Remove $app service" >&2 ynh_script_progression --message="Removing $app service..."
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Remove dependencies" --weight=20 ynh_script_progression --message="Removing dependencies..." --weight=20
ynh_apt purge jenkins ynh_apt purge jenkins
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
ynh_secure_remove "/var/lib/jenkins" ynh_secure_remove --file="/var/lib/jenkins"
#================================================= #=================================================
# REMOVE THE NGINX CONFIGURATION # REMOVE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Remove nginx configuration" --weight=2 ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -53,4 +53,4 @@ ynh_remove_nginx_config
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Deletion completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -11,6 +11,9 @@ source /usr/share/yunohost/helpers
# Load common variables for all scripts. # Load common variables for all scripts.
source ../settings/scripts/_variables source ../settings/scripts/_variables
# Source the version 3.6 of ynh_setup_source which allow this helper to be used in restore script
source ../settings/scripts/_ynh_setup_source_fix.sh
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
@ -27,28 +30,29 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=2 ynh_script_progression --message="Loading settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available $domain $path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die "Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2 ynh_script_progression --message="Activating maintenance mode..." --weight=2
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
@ -58,24 +62,21 @@ ynh_maintenance_mode_ON
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# Reload nginx
ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# SPECIFIC RESTORE # SPECIFIC RESTORE
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstall dependencies" --weight=20 ynh_script_progression --message="Reinstalling dependencies..." --weight=20
ynh_install_app_dependencies $app_depencencies ynh_install_app_dependencies $app_depencencies
#================================================= #=================================================
# FIX THE PORT TO USE # FIX THE PORT TO USE
#================================================= #=================================================
ynh_script_progression --message="Fix the port to use" ynh_script_progression --message="Fixing the port in Jenkins config..."
change_port() { change_port() {
# Wait for the creation of the jenkins service file # Wait for the creation of the jenkins service file
@ -90,7 +91,7 @@ change_port() {
fi fi
done done
# And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used. # And modify the port as soon as possible, to prevent a crach of jenkins if the default port is already used.
ynh_replace_string "^HTTP_PORT=.*" "HTTP_PORT=$port" /etc/default/jenkins ynh_replace_string --match_string="^HTTP_PORT=.*" --replace_string="HTTP_PORT=$port" --target_file=/etc/default/jenkins
} }
change_port & change_port &
pid_change_port=$! pid_change_port=$!
@ -98,25 +99,25 @@ pid_change_port=$!
#================================================= #=================================================
# INSTALL JENKINS # INSTALL JENKINS
#================================================= #=================================================
ynh_script_progression --message="Install Jenkins" --weight=25 ynh_script_progression --message="Installing Jenkins..." --weight=25
# Download jenkins deb file and install it. # Download jenkins deb file and install it.
ynh_download_file --dest_dir="../conf" ynh_setup_source --dest_dir="../conf"
dpkg --install --force-confnew ../conf/jenkins.deb dpkg --install --force-confnew ../conf/jenkins.deb
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restore the app main directory" --weight=4 ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file "$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= #=================================================
# RESTORE THE JENKINS' BOOT CONFIG # RESTORE THE JENKINS' BOOT CONFIG
#================================================= #=================================================
ynh_secure_remove "/etc/default/jenkins" ynh_secure_remove --file="/etc/default/jenkins"
ynh_restore_file /etc/default/$app ynh_restore_file --origin_path=/etc/default/$app
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
@ -127,7 +128,7 @@ yunohost service add $app --log "/var/log/$app/$app.log"
#================================================= #=================================================
# CHECK JENKINS STARTING # CHECK JENKINS STARTING
#================================================= #=================================================
ynh_script_progression --message="Restart Jenkins" --weight=20 ynh_script_progression --message="Restarting Jenkins..." --weight=20
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600" ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
@ -135,7 +136,7 @@ ynh_systemd_action --action=restart --line_match="Jenkins is fully up and runnin
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=8 ynh_script_progression --message="Disabling maintenance mode..."
ynh_maintenance_mode_OFF ynh_maintenance_mode_OFF
@ -151,10 +152,10 @@ You can also find some specific actions for this app by using the experimental _
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/jenkins_ynh__URL_TAG3__." > mail_to_send If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/jenkins_ynh__URL_TAG3__." > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="restore" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=restore
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -14,15 +14,15 @@ source _variables
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Load settings" --weight=4 ynh_script_progression --message="Loading installation settings..." --weight=4
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get $app is_public) is_public=$(ynh_app_setting_get --app=$app --key=is_public)
port=$(ynh_app_setting_get $app port) port=$(ynh_app_setting_get --app=$app --key=port)
overwrite_nginx=$(ynh_app_setting_get $app overwrite_nginx) overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -33,27 +33,27 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensure downward compatibility" ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean # Fix is_public as a boolean
if [ "$is_public" = "Yes" ]; then if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1 ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1 is_public=1
elif [ "$is_public" = "No" ]; then elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0 ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0 is_public=0
fi fi
# If overwrite_nginx doesn't exist, create it # If overwrite_nginx doesn't exist, create it
if [ -z "$overwrite_nginx" ]; then if [ -z "$overwrite_nginx" ]; then
overwrite_nginx=1 overwrite_nginx=1
ynh_app_setting_set $app overwrite_nginx $overwrite_nginx ynh_app_setting_set --app=$app --key=overwrite_nginx --value=$overwrite_nginx
fi fi
# Remove the apt list entry for jenkins # Remove the apt list entry for jenkins
if [ -e "/etc/apt/sources.list.d/jenkins.list" ] if [ -e "/etc/apt/sources.list.d/jenkins.list" ]
then then
ynh_secure_remove /etc/apt/sources.list.d/jenkins.list ynh_secure_remove --file=/etc/apt/sources.list.d/jenkins.list
# Get APT key id for jenkins # Get APT key id for jenkins
apt_key=$(apt-key list | grep -B1 "Kohsuke Kawaguchi" | grep pub | cut -d'/' -f2 | cut -d' ' -f1) apt_key=$(apt-key list | grep -B1 "Kohsuke Kawaguchi" | grep pub | cut -d'/' -f2 | cut -d' ' -f1)
# Delete the APT key # Delete the APT key
@ -64,7 +64,7 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backup the app before upgrading" --weight=40 ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=40
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -79,7 +79,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# ACTIVATE MAINTENANCE MODE # ACTIVATE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Activate maintenance mode" --weight=2 ynh_script_progression --message="Activating maintenance mode..." --weight=2
ynh_maintenance_mode_ON ynh_maintenance_mode_ON
@ -89,9 +89,9 @@ ynh_maintenance_mode_ON
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrade Jenkins" --weight=40 ynh_script_progression --message="Upgrading Jenkins..." --weight=40
# Download jenkins deb file and install it. # Download jenkins deb file and install it.
ynh_download_file --dest_dir="../conf" ynh_setup_source --dest_dir="../conf"
dpkg --install --force-confnew ../conf/jenkins.deb dpkg --install --force-confnew ../conf/jenkins.deb
#================================================= #=================================================
@ -111,7 +111,7 @@ fi
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Upgrade dependencies" --weight=12 ynh_script_progression --message="Upgrading dependencies..." --weight=12
ynh_install_app_dependencies $app_depencencies ynh_install_app_dependencies $app_depencencies
@ -122,33 +122,35 @@ ynh_install_app_dependencies $app_depencencies
# Overwrite the nginx configuration only if it's allowed # Overwrite the nginx configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ] if [ $overwrite_nginx -eq 1 ]
then then
ynh_script_progression --message="Reconfigure nginx" --weight=4 ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=4
# Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Reconfigure SSOwat" ynh_script_progression --message="Upgrading SSOwat configuration..."
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
else else
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete --app=$app --key=unprotected_uris
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reload nginx" --weight=2 ynh_script_progression --message="Reloading nginx web server..." --weight=2
ynh_systemd_action --action=reload --service_name=nginx ynh_systemd_action --action=reload --service_name=nginx
#================================================= #=================================================
# CHECK JENKINS STARTING # CHECK JENKINS STARTING
#================================================= #=================================================
ynh_script_progression --message="Restart Jenkins" --weight=25 ynh_script_progression --message="Restarting Jenkins..." --weight=25
# Wait for Jenkins to be fully started # Wait for Jenkins to be fully started
ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600" ynh_systemd_action --action=restart --line_match="Jenkins is fully up and running" --log_path="/var/log/$app/$app.log" --timeout="3600"
@ -156,14 +158,14 @@ ynh_systemd_action --action=restart --line_match="Jenkins is fully up and runnin
#================================================= #=================================================
# UPGRADE JENKINS-CLI.PHAR # UPGRADE JENKINS-CLI.PHAR
#================================================= #=================================================
ynh_script_progression --message="Upgrade jenkins-cli.phar" ynh_script_progression --message="Upgrading jenkins-cli.phar..."
wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar wget -nv --no-check-certificate https://$domain$path_url/jnlpJars/jenkins-cli.jar -O /var/lib/jenkins/jenkins-cli.jar
#================================================= #=================================================
# DEACTIVE MAINTENANCE MODE # DEACTIVE MAINTENANCE MODE
#================================================= #=================================================
ynh_script_progression --message="Disable maintenance mode" --weight=6 ynh_script_progression --message="Disabling maintenance mode..." --weight=6
ynh_maintenance_mode_OFF ynh_maintenance_mode_OFF
@ -187,10 +189,10 @@ If you're facing an issue or want to improve this app, please open a new issue i
Changelog since your last upgrade: Changelog since your last upgrade:
$(cat changelog)" > mail_to_send $(cat changelog)" > mail_to_send
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type="upgrade" ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="root" --type=upgrade
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade completed" --last ynh_script_progression --message="Upgrade of $app completed" --last