fix wrong configuration script order
This commit is contained in:
parent
2656a675a4
commit
a37de1795c
|
@ -216,6 +216,42 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.conf"
|
||||||
# ...
|
# ...
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADD A CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
||||||
|
|
||||||
|
### You can add specific configuration files.
|
||||||
|
###
|
||||||
|
### Typically, put your template conf file in ../conf/your_config_file
|
||||||
|
### The template may contain strings such as __FOO__ or __FOO_BAR__,
|
||||||
|
### which will automatically be replaced by the values of $foo and $foo_bar
|
||||||
|
###
|
||||||
|
### ynh_add_config will also keep track of the config file's checksum,
|
||||||
|
### which later during upgrade may allow to automatically backup the config file
|
||||||
|
### if it's found that the file was manually modified
|
||||||
|
###
|
||||||
|
### Check the documentation of `ynh_add_config` for more info.
|
||||||
|
|
||||||
|
ynh_add_config --template="mount_disk.sh" --destination="$final_path/mount_disk.sh"
|
||||||
|
ynh_add_config --template="umount_disk.sh" --destination="$final_path/umount_disk.sh"
|
||||||
|
ynh_add_config --template="garage.toml" --destination="$final_path/garage.toml"
|
||||||
|
chmod +x "$final_path/mount_disk.sh" "$final_path/umount_disk.sh"
|
||||||
|
|
||||||
|
# FIXME: this should be handled by the core in the future
|
||||||
|
# You may need to use chmod 600 instead of 400,
|
||||||
|
# for example if the app is expected to be able to modify its own config
|
||||||
|
chmod 600 "$final_path/garage.toml"
|
||||||
|
chown $app:$app "$final_path/garage.toml"
|
||||||
|
|
||||||
|
### For more complex cases where you want to replace stuff using regexes,
|
||||||
|
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
|
||||||
|
### When doing so, you also need to manually call ynh_store_file_checksum
|
||||||
|
###
|
||||||
|
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
|
||||||
|
### ynh_store_file_checksum --file="$final_path/some_config_file"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -259,40 +295,6 @@ if [ "$virtualisation" = "true" ]
|
||||||
then
|
then
|
||||||
$final_path/umount_disk.sh $nbd_index
|
$final_path/umount_disk.sh $nbd_index
|
||||||
fi
|
fi
|
||||||
#=================================================
|
|
||||||
# ADD A CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Adding a configuration file..." --time --weight=1
|
|
||||||
|
|
||||||
### You can add specific configuration files.
|
|
||||||
###
|
|
||||||
### Typically, put your template conf file in ../conf/your_config_file
|
|
||||||
### The template may contain strings such as __FOO__ or __FOO_BAR__,
|
|
||||||
### which will automatically be replaced by the values of $foo and $foo_bar
|
|
||||||
###
|
|
||||||
### ynh_add_config will also keep track of the config file's checksum,
|
|
||||||
### which later during upgrade may allow to automatically backup the config file
|
|
||||||
### if it's found that the file was manually modified
|
|
||||||
###
|
|
||||||
### Check the documentation of `ynh_add_config` for more info.
|
|
||||||
|
|
||||||
ynh_add_config --template="mount_disk.sh" --destination="$final_path/mount_disk.sh"
|
|
||||||
ynh_add_config --template="umount_disk.sh" --destination="$final_path/umount_disk.sh"
|
|
||||||
ynh_add_config --template="garage.toml" --destination="$final_path/garage.toml"
|
|
||||||
chmod +x "$final_path/mount_disk.sh" "$final_path/umount_disk.sh"
|
|
||||||
|
|
||||||
# FIXME: this should be handled by the core in the future
|
|
||||||
# You may need to use chmod 600 instead of 400,
|
|
||||||
# for example if the app is expected to be able to modify its own config
|
|
||||||
chmod 600 "$final_path/garage.toml"
|
|
||||||
chown $app:$app "$final_path/garage.toml"
|
|
||||||
|
|
||||||
### For more complex cases where you want to replace stuff using regexes,
|
|
||||||
### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
|
|
||||||
### When doing so, you also need to manually call ynh_store_file_checksum
|
|
||||||
###
|
|
||||||
### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/some_config_file"
|
|
||||||
### ynh_store_file_checksum --file="$final_path/some_config_file"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
|
|
|
@ -31,7 +31,6 @@ 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)
|
||||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||||
weight=$(ynh_app_setting_get --app=$app --key=weight)
|
|
||||||
virtualisation=$(ynh_app_setting_get --app=$app --key=virtualisation)
|
virtualisation=$(ynh_app_setting_get --app=$app --key=virtualisation)
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,6 +78,8 @@ mkdir -p "$datadir/data"
|
||||||
|
|
||||||
if [ "$virtualisation" = "true" ]
|
if [ "$virtualisation" = "true" ]
|
||||||
then
|
then
|
||||||
|
# Define and install dependencies
|
||||||
|
ynh_install_app_dependencies $pkg_dependencies_virtualisation
|
||||||
# to be sure to not exceed size limit, i use a virtual disk with a fix size to have a max limit size.
|
# to be sure to not exceed size limit, i use a virtual disk with a fix size to have a max limit size.
|
||||||
qemu-img create -f qcow2 $datadir/garage_data.qcow2 "$weight"G
|
qemu-img create -f qcow2 $datadir/garage_data.qcow2 "$weight"G
|
||||||
nbd_index=$($final_path/mount_disk.sh "$datadir" true)
|
nbd_index=$($final_path/mount_disk.sh "$datadir" true)
|
||||||
|
@ -105,8 +106,6 @@ chown -R $app:$app "$datadir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
ynh_script_progression --message="Reinstalling dependencies..." --time --weight=1
|
||||||
|
|
||||||
# Define and install dependencies
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
|
|
||||||
# Open the port
|
# Open the port
|
||||||
ynh_script_progression --message="Configuring firewall..." --time --weight=1
|
ynh_script_progression --message="Configuring firewall..." --time --weight=1
|
||||||
|
@ -142,7 +141,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
||||||
|
|
||||||
yunohost service add --needs_exposed_ports $app --description="s3 storage" --log="/var/log/$app/$app.log"
|
yunohost service add --needs_exposed_ports $port --description="s3 storage" --log="/var/log/$app/$app.log" $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
|
@ -185,7 +185,7 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1
|
||||||
|
|
||||||
yunohost service add --needs_exposed_ports $app --description="s3 storage" --log="/var/log/$app/$app.log"
|
yunohost service add --needs_exposed_ports $port --description="s3 storage" --log="/var/log/$app/$app.log" $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user