diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 0e6c335..4681356 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Seafile is an open Source Cloud Storage application. It's a Enterprise file sync and share platform with high reliability and performance. It's a file hosting platform with high reliability and performance. Put files on your own server. Sync and share files across different devices, or access all the files as a virtual disk. -**Shipped version:** 7.0.4 +**Shipped version:** 8.0.5 Screenshots ----------- @@ -88,6 +88,14 @@ From command line: ### Upgrade +By default a backup is made before the upgrade. To avoid this you have theses following possibilites: +- Pass the `NO_BACKUP_UPGRADE` env variable with `1` at each upgrade. By example `NO_BACKUP_UPGRADE=1 yunohost app upgrade synapse`. +- Set the settings `disable_backup_before_upgrade` to `1`. You can set this with this command: + +`yunohost app setting synapse disable_backup_before_upgrade -v 1` + +After this settings will be applied for **all** next upgrade. + From command line: `yunohost app upgrade seafile` diff --git a/check_process b/check_process index b1c9453..3259076 100644 --- a/check_process +++ b/check_process @@ -19,7 +19,7 @@ upgrade=1 upgrade=1 from_commit=db11d890922564dfdcb7937a3a682957082fbb31 upgrade=1 from_commit=67e0869de25f4f58710c3d30d5533356745ea676 - upgrade=1 from_commit=637a32aa57bc2dc6421e0e79d52862f0924be1cf + upgrade=1 from_commit=6786d9f65e60b2d2a96b9ea4c43897dde3a66199 backup_restore=1 multi_instance=0 wrong_user=1 @@ -30,23 +30,11 @@ port_already_use=1 (8000) final_path_already_use=1 change_url=1 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto - # https://github.com/YunoHost-Apps/seafile_ynh/issues/1 - Level 4=1 - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Upgrade options ; commit=db11d890922564dfdcb7937a3a682957082fbb31 name=Version 6.3.4 - branch Old_version_for_CI_3 ; commit=67e0869de25f4f58710c3d30d5533356745ea676 name=Before move main dir to opt - branch Old_version_for_CI_2 - ; commit=637a32aa57bc2dc6421e0e79d52862f0924be1cf + ; commit=6786d9f65e60b2d2a96b9ea4c43897dde3a66199 name=The oldest installable version - branch Old_version_for_CI diff --git a/conf/add_sso_conf.py b/conf/add_sso_conf.py deleted file mode 100644 index 80c5503..0000000 --- a/conf/add_sso_conf.py +++ /dev/null @@ -1,12 +0,0 @@ -import json - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - if "skipped_urls" in data: - data["skipped_urls"].append("/seafhttp") - else: - data["skipped_urls"] = ["/seafhttp"] - data["skipped_urls"].append("/seafdav") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) diff --git a/conf/add_sso_conf_webdav.py b/conf/add_sso_conf_webdav.py deleted file mode 100644 index 52cb4f8..0000000 --- a/conf/add_sso_conf_webdav.py +++ /dev/null @@ -1,8 +0,0 @@ -import json - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - data["skipped_urls"].append("/seafdav") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) \ No newline at end of file diff --git a/conf/arm.src b/conf/arm.src index 7cb9b0d..dc7b2f6 100644 --- a/conf/arm.src +++ b/conf/arm.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz -SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v8.0.5/seafile-server-8.0.5-buster-armv7l.tar.gz +SOURCE_SUM=53a909c0bcb796b21fec3518e9092ec20f8a8b933dc61ea26f3a04aab66efc79 # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..dc7b2f6 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v8.0.5/seafile-server-8.0.5-buster-armv7l.tar.gz +SOURCE_SUM=53a909c0bcb796b21fec3518e9092ec20f8a8b933dc61ea26f3a04aab66efc79 +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/conf/arm64_7_0.src b/conf/arm64_7_0.src new file mode 100644 index 0000000..7cb9b0d --- /dev/null +++ b/conf/arm64_7_0.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz +SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/conf/arm_7_0.src b/conf/arm_7_0.src new file mode 100644 index 0000000..7cb9b0d --- /dev/null +++ b/conf/arm_7_0.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://github.com/haiwen/seafile-rpi/releases/download/v7.0.5/seafile-server_7.0.5_stable_pi.tar.gz +SOURCE_SUM=dae9ab5d232a2b56f129aa29e7e54d2de05d838f0479955543cebcb14c9417db +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/conf/create_admin.json b/conf/create_admin.json new file mode 100644 index 0000000..f38b55c --- /dev/null +++ b/conf/create_admin.json @@ -0,0 +1 @@ +{"email": "__ADMIN__", "password": "__PASSWORD__"} diff --git a/conf/nginx.conf b/conf/nginx.conf index 72de3d8..d21490c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -30,21 +30,13 @@ location __PATH__/media/ { } location /seafdav { - fastcgi_pass 127.0.0.1:__WEBDAV_PORT__; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_script_name; - - fastcgi_param SERVER_PROTOCOL $server_protocol; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS on; - + proxy_pass http://127.0.0.1:__WEBDAV_PORT__/seafdav; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 1200s; client_max_body_size 0; access_log /var/log/nginx/seafdav.access.log; diff --git a/conf/nginx_add_webdav b/conf/nginx_add_webdav index d3e9091..7901504 100644 --- a/conf/nginx_add_webdav +++ b/conf/nginx_add_webdav @@ -1,21 +1,13 @@ location /seafdav { - fastcgi_pass 127.0.0.1:WEBDAV_PORT; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_script_name; - - fastcgi_param SERVER_PROTOCOL $server_protocol; - fastcgi_param QUERY_STRING $query_string; - fastcgi_param REQUEST_METHOD $request_method; - fastcgi_param CONTENT_TYPE $content_type; - fastcgi_param CONTENT_LENGTH $content_length; - fastcgi_param SERVER_ADDR $server_addr; - fastcgi_param SERVER_PORT $server_port; - fastcgi_param SERVER_NAME $server_name; - - fastcgi_param HTTPS on; - + proxy_pass http://127.0.0.1:__WEBDAV_PORT__/seafdav; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_read_timeout 1200s; client_max_body_size 0; access_log /var/log/nginx/seafdav.access.log; error_log /var/log/nginx/seafdav.error.log; -} \ No newline at end of file +} diff --git a/conf/remove_sso_conf.py b/conf/remove_sso_conf.py deleted file mode 100644 index 9492301..0000000 --- a/conf/remove_sso_conf.py +++ /dev/null @@ -1,9 +0,0 @@ -import json - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - data["skipped_urls"].remove("/seafhttp") - data["skipped_urls"].remove("/seafdav") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) diff --git a/conf/update_sso_conf.py b/conf/update_sso_conf.py deleted file mode 100644 index 5264b50..0000000 --- a/conf/update_sso_conf.py +++ /dev/null @@ -1,14 +0,0 @@ -import json - -with open("/etc/ssowat/conf.json.persistent", "r", encoding='utf-8') as jsonFile: - data = json.load(jsonFile) - data["unprotected_urls"].remove("/seafhttp") - data["unprotected_urls"].remove("/seafdav") - if "skipped_urls" in data: - data["skipped_urls"].append("/seafhttp") - else: - data["skipped_urls"] = ["/seafhttp"] - data["skipped_urls"].append("/seafdav") - -with open("/etc/ssowat/conf.json.persistent", "w", encoding='utf-8') as jsonFile: - jsonFile.write(json.dumps(data, indent=4, sort_keys=True)) \ No newline at end of file diff --git a/conf/x86-64.src b/conf/x86-64.src index 4bd9e8a..84ccc51 100644 --- a/conf/x86-64.src +++ b/conf/x86-64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz -SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53 +SOURCE_URL=https://s3.eu-central-1.amazonaws.com/download.seadrive.org/seafile-server_8.0.5_x86-64.tar.gz +SOURCE_SUM=4065e877e9675afba958aa1007db0d3a53949f8987d7f9849dfa29a6a13a06bf # (Optional) Program to check the integrity (sha256sum, md5sum...) # default: sha256 SOURCE_SUM_PRG=sha256sum diff --git a/conf/x86-64_7_0.src b/conf/x86-64_7_0.src new file mode 100644 index 0000000..4bd9e8a --- /dev/null +++ b/conf/x86-64_7_0.src @@ -0,0 +1,11 @@ +SOURCE_URL=https://download.seadrive.org/seafile-server_7.0.5_x86-64.tar.gz +SOURCE_SUM=7eb8814f1bc8ee78c80741fa08cbdce2b5ea8895a87730bde2a1b32d031e8f53 +# (Optional) Program to check the integrity (sha256sum, md5sum...) +# default: sha256 +SOURCE_SUM_PRG=sha256sum +# (Optional) Archive format +# default: tar.gz +SOURCE_FORMAT=tar.gz +# (Optional) Put false if sources are directly in the archive root +# default: true +SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index e4ce82a..57737cd 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "packaging_format": 1, "license": "AGPL-3.0,Apache-2.0,MIT,GPL-2.0", "url": "https://www.seafile.com", - "version": "7.0.5~ynh1", + "version": "8.0.5~ynh1", "description": { "en": "Open Source Cloud Storage", "fr": "Stockage Cloud Open Source" @@ -23,7 +23,7 @@ "mysql" ], "requirements": { - "yunohost": ">= 3.5.2.2" + "yunohost": ">= 4.1" }, "arguments": { "install": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 11167cd..8fe4517 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,8 +3,6 @@ #================================================= app=$YNH_APP_INSTANCE_NAME -[[ -e "../settings/manifest.json" ]] || [[ -e "../manifest.json" ]] && \ - seafile_version=$(ynh_app_upstream_version) #================================================= # DEFINE ALL COMMON FONCTIONS @@ -19,29 +17,54 @@ install_source() { ynh_setup_source "$final_path/seafile-server-$seafile_version" "$architecture" } -install_dependance() { - if [ "$(lsb_release --codename --short)" == "stretch" ]; then - ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-imaging python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ - libjpeg62-turbo-dev zlib1g-dev # For building pillow - else - ynh_install_app_dependencies python2.7 python-pip libpython2.7 python-setuptools python-ldap python-urllib3 python-simplejson python-pil python-mysqldb python-flup expect python-requests python-dev ffmpeg python-memcache \ - libjpeg62-turbo-dev zlib1g-dev # For building pillow +install_source_7_0() { + if ! [ -e $final_path/seafile-server-7.0.5 ]; then + mkdir "$final_path/seafile-server-7.0.5" + if [[ $architecture == "i386" ]] + then + ynh_die --message "Error : this architecture is no longer supported by the upstream. Please create en issue here : https://github.com/YunoHost-Apps/seafile_ynh/issues to ask to discuss about a support of this architecture" + fi + ynh_setup_source "$final_path/seafile-server-7.0.5" "$architecture"_7_0 fi +} + +install_dependance() { + ynh_install_app_dependencies python3 python3-setuptools python3-pip python3-requests python3-dev libmariadb-dev-compat libmariadb-dev \ + expect ffmpeg \ + memcached libmemcached-dev \ + python3-scipy python3-matplotlib \ + libjpeg62-turbo-dev zlib1g-dev # For building pillow ynh_add_swap 2000 # We need to do that because we can have some issue about the permission access to the pip cache without this - set_permission + chown -R $seafile_user:$seafile_user $final_path + # Note that we install imageio to force the dependance, without this imageio 2.8 is installed and it need python3.5 - sudo -u $seafile_user pip install --user --upgrade Pillow 'moviepy<1.0' 'imageio<2.8' certifi idna + sudo -u $seafile_user pip3 install --user --no-warn-script-location --upgrade future mysqlclient pymysql Pillow pylibmc captcha jinja2 sqlalchemy psd-tools django-pylibmc django-simple-captcha python3-ldap + # TODO add dependance when upgrade to seafile 8: django==2.2.* ynh_del_swap } +mv_expect_scripts() { + expect_scripts_dir=$(mktemp -d) + cp expect_scripts/* $expect_scripts_dir + chmod u=rwx,o= -R $expect_scripts_dir + chown $seafile_user -R $expect_scripts_dir +} + set_permission() { chown -R $seafile_user:$seafile_user $final_path + chmod -R g-wx,o= $final_path + setfacl -m user:www-data:rX $final_path + setfacl -m user:www-data:rX $final_path/seafile-server-$seafile_version + setfacl -m user:www-data:rX $final_path/seafile-server-latest/seahub + setfacl -R -m user:www-data:rX $final_path/seafile-server-latest/seahub/media + # check that this directory exist because in some really old install the data could still be in the main seafile directory # We also check at the install time when data directory is not already initialised - test -e /home/yunohost.app/seafile-data && chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data - # Well need to put this here because if test return false, set_permission also return false and the install fail - true + if [ -e /home/yunohost.app/seafile-data ]; then + chown -R $seafile_user:$seafile_user /home/yunohost.app/seafile-data + chmod -R o= /home/yunohost.app/seafile-data + fi } ynh_clean_setup () { diff --git a/scripts/actions b/scripts/actions index 7f6b60c..69b5a4e 100644 --- a/scripts/actions +++ b/scripts/actions @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source scripts/experimental_helper.sh +source scripts/_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source scripts/experimental_helper.sh -source scripts/_common.sh - ynh_print_info --message="Loading installation settings..." # Retrive arguments diff --git a/scripts/backup b/scripts/backup index df96919..f051206 100644 --- a/scripts/backup +++ b/scripts/backup @@ -4,25 +4,26 @@ # GENERIC START #================================================= +# Import common cmd +source ../settings/scripts/experimental_helper.sh +source ../settings/scripts/_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ../settings/scripts/experimental_helper.sh -source ../settings/scripts/_common.sh - -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." # retrieve useful param domain=$(ynh_app_setting_get --app $app --key domain) db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd) final_path=$(ynh_app_setting_get --app $app --key final_path) +seafile_version=$(ynh_app_upstream_version) seafile_user=$app -if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: inactive (dead)" ]]; then +if [[ ! "$(systemctl status seafile)" =~ "Active: inactive (dead)" ]] || [[ ! "$(systemctl status seahub)" =~ "Active: failed (Result: signal)" ]]; then ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'" fi @@ -31,11 +32,11 @@ fi #================================================= # # Backup app files -ynh_script_progression --message="Backing up code..." --weight=3 +ynh_print_info --message="Backing up code..." ynh_backup --src_path $final_path -ynh_script_progression --message="Backing up user data..." --weight=10 +ynh_print_info --message="Backing up user data..." ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1 -ynh_script_progression --message="Backing up configuration..." +ynh_print_info --message="Backing up configuration..." ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf ynh_backup --src_path /etc/systemd/system/seafile.service ynh_backup --src_path /etc/systemd/system/seahub.service @@ -43,9 +44,9 @@ ynh_backup --src_path /etc/fail2ban/jail.d/$app.conf ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf # Backup mysql -ynh_script_progression --message="Backing up database" +ynh_print_info --message="Backing up database" ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index a3b98b1..60023cf 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -4,16 +4,16 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Loading installation settings..." # Retrive arguments diff --git a/scripts/expect_scripts/first_launch.exp b/scripts/expect_scripts/first_launch.exp deleted file mode 100644 index 7c053d8..0000000 --- a/scripts/expect_scripts/first_launch.exp +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/expect -set timeout 10 - -set seafile_dir [lindex $argv 0] -set admin_email [lindex $argv 1] - -spawn $seafile_dir/seahub.sh start - -expect "for the admin account?" -send "$admin_email\r"; - -expect "for the admin account?" -send {__ADMIN_PASSWORD__}; -send '\r'; - -expect "Enter the" -send {__ADMIN_PASSWORD__}; -send '\r'; - -expect eof diff --git a/scripts/expect_scripts/install.exp b/scripts/expect_scripts/install.exp index 03db5eb..b7b898e 100644 --- a/scripts/expect_scripts/install.exp +++ b/scripts/expect_scripts/install.exp @@ -4,9 +4,8 @@ set timeout 10 set seafile_dir [lindex $argv 0] set server_name [lindex $argv 1] set domain [lindex $argv 2] -set seafile_data [lindex $argv 3] -set fileserver_port [lindex $argv 4] -set db_pwd [lindex $argv 5] +set fileserver_port [lindex $argv 3] +set db_pwd [lindex $argv 4] spawn $seafile_dir/setup-seafile-mysql.sh @@ -19,9 +18,6 @@ send "$server_name\r"; expect "What is the ip or domain of the server?" send "$domain\r"; -expect "Where do you want to put your seafile data?" -send "$seafile_data\r"; - expect "Which port do you want to use for the seafile fileserver?" send "$fileserver_port\r"; diff --git a/scripts/expect_scripts/upgrade_7.1.exp b/scripts/expect_scripts/upgrade_7.1.exp new file mode 100644 index 0000000..fbc63c7 --- /dev/null +++ b/scripts/expect_scripts/upgrade_7.1.exp @@ -0,0 +1,19 @@ +#!/usr/bin/expect +set timeout 5 + +set seafile_dir [lindex $argv 0] + +spawn $seafile_dir/upgrade/upgrade_7.0_7.1.sh + +expect "to contiune" +send "\r"; + +sleep 10; + +send "\r"; + +sleep 1; + +send "\r"; + +interact diff --git a/scripts/expect_scripts/upgrade_8.0.exp b/scripts/expect_scripts/upgrade_8.0.exp new file mode 100644 index 0000000..0816a57 --- /dev/null +++ b/scripts/expect_scripts/upgrade_8.0.exp @@ -0,0 +1,11 @@ +#!/usr/bin/expect +set timeout 5 + +set seafile_dir [lindex $argv 0] + +spawn $seafile_dir/upgrade/upgrade_7.1_8.0.sh + +expect "to contiune" +send "\r"; + +interact diff --git a/scripts/experimental_helper.sh b/scripts/experimental_helper.sh index 1d3db9b..6df5480 100644 --- a/scripts/experimental_helper.sh +++ b/scripts/experimental_helper.sh @@ -1,16 +1,27 @@ -# Detect the system architecture to download the right tarball -# NOTE: `uname -m` is more accurate and universal than `arch` -# See https://en.wikipedia.org/wiki/Uname -if [ -n "$(uname -m | grep 64)" ]; then - architecture="x86-64" -elif [ -n "$(uname -m | grep 86)" ]; then - architecture="i386" -elif [ -n "$(uname -m | grep arm)" ]; then - architecture="arm" -else - ynh_die --message "Unable to detect your achitecture, please open a bug describing \ - your hardware and the result of the command \"uname -m\"." 1 -fi + +# Check the architecture +# +# example: architecture=$(ynh_detect_arch) +# +# usage: ynh_detect_arch +# +# Requires YunoHost version 2.2.4 or higher. + +ynh_detect_arch(){ + local architecture + if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then + architecture="arm64" + elif [ -n "$(uname -m | grep 64)" ]; then + architecture="x86-64" + elif [ -n "$(uname -m | grep 86)" ]; then + architecture="i386" + elif [ -n "$(uname -m | grep arm)" ]; then + architecture="arm" + else + architecture="unknown" + fi + echo $architecture +} # Add swap diff --git a/scripts/install b/scripts/install index 1cfaa03..d7e3785 100644 --- a/scripts/install +++ b/scripts/install @@ -4,21 +4,21 @@ # GENERIC START #================================================= +# Import common cmd +source ./experimental_helper.sh +source ./_common.sh + # Source YunoHost helpers source /usr/share/yunohost/helpers # Stop script if errors ynh_abort_if_errors -# Import common cmd -source ./experimental_helper.sh -source ./_common.sh - ynh_script_progression --message="Validating installation parameters..." # Retrieve arguments domain=$YNH_APP_ARG_DOMAIN -path_url=$(ynh_normalize_url_path --path_url $YNH_APP_ARG_PATH) +path_url=$YNH_APP_ARG_PATH server_name="$YNH_APP_ARG_SERVER_NAME" admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC @@ -26,6 +26,8 @@ seafile_data=/home/yunohost.app/seafile-data final_path=/opt/yunohost/$app seafile_user=$app admin_password=$YNH_APP_ARG_ADMIN_PASSWORD +seafile_version=$(ynh_app_upstream_version) +architecture=$(ynh_detect_arch) # Create special path with / at the end if [[ $path_url == '/' ]] @@ -66,7 +68,6 @@ ynh_app_setting_set --app $app --key seahub_port --value $seahub_port ynh_app_setting_set --app $app --key fileserver_port --value $fileserver_port ynh_app_setting_set --app $app --key webdav_port --value $webdav_port ynh_app_setting_set --app $app --key is_public --value $is_public -ynh_app_setting_set --app $app --key installed_version --value $seafile_version #================================================= # STANDARD MODIFICATIONS @@ -76,7 +77,8 @@ ynh_script_progression --message="Creating base directory..." mkdir -p $final_path mkdir -p $final_path/installed mkdir -p $final_path/logs -mkdir -p $final_path/seafile-data +mkdir -p $seafile_data +ln -s $seafile_data $final_path/seafile-data # Create User ynh_script_progression --message="Configuring system user..." @@ -86,10 +88,6 @@ ynh_system_user_create --username $seafile_user --home_dir $final_path ynh_script_progression --message="Installing dependencies..." --weight=7 install_dependance -# Clean data directory -ynh_script_progression --message="Cleaning data directory..." -test -e $seafile_data && ynh_secure_remove --file="$seafile_data" - # Download new version from sources ynh_script_progression --message="Installing sources files..." --weight=7 install_source @@ -104,9 +102,9 @@ ynh_mysql_setup_db --db_user $db_user --db_name seahubdb --db_pwd "$db_pwd" ynh_script_progression --message="Configuring application..." --weight=3 # Run install script -chmod +x expect_scripts/install.exp +mv_expect_scripts chmod +x $final_path/seafile-server-$seafile_version/setup-seafile-mysql.sh -expect_scripts/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$seafile_data" "$fileserver_port" "$db_pwd" +$expect_scripts_dir/install.exp "$final_path/seafile-server-$seafile_version" "$server_name" "$domain" "$fileserver_port" "$db_pwd" sleep 3 @@ -143,15 +141,33 @@ echo '[LDAP]' | tee -a $final_path/conf/ccnet.conf echo 'HOST = ldap://localhost:389' | tee -a $final_path/conf/ccnet.conf echo 'BASE = ou=users,dc=yunohost,dc=org' | tee -a $final_path/conf/ccnet.conf echo 'LOGIN_ATTR = mail' | tee -a $final_path/conf/ccnet.conf +echo "FILTER = permission=cn=$app.main,ou=permission,dc=yunohost,dc=org" | tee -a $final_path/conf/ccnet.conf # Enable manually wiki echo 'ENABLE_WIKI = True' | tee -a $final_path/conf/seahub_settings.py +# Enable memcached +cat >> $final_path/conf/seahub_settings.py <> $final_path/conf/seahub_settings.py <