From 1034b31deed91431376c600933d478ee42ae2ad5 Mon Sep 17 00:00:00 2001 From: ljf Date: Wed, 8 Feb 2017 19:14:48 +0100 Subject: [PATCH] [enh] Update readme and check_process --- README.md | 21 +++++--- check_process | 8 +-- scripts/_common.sh | 8 ++- scripts/restore | 130 +-------------------------------------------- 4 files changed, 28 insertions(+), 139 deletions(-) diff --git a/README.md b/README.md index 118ff15..610853a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,21 @@ -limesurvey_ynh -=============== - LimeSurvey for YunoHost +=============== LimeSurvey is used to create advanced poll. http://www.limesurvey.org/ -About this package --------------- -The "private" check is disbled because the answer part need to be public (only the admin part is private). Currently, the package check tools is not able to test it. +**Package by:** ljf (I will maintain this package at least until beggining of 2018) + +**Patches author:** Schnoulle + +**Categories:** Productivity, Poll + +**Upgrade this package:** +`sudo yunohost app upgrade --verbose example -u https://github.com/YunoHost-Apps/example_ynh` + +**Multi-user:** Yes. + +**Private/Public mode:** In private mode, only authorized YunoHost members can create poll, with the public mode, it's possible to create account to people with no YunoHost account. + +**SSO/LDAP:** SSO and LDAP are configured. diff --git a/check_process b/check_process index 3e89be8..a815b9b 100644 --- a/check_process +++ b/check_process @@ -27,9 +27,11 @@ Level 1=auto Level 2=auto Level 3=auto - Level 4=1 - Level 5=auto - Level 6=auto + Level 4=1 +;; https://github.com/YunoHost-Apps/limesurvey_ynh/issues/10 + Level 5=1 +;; https://github.com/YunoHost-Apps/limesurvey_ynh/issues/11 + Level 6=1 Level 7=auto Level 8=0 Level 9=0 diff --git a/scripts/_common.sh b/scripts/_common.sh index 2baee93..9b09134 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -304,7 +304,11 @@ ynh_read_json () { } ynh_read_manifest () { - ynh_read_json '../manifest.json' "$1" + if [ -f '../manifest.json' ] ; then + ynh_read_json '../manifest.json' "$1" + else + ynh_read_json '../settings/manifest.json' "$1" + fi } ynh_app_dependencies (){ @@ -312,7 +316,7 @@ ynh_app_dependencies (){ export project_url=$(ynh_read_manifest 'url') export version=$(ynh_read_manifest 'version') export dep_app=${app/__/-} - mkdir -p conf + mkdir -p ../conf cat > ../conf/app-ynh-deps.control.j2 << EOF Section: misc Priority: optional diff --git a/scripts/restore b/scripts/restore index 9b46dfb..edfdc44 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,132 +1,6 @@ #!/bin/bash source /usr/share/yunohost/helpers -#source _common.sh - -#================================================ -# COPY of _common.sh (workaround for a bug) -#================================================ -log() { - echo "${1}" -} - -info() { - log "[INFO] ${1}" -} - -warn() { - log "[WARN] ${1}" -} - -err() { - log "[ERR] ${1}" -} -ynh_exit_properly () { - exit_code=$? - if [ "$exit_code" -eq 0 ]; then - exit 0 - fi - trap '' EXIT - set +eu - echo -e "\e[91m \e[1m" - err "$app script has encountered an error." - - if type -t CLEAN_SETUP > /dev/null; then - CLEAN_SETUP - fi - - ynh_die -} - -ynh_trap_on () { - set -eu - trap ynh_exit_properly EXIT # Capturing exit signals on shell script -} - -ynh_path_validity () { - sudo yunohost app checkurl $1 -a $app -} - -ynh_read_json () { - sudo python3 -c "import sys, json;print(json.load(open('$1'))['$2'])" -} - -ynh_read_manifest () { - ynh_read_json '../manifest.json' "$1" -} - -ynh_app_dependencies (){ - export dependencies=$1 - export project_url=$(ynh_read_manifest 'url') - export version=$(ynh_read_manifest 'version') - export dep_app=${app/__/-} - mkdir -p conf - cat > ../conf/app-ynh-deps.control.j2 << EOF -Section: misc -Priority: optional -Homepage: {{ project_urlĀ }} -Standards-Version: 3.9.2 - -Package: {{ dep_app }}-ynh-deps -Version: {{ version }} -Depends: {{ dependencies }} -Architecture: all -Description: meta package for {{ app }} (YunoHost app) dependencies - This meta-package is only responsible of installing its dependencies. -EOF - - ynh_configure app-ynh-deps.control ./$dep_app-ynh-deps.control - ynh_package_install_from_equivs ./$dep_app-ynh-deps.control \ - || ynh_die "Unable to install dependencies" -} - -ynh_system_user_create () { - if ! ynh_system_user_exists "$1" # Check if the user exists on the system - then # If the user doesn't exist - if [ $# -ge 2 ]; then # If a home dir is mentioned - user_home_dir="-d $2" - else - user_home_dir="--no-create-home" - fi - sudo useradd $user_home_dir --system --user-group $1 --shell /usr/sbin/nologin || ynh_die "Unable to create $1 system account" - fi -} - - -ynh_set_default_perm () { - local DIRECTORY=$1 - # Set permissions - sudo chown -R $app:$app $DIRECTORY - sudo chmod -R 664 $DIRECTORY - sudo find $DIRECTORY -type d -print0 | xargs -0 sudo chmod 775 \ - || echo "No file to modify" - -} -ynh_sso_access () { - ynh_app_setting_set $app unprotected_uris "/" - - if [[ $is_public -eq 0 ]]; then - ynh_app_setting_set $app protected_uris "$1" - fi - sudo yunohost app ssowatconf -} - -ynh_check_restore () { - for dest in $(cat ./list| cut -d ' ' -f2); - do - [[ -e $dest ]] && ynh_die \ -"The destination directory '$dest' already exists.\ -You should safely delete it before restoring this app." - done -} - -ynh_restore () { - while IFS= read -r instruction - do - sudo cp -a ./$instruction - done < ./list -} -#=============================================== - +source ../settings/scripts/_common.sh ynh_trap_on @@ -136,7 +10,7 @@ user=$app export domain=$(ynh_app_setting_get $app domain) export path=$(ynh_app_setting_get $app path) export admin=$(ynh_app_setting_get $app admin) -db_pwd=$(ynh_app_setting_get $app mysqlpwd) +dbpass=$(ynh_app_setting_get $app mysqlpwd) export local_path=$(ynh_app_setting_get $app local_path) export is_public=$(ynh_app_setting_get $app is_public) export prefix=$(ynh_app_setting_get $app prefix)