1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00
This commit is contained in:
Éric Gaspar 2023-08-21 09:55:30 +02:00
parent 57c3bb36f9
commit 329a3b13cb
4 changed files with 24 additions and 81 deletions

View file

@ -5,7 +5,7 @@ name = "Friendica"
description.en = "Social Communication Server"
description.fr = "Serveur de Communication Social"
version = "2023.09~ynh1"
version = "2023.05~ynh1"
maintainers = []
@ -46,6 +46,18 @@ ram.runtime = "50M"
default = "en"
[resources]
[resources.sources]
[resources.sources.main]
url = "https://github.com/friendica/friendica/archive/refs/tags/2023.05.tar.gz"
sha256 = "727a8fdab6a2f6424d3dbc895496447e750eb0f8e1e11b70f1e229a7e3c9a31d"
autoupdate.strategy = "latest_github_tag"
[resources.sources.addons]
url = "https://github.com/friendica/friendica-addons/archive/refs/tags/2023.05.tar.gz"
sha256 = "df29aed28c0208e162c76f91949d0c3a0f77fe09853fe1a6d854b9956075d8a0"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
[resources.install_dir]

View file

@ -4,11 +4,6 @@
# COMMON VARIABLES
#=================================================
# commit hashes
# 2023.08
version_commit="2dbfb070083ec395bf5d24ec89fe96b282c6a12d"
addons_version_commit="f2cc0312ca9a95d99a8330452848180792bf9227"
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -28,26 +28,13 @@ ynh_app_setting_set --app=$app --key=email --value=$email
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=5
git config --system --add safe.directory $install_dir
# 1 - Clone stable repo
git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir"
# Reset branch to the level of update we needed
pushd "$install_dir"
git reset --hard --quiet $version_commit
popd
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
# Copy .htaccess-dist to ..htaccess
cp -f "$install_dir/.htaccess-dist" "$install_dir/.htaccess"
# 2 - Clone addons repo
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon"
# Reset addons branch to the level of update we needed
pushd "$install_dir/addon"
git reset --hard --quiet $addons_version_commit
popd
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
@ -59,6 +46,9 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
# Create a dedicated PHP-FPM configy
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# ADD A CONFIGURATION
#=================================================
@ -67,14 +57,6 @@ ynh_script_progression --message="Adding the LDAP Auth addon configuration file.
# LDAP addon config
ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir/config/addon.config.php"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP_FPM..." --weight=4
# Create a dedicated PHP-FPM configy
ynh_add_fpm_config --usage=low --footprint=low
# 3 - some extra folders
mkdir -p "$install_dir/view/smarty3"
chmod -R 775 "$install_dir/view/smarty3"

View file

@ -54,63 +54,17 @@ fi
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=3
# Check if the repo can be updated with git
if [ `cd $install_dir && git rev-parse --is-inside-work-tree &> /dev/null` ];
then
# Update through Git
pushd "$install_dir"
git fetch
git checkout stable
git pull
git reset --hard $version_commit
popd
pushd "$install_dir/addon"
git fetch
git checkout stable
git pull
git reset --hard $addons_version_commit
popd
# If Git is not present upgrade through manual method
else
ynh_script_progression --message="Upgrading source files..." --weight=1
# Create a temporary directory and backup smarty3 folder
tmpdir="$(mktemp -d)"
cp -a "$install_dir/view/smarty3" "$tmpdir/smarty3"
# Remove the app directory securely
ynh_secure_remove --file="$install_dir"
# 1 - Clone stable repo
git clone --quiet https://github.com/friendica/friendica.git -b stable "$install_dir"
# Reset branch to the level of update we needed
pushd "$install_dir"
git reset --hard --quiet $version_commit
popd
# 2 - Clone addons repo
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$install_dir/addon"
# Reset addons branch to the level of update we needed
pushd "$install_dir/addon"
git reset --hard --quiet $addons_version_commit
popd
# Restore the smarty3 folder
cp -a "$tmpdir/smarty3" "$install_dir/view/smarty3"
ynh_secure_remove --file="$tmpdir"
fi
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep ="config/local.config.php view/smarty3"
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
fi
# Copy config file for correct place
ynh_add_config --template="../conf/local-sample.config.php" --destination="$install_dir/config/local.config.php"
chmod 750 "$install_dir"
chmod -R 775 "$install_dir/view/smarty3"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
# 3 - some extra folders
chmod -R 775 "$install_dir/view/smarty3"
#=================================================
# NGINX CONFIGURATION
#=================================================