mirror of
https://github.com/YunoHost-Apps/owncloud_ynh.git
synced 2024-09-03 19:56:25 +02:00
Merge 08270a3aec
into 9cd4b0efaa
This commit is contained in:
commit
44a9647e2a
7 changed files with 5 additions and 116 deletions
|
@ -17,7 +17,7 @@ code = "https://github.com/owncloud/ocis"
|
||||||
cpe = "cpe:2.3:a:owncloud:owncloud"
|
cpe = "cpe:2.3:a:owncloud:owncloud"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.20"
|
yunohost = ">= 11.2.29"
|
||||||
helpers_version = "2.1"
|
helpers_version = "2.1"
|
||||||
architectures = ["amd64", "arm64", "armhf", "i386"]
|
architectures = ["amd64", "arm64", "armhf", "i386"]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
|
|
|
@ -26,9 +26,6 @@ ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_config_add --template=".env" --destination="$install_dir/ocis.env"
|
ynh_config_add --template=".env" --destination="$install_dir/ocis.env"
|
||||||
|
|
||||||
chmod 400 "$install_dir/ocis.env"
|
|
||||||
chown $app:$app "$install_dir/ocis.env"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# In simple cases, you don't need a config script.
|
|
||||||
|
|
||||||
# With a simple config_panel.toml, you can write in the app settings, in the
|
|
||||||
|
|
||||||
# upstream config file or replace complete files (logo ...) and restart services.
|
|
||||||
|
|
||||||
# The config scripts allows you to go further, to handle specific cases
|
|
||||||
|
|
||||||
# (validation of several interdependent fields, specific getter/setter for a value,
|
|
||||||
# display dynamic informations or choices, pre-loading of config type .cube... ).
|
|
||||||
|
|
||||||
source /usr/share/yunohost/helpers
|
|
||||||
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC GETTERS FOR TOML SHORT KEY
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
get__amount() {
|
|
||||||
# Here we can imagine to have an API call to stripe to know the amount of donation during a month
|
|
||||||
local amount = 200
|
|
||||||
|
|
||||||
# It's possible to change some properties of the question by overriding it:
|
|
||||||
if [ $amount -gt 100 ]
|
|
||||||
then
|
|
||||||
cat << EOF
|
|
||||||
style: success
|
|
||||||
value: $amount
|
|
||||||
ask:
|
|
||||||
en: A lot of donation this month: **$amount €**
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
cat << EOF
|
|
||||||
style: danger
|
|
||||||
value: $amount
|
|
||||||
ask:
|
|
||||||
en: Not so much donation this month: $amount €
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get__prices() {
|
|
||||||
local prices = "$(grep "DONATION\['" "$final_path/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
|
|
||||||
if [ "$prices" == "," ];
|
|
||||||
then
|
|
||||||
# Return YNH_NULL if you prefer to not return a value at all.
|
|
||||||
echo YNH_NULL
|
|
||||||
else
|
|
||||||
echo $prices
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
|
|
||||||
#=================================================
|
|
||||||
validate__publishable_key() {
|
|
||||||
|
|
||||||
# We can imagine here we test if the key is really a publisheable key
|
|
||||||
(is_secret_key $publishable_key) &&
|
|
||||||
echo 'This key seems to be a secret key'
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETTERS FOR TOML SHORT KEYS
|
|
||||||
#=================================================
|
|
||||||
set__prices() {
|
|
||||||
|
|
||||||
#---------------------------------------------
|
|
||||||
# IMPORTANT: setter are trigger only if a change is detected
|
|
||||||
#---------------------------------------------
|
|
||||||
for price in $(echo $prices | sed "s/,/ /"); do
|
|
||||||
frequency=$(echo $price | cut -d/ -f1)
|
|
||||||
currency=$(echo $price | cut -d/ -f2)
|
|
||||||
price_id=$(echo $price | cut -d/ -f3)
|
|
||||||
sed "d/DONATION\['$frequency'\]\['$currency'\]" "$final_path/settings.py"
|
|
||||||
|
|
||||||
echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$final_path/settings.py"
|
|
||||||
done
|
|
||||||
|
|
||||||
#---------------------------------------------
|
|
||||||
# IMPORTANT: to be able to upgrade properly, you have to saved the value in settings too
|
|
||||||
#---------------------------------------------
|
|
||||||
ynh_app_setting_set $app prices $prices
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
ynh_app_config_run $1
|
|
|
@ -10,8 +10,6 @@ ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
chmod +x $install_dir/ocis
|
chmod +x $install_dir/ocis
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -32,9 +30,6 @@ ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env"
|
ynh_config_add --template=".env" --destination="$data_dir/config/ocis.env"
|
||||||
|
|
||||||
chmod 400 "$data_dir/config/ocis.env"
|
|
||||||
chown $app:$app "$data_dir/config/ocis.env"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL OWNCLOUD
|
# INSTALL OWNCLOUD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -44,9 +39,7 @@ pushd "$install_dir"
|
||||||
./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/
|
./ocis init --insecure=true --force-overwrite=true --admin-password=$password --config-path=$data_dir/config/
|
||||||
popd
|
popd
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
chmod 400 "$data_dir/config/ocis.yaml"
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
chown $app:$app "$data_dir/config/ocis.yaml"
|
chown $app:$app "$data_dir/config/ocis.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -6,8 +6,6 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEMD SERVICE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression "Removing system configurations related to $app..."
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
if ynh_hide_warnings yunohost service status $app >/dev/null
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
|
|
|
@ -10,8 +10,7 @@ ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore "$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
chown -R "$app:www-data" "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
chmod +x $install_dir/ocis
|
chmod +x $install_dir/ocis
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -22,6 +21,8 @@ ynh_script_progression "Restoring the data directory..."
|
||||||
ynh_restore "$data_dir"
|
ynh_restore "$data_dir"
|
||||||
|
|
||||||
chown -R $app:www-data "$data_dir"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
chmod 400 "$data_dir/config/ocis.yaml"
|
||||||
|
chown $app:$app "$data_dir/config/ocis.yaml"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
|
|
|
@ -26,8 +26,6 @@ ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
ynh_setup_source --dest_dir="$install_dir" --full_replace
|
||||||
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
chmod +x $install_dir/ocis
|
chmod +x $install_dir/ocis
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,9 +46,6 @@ ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_config_add --template=".env" --destination="$install_dir/ocis.env"
|
ynh_config_add --template=".env" --destination="$install_dir/ocis.env"
|
||||||
|
|
||||||
chmod 400 "$install_dir/ocis.env"
|
|
||||||
chown $app:$app "$install_dir/ocis.env"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue