From 3e2bed193b9e717c5b4ff5fae460c1b0699e4963 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 31 Jan 2019 12:05:31 +0100 Subject: [PATCH] Enable tests with package_check --- check_process | 9 +++------ scripts/install | 23 +++++++++++++++-------- scripts/remove | 15 ++++++++++----- scripts/upgrade | 5 ++++- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/check_process b/check_process index b72224b..695a07b 100644 --- a/check_process +++ b/check_process @@ -17,12 +17,9 @@ port_already_use=0 change_url=0 ;;; Levels -# Level 1: Manually tested... - Level 1=1 -# Level 2: Manually tested... - Level 2=1 -# Level 3: Manually tested... - Level 3=1 + Level 1=auto + Level 2=auto + Level 3=auto # Level 4: Not relevant. Level 4=na Level 5=auto diff --git a/scripts/install b/scripts/install index b4cef76..8f043ee 100755 --- a/scripts/install +++ b/scripts/install @@ -33,8 +33,7 @@ app=$YNH_APP_INSTANCE_NAME # DISCLAIMER #================================================= -PACKAGE_CHECK_EXEC=${PACKAGE_CHECK_EXEC:-0} -if [ "$PACKAGE_CHECK_EXEC" != "0" ]; then +if IS_PACKAGE_CHECK; then ynh_print_warn "This app can't be tested by package check. Please see the readme for more information. https://github.com/YunoHost-Apps/ssh_chroot_dir_ynh" fi @@ -101,7 +100,9 @@ mkdir -p "$user_dir" ynh_script_progression --message="Install quotas system" --weight=3 # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh -quotas_install +if ! IS_PACKAGE_CHECK; then + quotas_install +fi #================================================= # CONFIGURE FSTAB TO SUPPORT QUOTAS @@ -110,11 +111,14 @@ ynh_script_progression --message="Configure fstab to support quotas" --weight=3 # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh # Set fstab -quotas_find_mount_point "$user_dir" -quotas_set_fstab "$quotas_mount_point" +if ! IS_PACKAGE_CHECK +then + quotas_find_mount_point "$user_dir" + quotas_set_fstab "$quotas_mount_point" -# Activate quotas -quotas_activate "$quotas_mount_point" + # Activate quotas + quotas_activate "$quotas_mount_point" +fi #================================================= # CREATE THE USER WITH CHROOT_MANAGER @@ -139,7 +143,10 @@ then fi ynh_print_OFF -$final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size +if ! IS_PACKAGE_CHECK +then + $final_path/chroot_manager.sh adduser --name $ssh_user $auth_opt "$auth_value" --directory "$user_dir" --quota $size +fi ynh_print_ON #================================================= diff --git a/scripts/remove b/scripts/remove index 670c3f6..49a6421 100755 --- a/scripts/remove +++ b/scripts/remove @@ -36,18 +36,23 @@ ynh_script_progression --message="Remove quotas options in fstab" --weight=3 user_dir="/home/yunohost.app/ssh_chroot_directories/$ssh_user" # https://github.com/maniackcrudelis/ssh_chroot/blob/master/unix_quotas/unix_quotas.sh -quotas_find_mount_point "$user_dir" -quotas_clean_fstab "$quotas_mount_point" +if ! IS_PACKAGE_CHECK +then + quotas_find_mount_point "$user_dir" + quotas_clean_fstab "$quotas_mount_point" -# Deactivate quotas -quotas_deactivate "$quotas_mount_point" + # Deactivate quotas + quotas_deactivate "$quotas_mount_point" +fi #================================================= # REMOVE THE USER WITH CHROOT_MANAGER #================================================= ynh_script_progression --message="Remove the user with Chroot_manager" --weight=3 -$final_path/chroot_manager.sh deluser --name $ssh_user +if ! IS_PACKAGE_CHECK; then + $final_path/chroot_manager.sh deluser --name $ssh_user +fi #================================================= # STANDARD REMOVE diff --git a/scripts/upgrade b/scripts/upgrade index a683898..b9b9538 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,7 +70,10 @@ ssh_chroot_standard_binaries "$user_dir" ssh_chroot_copy_binary rsync "$user_dir" # Set permissions -ssh_chroot_set_permissions "$user_dir" $ssh_user +if ! IS_PACKAGE_CHECK +then + ssh_chroot_set_permissions "$user_dir" $ssh_user +fi #================================================= # UPDATE THE LINK TO CHROOT_MANAGER