mirror of
https://github.com/YunoHost-Apps/movim_ynh.git
synced 2024-09-03 19:46:19 +02:00
use ynh_setup_source instead of git
This commit is contained in:
parent
5836e86f8e
commit
626f858b2e
5 changed files with 28 additions and 52 deletions
4
conf/app.src
Normal file
4
conf/app.src
Normal file
|
@ -0,0 +1,4 @@
|
|||
SOURCE_URL=https://github.com/movim/movim/archive/v0.13.tar.gz
|
||||
SOURCE_SUM=7aa5b2b6cd97e87a440981cfb6788a6f04ffd5eb4545026c49e1c61771593d11
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
|
@ -3,12 +3,6 @@
|
|||
# Common variables
|
||||
#
|
||||
|
||||
# Git repository of Movim
|
||||
GIT_REPO="https://github.com/movim/movim"
|
||||
|
||||
# Commit to checkout
|
||||
HEAD_COMMIT="ee249f1e37b548c71b9a339dd358fbd2136e3291"
|
||||
|
||||
# App package root directory should be the parent folder
|
||||
PKGDIR=$(cd ../; pwd)
|
||||
|
||||
|
@ -23,11 +17,11 @@ exec_cmd() {
|
|||
&& sudo sudo -u movim "$@")
|
||||
}
|
||||
|
||||
# Apply the SSO patch to Movim source code
|
||||
# usage: apply_sso_patch
|
||||
apply_sso_patch() {
|
||||
local patch_path="/tmp/sso-logout.patch"
|
||||
cp -f "${PKGDIR}/patches/sso-logout.patch" "$patch_path"
|
||||
exec_cmd git apply "$patch_path"
|
||||
ynh_secure_remove "$patch_path"
|
||||
# Undo the SSO patch to Movim source code (applied by default with ynh_setup_source)
|
||||
# usage: undo_sso_patch
|
||||
undo_sso_patch() {
|
||||
(
|
||||
cd $final_path
|
||||
patch -p1 -R < $YNH_CWD/../sources/patches/app-00-sso-logout.patch
|
||||
)
|
||||
}
|
||||
|
|
|
@ -106,12 +106,7 @@ ynh_install_app_dependencies php5-gd php5-curl php5-imagick php5-cli php5-zmq
|
|||
|
||||
ynh_app_setting_set "$app" final_path "$final_path"
|
||||
|
||||
# Download Movim source code
|
||||
tmp_path=/tmp/movim-git
|
||||
ynh_secure_remove "$tmp_path"
|
||||
(git clone "$GIT_REPO" "$tmp_path" \
|
||||
&& cd "$tmp_path" && git checkout "$HEAD_COMMIT") \
|
||||
|| ynh_die "Unable to download Movim source code."
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SET CONFIGURATION FILE
|
||||
|
@ -119,17 +114,14 @@ ynh_secure_remove "$tmp_path"
|
|||
|
||||
# TODO: add checksum
|
||||
# Set database configuration
|
||||
cp "${tmp_path}/config/"{db.example.inc.php,db.inc.php}
|
||||
cp "$final_path/config/"{db.example.inc.php,db.inc.php}
|
||||
ynh_replace_string "'username' => 'username'" "'username' => '$db_user'" \
|
||||
"${tmp_path}/config/db.inc.php"
|
||||
"$final_path/config/db.inc.php"
|
||||
ynh_replace_string "'password' => 'password'" "'password' => '$db_pwd'" \
|
||||
"${tmp_path}/config/db.inc.php"
|
||||
"$final_path/config/db.inc.php"
|
||||
## TODO: consider installation in a subpath
|
||||
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||
"${tmp_path}/app/assets/js/movim_websocket.js"
|
||||
|
||||
# Move Movim source code
|
||||
mv "$tmp_path" "$final_path"
|
||||
"$final_path/app/assets/js/movim_websocket.js"
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -147,6 +139,10 @@ find "${final_path}/" -type f -print0 | xargs -0 chmod 0644
|
|||
find "${final_path}/" -type d -print0 | xargs -0 chmod 0755
|
||||
chmod 400 "${final_path}/config/db.inc.php"
|
||||
|
||||
#=================================================
|
||||
# Install PHP dependencies using composer
|
||||
#=================================================
|
||||
|
||||
# Install PHP dependencies using composer
|
||||
(curl -sS https://getcomposer.org/installer \
|
||||
| exec_cmd php -- --install-dir="$final_path" \
|
||||
|
@ -212,9 +208,9 @@ cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/movim.conf
|
|||
if [[ "$ssoenabled" = "No" ]]; then
|
||||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
exec_cmd php mud.php config --xmppwhitelist="$domain"
|
||||
undo_sso_patch
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
apply_sso_patch
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -71,33 +71,12 @@ ynh_install_app_dependencies php5-zmq
|
|||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
# Init git repository as needed
|
||||
if [ ! -d "${final_path}/.git" ]; then
|
||||
tmp_path=/tmp/movim-git
|
||||
ynh_secure_remove "$tmp_path"
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
# Download Movim source code
|
||||
(git clone "$GIT_REPO" "$tmp_path" \
|
||||
&& cd "$tmp_path" && git checkout "$HEAD_COMMIT") \
|
||||
|| ynh_die "Unable to download Movim source code."
|
||||
cp "${final_path}/config/db.inc.php" "${tmp_path}/config/db.inc.php"
|
||||
chown -R movim:www-data "$final_path"
|
||||
|
||||
# Replace current source code
|
||||
ynh_secure_remove "$final_path"
|
||||
mv "$tmp_path" "$final_path"
|
||||
chown -R movim:www-data "$final_path"
|
||||
|
||||
# Install composer for PHP dependencies
|
||||
curl -sS https://getcomposer.org/installer \
|
||||
| exec_cmd php -- --install-dir="$final_path"
|
||||
fi
|
||||
|
||||
# Update Movim source code
|
||||
(exec_cmd git fetch origin \
|
||||
&& exec_cmd git reset --hard "$HEAD_COMMIT") \
|
||||
|| ynh_die "Unable to download Movim source code."
|
||||
## TODO: consider installation in a subpath
|
||||
exec_cmd ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||
ynh_replace_string "'/ws/'" "'${path_url%/}/ws/'" \
|
||||
"${final_path}/app/assets/js/movim_websocket.js"
|
||||
|
||||
#=================================================
|
||||
|
@ -121,6 +100,9 @@ chmod 400 "${final_path}/config/db.inc.php"
|
|||
# install PHP dependencies
|
||||
#=================================================
|
||||
|
||||
curl -sS https://getcomposer.org/installer \
|
||||
| exec_cmd php -- --install-dir="$final_path"
|
||||
|
||||
# Update PHP dependencies using composer
|
||||
(exec_cmd php composer.phar config --global discard-changes true \
|
||||
&& exec_cmd php composer.phar install --no-interaction) \
|
||||
|
@ -160,9 +142,9 @@ if [[ "$ssoenabled" = "No" ]]; then
|
|||
ynh_app_setting_set "$app" skipped_uris "/"
|
||||
exec_cmd php mud.php config --xmppwhitelist=$domain
|
||||
yunohost app ssowatconf
|
||||
undo_sso_patch
|
||||
else
|
||||
ynh_app_setting_set "$app" unprotected_uris "/"
|
||||
apply_sso_patch
|
||||
fi
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue