mirror of
https://github.com/YunoHost-Apps/monica_ynh.git
synced 2024-09-03 19:46:23 +02:00
add helper, update readme
This commit is contained in:
parent
1346e34c30
commit
bb7b70e755
2 changed files with 32 additions and 13 deletions
|
@ -8,4 +8,8 @@ Personal Relationship Manager - a new kind of CRM to organize interactions with
|
|||
## TODO
|
||||
|
||||
* [] LDAP/SSO support
|
||||
|
||||
* As for now, the specified admin user with the password `admin` is created in monica
|
||||
* [] Make monica installable into subdirectory (eg. https://example.com/monica/)
|
||||
* Currently it is only possible to install monica into the root of a domain (eg. https://example.com/)
|
||||
* This is due to a limitation in monica, not yunohost!
|
||||
* See [here](https://github.com/monicahq/monica/issues/139) for the current progress.
|
||||
|
|
|
@ -15,18 +15,33 @@ PKGDIR=$(cd ../; pwd)
|
|||
# Common helpers
|
||||
#
|
||||
|
||||
# Download and extract monica sources to the given directory
|
||||
# usage: extract_monica_to DESTDIR
|
||||
extract_monica() {
|
||||
local DESTDIR=$1
|
||||
|
||||
# retrieve and extract monica tarball
|
||||
rc_tarball="${DESTDIR}/monica.tar.gz"
|
||||
wget -q -O "$rc_tarball" "$MONICA_SOURCE_URL" \
|
||||
|| ynh_die "Unable to download monica tarball"
|
||||
tar xf "$rc_tarball" -C "$DESTDIR" --strip-components 1 \
|
||||
|| ynh_die "Unable to extract monica tarball"
|
||||
sudo rm "$rc_tarball"
|
||||
# Remove a file or a directory securely
|
||||
#
|
||||
# usage: ynh_secure_remove path_to_remove
|
||||
# | arg: path_to_remove - File or directory to remove
|
||||
ynh_secure_remove () {
|
||||
path_to_remove=$1
|
||||
forbidden_path=" \
|
||||
/var/www \
|
||||
/home/yunohost.app"
|
||||
|
||||
if [[ "$forbidden_path" =~ "$path_to_remove" \
|
||||
# Match all paths or subpaths in $forbidden_path
|
||||
|| "$path_to_remove" =~ ^/[[:alnum:]]+$ \
|
||||
# Match all first level paths from / (Like /var, /root, etc...)
|
||||
|| "${path_to_remove:${#path_to_remove}-1}" = "/" ]]
|
||||
# Match if the path finishes by /. Because it seems there is an empty variable
|
||||
then
|
||||
echo "Avoid deleting $path_to_remove." >&2
|
||||
else
|
||||
if [ -e "$path_to_remove" ]
|
||||
then
|
||||
sudo rm -R "$path_to_remove"
|
||||
else
|
||||
echo "$path_to_remove wasn't deleted because it doesn't exist." >&2
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Execute a command as another user
|
||||
|
@ -167,7 +182,7 @@ ynh_remove_nodejs () {
|
|||
#
|
||||
|
||||
ynh_install_php7 () {
|
||||
sudo echo 'deb https://packages.dotdeb.org jessie all' > /etc/apt/sources.list.d/dotdeb.list
|
||||
echo "deb https://packages.dotdeb.org jessie all" | sudo tee --append "/etc/apt/sources.list.d/dotdeb.list"
|
||||
curl http://www.dotdeb.org/dotdeb.gpg | sudo apt-key add -
|
||||
ynh_package_update
|
||||
ynh_package_install apt-transport-https --no-install-recommends
|
||||
|
|
Loading…
Add table
Reference in a new issue