1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/etherpad_ynh.git synced 2024-09-03 18:36:10 +02:00
This commit is contained in:
ericgaspar 2023-12-11 07:52:21 +01:00
parent c441f66905
commit af75ec924e
4 changed files with 79 additions and 41 deletions

View file

@ -36,44 +36,6 @@ ynh_setup_source --dest_dir=$install_dir
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
#=================================================
# INSTALL ETHERPAD
#=================================================
ynh_script_progression --message="Installing $app..." --weight=10
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH src/bin/installDeps.sh
popd
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=6
ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
chmod 400 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
if [ "$export" = "abiword" ]
then
# Get AbiWord binary path
abiword_path=`which abiword`
# Set the path of AbiWord into Etherpad config
ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$install_dir/settings.json"
elif [ "$export" = "libreoffice" ]
then
# Get soffice binary path
soffice_path=`which soffice`
# Set the path of soffice into Etherpad config
ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$install_dir/settings.json"
fi
ynh_store_file_checksum --file="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
chmod 400 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -90,6 +52,41 @@ ynh_use_logrotate
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log" yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=6
abiword_path="null"
soffice_path="null"
if [[ "$export" == "abiword" ]]
then
abiword_path="\"$(which abiword)\""
elif [[ "$export" == "libreoffice" ]]
then
soffice_path="\"$(which soffice)\""
fi
ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#=================================================
# INSTALL ETHERPAD
#=================================================
ynh_script_progression --message="Installing $app..." --weight=10
pushd $install_dir
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh
popd
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
#================================================= #=================================================

View file

@ -19,7 +19,12 @@ ynh_restore_file --origin_path="$install_dir"
# Restore permissions on app files # Restore permissions on app files
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir" chown -R $app:www-data "$install_dir"
chmod 400 $install_dir/credentials.json
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES

View file

@ -56,6 +56,31 @@ ynh_use_logrotate --non-append
yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log" yunohost service add $app --description="Collaborative editor" --log="/var/log/$app/$app.log"
#=================================================
# CONFIGURE ETHERPAD
#=================================================
ynh_script_progression --message="Configure $app..." --weight=3
abiword_path="null"
soffice_path="null"
if [[ "$export" == "abiword" ]]
then
abiword_path="\"$(which abiword)\""
elif [[ "$export" == "libreoffice" ]]
then
soffice_path="\"$(which soffice)\""
fi
ynh_add_config --template="settings.json" --destination="$install_dir/settings.json"
ynh_add_config --template="credentials.json" --destination="$install_dir/credentials.json"
chmod 600 "$install_dir/settings.json"
chown $app:$app "$install_dir/settings.json"
chmod 600 "$install_dir/credentials.json"
chown $app:$app "$install_dir/credentials.json"
#================================================= #=================================================
# INSTALL ETHERPAD # INSTALL ETHERPAD
#================================================= #=================================================
@ -63,7 +88,7 @@ ynh_script_progression --message="Installing $app..." --weight=90
pushd $install_dir pushd $install_dir
ynh_use_nodejs ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH src/bin/installDeps.sh ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ETHERPAD_PRODUCTION=true src/bin/installDeps.sh
popd popd
#================================================= #=================================================

View file

@ -6,4 +6,15 @@ test_format = 1.0
# Commits to test upgrade from # Commits to test upgrade from
# ------------------------------- # -------------------------------
args.export = "none"
args.password = "##SuperAdminPassword##"
#test_upgrade_from.96653aee9379d579a655777ac274355f4afca61c.name = "Upgrade from 5.4" #test_upgrade_from.96653aee9379d579a655777ac274355f4afca61c.name = "Upgrade from 5.4"
[with_abiword]
args.export = "abiword"
only = ["install.root"]
[with_libreoffice]
args.export = "libreoffice"
only = ["install.root"]