mirror of
https://github.com/YunoHost-Apps/mobilizon_ynh.git
synced 2024-09-03 19:46:19 +02:00
Fix permissions for config file + fix backup/restore of configuration during upgrade ?
This commit is contained in:
parent
fbd3d330c5
commit
5c13c6bcd7
2 changed files with 6 additions and 10 deletions
|
@ -144,7 +144,7 @@ chown -R "$app":"$app" "$final_path"
|
||||||
config="$final_path/$app/config/prod.secret.exs"
|
config="$final_path/$app/config/prod.secret.exs"
|
||||||
|
|
||||||
pushd $final_path/$app/js
|
pushd $final_path/$app/js
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
sudo -u $app env PATH=$PATH yarn install
|
sudo -u $app env PATH=$PATH yarn install
|
||||||
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
|
sudo -u $app env PATH=$PATH NODE_BUILD_MEMORY=1024 yarn run build
|
||||||
popd
|
popd
|
||||||
|
@ -160,6 +160,7 @@ popd
|
||||||
cat "../conf/ldap.exs" >> "$config"
|
cat "../conf/ldap.exs" >> "$config"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
|
chown o-rwx $config
|
||||||
ynh_secure_remove --file="/tmp/setup_db.psql"
|
ynh_secure_remove --file="/tmp/setup_db.psql"
|
||||||
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
sudo -u "$app" MIX_ENV=prod mix ecto.migrate
|
||||||
sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password"
|
sudo -u "$app" MIX_ENV=prod mix mobilizon.users.new "$admin_email" --admin --password "$password"
|
||||||
|
|
|
@ -125,10 +125,7 @@ then
|
||||||
tmpdir="$(mktemp -d)"
|
tmpdir="$(mktemp -d)"
|
||||||
|
|
||||||
# Backup the config file in the temp dir
|
# Backup the config file in the temp dir
|
||||||
if [ -s "$final_path/$app/config/prod.exs" ]
|
cp -a "$final_path/$app/config/prod.secret.exs" "$tmpdir/prod.secret.exs"
|
||||||
then
|
|
||||||
cp -a "$final_path/$app/config/prod.exs" "$tmpdir/prod.secret.exs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path/$app"
|
ynh_secure_remove --file="$final_path/$app"
|
||||||
|
@ -137,10 +134,7 @@ then
|
||||||
ynh_setup_source --dest_dir="$final_path/$app"
|
ynh_setup_source --dest_dir="$final_path/$app"
|
||||||
|
|
||||||
#Copy the admin saved settings from tmp directory to final path
|
#Copy the admin saved settings from tmp directory to final path
|
||||||
if [ -s "$tmpdir/prod.exs" ]
|
cp -a "$tmpdir/prod.secret.exs" "$final_path/$app/config/prod.secret.exs"
|
||||||
then
|
|
||||||
cp -a "$tmpdir/prod.exs" "$final_path/$app/config/prod.secret.exs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the tmp directory securely
|
# Remove the tmp directory securely
|
||||||
ynh_secure_remove --file="$tmpdir"
|
ynh_secure_remove --file="$tmpdir"
|
||||||
|
@ -183,6 +177,7 @@ ynh_script_progression --message="Modifying a config file..."
|
||||||
|
|
||||||
config="$final_path/$app/config/prod.secret.exs"
|
config="$final_path/$app/config/prod.secret.exs"
|
||||||
ynh_backup_if_checksum_is_different --file="$config"
|
ynh_backup_if_checksum_is_different --file="$config"
|
||||||
|
chown o-rwx $config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MAKE SETUP
|
# MAKE SETUP
|
||||||
|
@ -193,7 +188,7 @@ chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
pushd $final_path/$app/js
|
pushd $final_path/$app/js
|
||||||
ynh_script_progression --message="Building NodeJS..."
|
ynh_script_progression --message="Building NodeJS..."
|
||||||
ynh_use_nodejs
|
ynh_use_nodejs
|
||||||
sudo -u $app env PATH=$PATH yarn install
|
sudo -u $app env PATH=$PATH yarn install
|
||||||
sudo -u $app env PATH=$PATH yarn run build
|
sudo -u $app env PATH=$PATH yarn run build
|
||||||
popd
|
popd
|
||||||
|
|
Loading…
Add table
Reference in a new issue