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:
parent
2123e49f22
commit
8a20550a1c
1 changed files with 21 additions and 0 deletions
|
@ -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") \
|
||||
|
|
Loading…
Add table
Reference in a new issue