1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/movim_ynh.git synced 2024-09-03 19:46:19 +02:00

[fix] Handle the upgrade from the current app

This commit is contained in:
Jérôme Lebleu 2016-07-10 20:36:22 +02:00
parent 2123e49f22
commit 8a20550a1c

View file

@ -22,6 +22,27 @@ timezone=`cat /etc/timezone`
|| ynh_die "Could not detect timezone, please check /etc/timezone." \
&& echo "Detected timezone: $timezone"
# Init git repository as needed
if [ ! -d "${DESTDIR}/.git" ]; then
tmp_path=/tmp/movim-git
sudo rm -rf "$tmp_path"
# Download Movim source code
(git clone --quiet "$GIT_REPO" "$tmp_path" \
&& cd "$tmp_path" && git checkout --quiet "$HEAD_COMMIT") \
|| ynh_die "Unable to download Movim source code."
sudo cp "${DESTDIR}/config/db.inc.php" "${tmp_path}/config/db.inc.php"
# Replace current source code
sudo rm -rf "$DESTDIR"
sudo mv "$tmp_path" "$DESTDIR"
sudo chown -R movim:www-data "$DESTDIR"
# Install composer for PHP dependencies
curl -sS https://getcomposer.org/installer \
| exec_cmd php -- --quiet --install-dir="$DESTDIR"
fi
# Update Movim source code
(exec_cmd git fetch --quiet origin \
&& exec_cmd git reset --quiet --hard "$HEAD_COMMIT") \