1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redmine_ynh.git synced 2024-09-03 20:16:16 +02:00
This commit is contained in:
ericgaspar 2021-08-15 23:50:41 +02:00
parent 0207126bd2
commit 5be4ba01d7
No known key found for this signature in database
GPG key ID: 574F281483054D44
6 changed files with 24 additions and 62 deletions

View file

@ -1,14 +1,9 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/" (PATH) path="/"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
port="9980" (PORT) port="9980"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0

View file

@ -1,3 +1,4 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
# Path to source # Path to source

View file

@ -3,8 +3,8 @@
"id": "redmine", "id": "redmine",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Flexible project management web application.", "en": "Flexible project management web application",
"fr": "Gestionnaire de projet flexible sous forme d'application web." "fr": "Gestionnaire de projet flexible sous forme d'application web"
}, },
"version": "4.1.1", "version": "4.1.1",
"url": "https://www.redmine.org/", "url": "https://www.redmine.org/",
@ -14,7 +14,7 @@
"email": "liberodark@gmail.com" "email": "liberodark@gmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.2.4"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -24,29 +24,17 @@
"install": [{ "install": [{
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain name for Redmine",
"fr": "Choisissez un nom de domaine pour Redmine"
},
"example": "example.com" "example": "example.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Redmine /red is accepted",
"fr": "Choisissez un chemin pour Redmine /red est accepté"
},
"example": "/red", "example": "/red",
"default": "/red" "default": "/red"
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public site?",
"fr": "Est-ce un site public ?"
},
"default": true "default": true
} }
] ]

View file

@ -19,18 +19,6 @@ BUNDLER_VERSION="2.2.3"
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Execute a command as another user
# usage: ynh_exec_as USER COMMAND [ARG ...]
ynh_exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS

View file

@ -36,9 +36,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --time --weight=1 ynh_script_progression --message="Validating installation parameters..." --time --weight=1
### If the app uses NGINX as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". final_path=/opt/yunohost/$app
### If the app provides an internal web server (or uses another application server such as uWSGI), the final path should be "/opt/yunohost/$app"
final_path=/opt/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path # Register (book) web path
@ -65,14 +63,14 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --time --weight=1 ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing Rails & Bunlder..." --time --weight=1 ynh_script_progression --message="Installing Rails & Bunlder..." --weight=1
ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_install_ruby --ruby_version=$RUBY_VERSION
@ -91,32 +89,33 @@ ynh_psql_create_db $db_name $db_name $db_pwd
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_print_info "Create dedicated user..." ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create $app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_print_info "Installing Redmine..." ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set $app final_path $final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_print_info "Install Redmine Conffiguration..." ynh_script_progression --message="Adding a configuration file..." --weight=1
cp -a ../conf/database.example.yml $final_path/config/database.yml ynh_add_config --template="../conf/database.example.yml" --destination="$final_path/config/database.yml"
#ynh_replace_string "2.5.3" "2.3.3" "/opt/redmine/Gemfile"
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config/database.yml"
ynh_replace_string "__DB_PASSWORD__" "$db_pwd" "$final_path/config/database.yml"
ynh_replace_string "__DB_NAME__" "$db_name" "$final_path/config/database.yml"
chmod 400 "$final_path/config/database.yml"
chown $app:$app "$final_path/config/database.yml"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE

View file

@ -26,15 +26,6 @@ final_path=$(ynh_app_setting_get $app final_path)
#================================================= #=================================================
ynh_print_info "Ensuring downward compatibility..." ynh_print_info "Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0
is_public=0
fi
# If final_path doesn't exist, create it # If final_path doesn't exist, create it
if [ -z $final_path ]; then if [ -z $final_path ]; then
final_path=/opt/$app final_path=/opt/$app