1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/haste_ynh.git synced 2024-09-03 20:36:28 +02:00
* Fix permissions
This commit is contained in:
Éric Gaspar 2021-05-12 09:09:45 +02:00 committed by GitHub
parent b5b33ba494
commit 8060c30025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 107 additions and 45 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -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.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -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)

View file

@ -6,7 +6,7 @@
port="7777" (PORT) port="7777" (PORT)
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
@ -14,7 +14,6 @@
upgrade=1 upgrade=1
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=1
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

View file

@ -6,7 +6,7 @@
"en": "Open-source pastebin allowing to upload texts", "en": "Open-source pastebin allowing to upload texts",
"fr": "Pastebin open-source permettant de mettre en ligne du texte" "fr": "Pastebin open-source permettant de mettre en ligne du texte"
}, },
"version": "0.1.0~ynh6", "version": "0.1.0~ynh7",
"url": "https://github.com/seejohnrun/haste-server", "url": "https://github.com/seejohnrun/haste-server",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
@ -18,7 +18,7 @@
"email": "maxime.bugeia@gmail.com" "email": "maxime.bugeia@gmail.com"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.1.7" "yunohost": ">= 4.2.4"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [

View file

@ -1,16 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
@ -54,7 +55,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app"
# BACKUP DATADIR DIRECTORY # BACKUP DATADIR DIRECTORY
#================================================= #=================================================
ynh_backup --src_path="/home/yunohost.app/$app" ynh_backup --src_path="$data_path"
#================================================= #=================================================
# BACKUP BINARY # BACKUP BINARY

View file

@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH new_path="/"
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME

View file

@ -95,8 +95,8 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# ADD SYSTEMD SERVICE # ADD SYSTEMD SERVICE
#================================================= #=================================================
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service" ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
@ -119,6 +119,7 @@ data_path="/home/yunohost.app/${app}"
# Create app folders # Create app folders
mkdir -p "$data_path" mkdir -p "$data_path"
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
#================================================= #=================================================
# CONFIGURE HASTE # CONFIGURE HASTE
@ -135,10 +136,8 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/
# ADD HASTE AS A BINARY FILE # ADD HASTE AS A BINARY FILE
#================================================= #=================================================
ynh_replace_string --match_string="__HASTE_URL__" --replace_string="${domain}${path_url%/}" --target_file="../conf/haste.sh" haste_url="${domain}${path_url}"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh" ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
cp ../conf/haste.sh /usr/bin/$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -146,8 +145,9 @@ cp ../conf/haste.sh /usr/bin/$app
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chown -R root: $final_path chmod 750 "$final_path"
chown -R $app: "$final_path/static" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app: $data_path chown -R $app: $data_path
chmod +x /usr/bin/$app chmod +x /usr/bin/$app

View file

@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -75,7 +76,7 @@ ynh_secure_remove --file="/usr/bin/$app"
# REMOVE DATADIR DIRECTORY # REMOVE DATADIR DIRECTORY
#================================================= #=================================================
ynh_secure_remove --file="/home/yunohost.app/$app" ynh_secure_remove --file="$data_path"
#================================================= #=================================================
# REMOVE NODEJS # REMOVE NODEJS

View file

@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -72,7 +73,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_restore_file "/home/yunohost.app/$app" ynh_restore_file "$data_path"
#================================================= #=================================================
# RESTORE BINARY # RESTORE BINARY
@ -84,9 +85,10 @@ ynh_restore_file --origin_path="/usr/bin/$app"
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chown -R root: $final_path chmod 750 "$final_path"
chown -R $app: "$final_path/static" chmod -R o-rwx "$final_path"
chown -R $app: "/home/yunohost.app/$app" chown -R $app:www-data "$final_path"
chown -R $app: "$data_path"
chmod +x /usr/bin/$app chmod +x /usr/bin/$app
#================================================= #=================================================

View file

@ -19,6 +19,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path_url) path_url=$(ynh_app_setting_get --app=$app --key=path_url)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -37,6 +38,13 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi fi
# If data_path doesn't exist, create it
if [ -z "$data_path" ]; then
data_path="/home/yunohost.app/${app}"
mkdir -p "$data_path"
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
fi
# Cleaning legacy permissions # Cleaning legacy permissions
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
@ -76,7 +84,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=7 ynh_script_progression --message="Upgrading source files..." --weight=7
# 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 --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path" --keep="$final_path/config.js"
fi fi
#================================================= #=================================================
@ -134,10 +142,6 @@ ynh_add_systemd_config
# UPGRADE HASTE CONFIGURATION # UPGRADE HASTE CONFIGURATION
#================================================= #=================================================
# Define app's data directory
data_path="/home/yunohost.app/$app"
ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js"
# Replace ajax.googleapis by local file # Replace ajax.googleapis by local file
cp ../sources/jquery.min.js "$final_path/static/jquery.min.js" cp ../sources/jquery.min.js "$final_path/static/jquery.min.js"
@ -147,9 +151,8 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/
# UPGRADE HASTE BINARY # UPGRADE HASTE BINARY
#================================================= #=================================================
ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain}${path_url}" --target_file="../conf/haste.sh" haste_url="${domain}${path_url}"
ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app"
cp ../conf/haste.sh /usr/bin/$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -157,8 +160,9 @@ cp ../conf/haste.sh /usr/bin/$app
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
chown -R root: $final_path chmod 750 "$final_path"
chown -R $app: "$final_path/static" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chown -R $app: $data_path chown -R $app: $data_path
chmod +x /usr/bin/$app chmod +x /usr/bin/$app