1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rss-bridge_ynh.git synced 2024-09-03 20:25:51 +02:00

Upgrade to upstream version 2017-08-03

This commit is contained in:
Jimmy Monin 2017-08-04 23:22:29 +02:00
parent 9689462279
commit 0cbb7e9897
3 changed files with 36 additions and 6 deletions

View file

@ -3,9 +3,9 @@ rss-bridge for Yunohost
This is a rss-bridge package for YunoHost. This is a rss-bridge package for YunoHost.
**Shipped version:** 0.2 **Shipped version:** 2017-08-03
[rss-bridge](https://github.com/RSS-Bridge/rss-bridge) rss-bridge is a PHP project capable of generating ATOM feeds for websites which don't have one. [rss-bridge](https://github.com/RSS-Bridge/rss-bridge) is a PHP project capable of generating ATOM feeds for websites which don't have one.
## Supported sites/pages (main) ## Supported sites/pages (main)

View file

@ -3,13 +3,13 @@
# #
# Package version # Package version
VERSION="0.2" VERSION="2017-08-03"
# Full sources tarball URL # Full sources tarball URL
SOURCE_URL="https://github.com/RSS-Bridge/rss-bridge/archive/v${VERSION}.tar.gz" SOURCE_URL="https://github.com/RSS-Bridge/rss-bridge/archive/${VERSION}.tar.gz"
# Full sources tarball checksum # Full sources tarball checksum
SOURCE_SHA256="23ec537e9d00c64bc6143231495377f2ef4dc72c6826faec0e0be3dcc7f20e41" SOURCE_SHA256="14fa20d68843c58dbe4ac24b07b8329a98b8429fd4aea343927e41518a374117"
# App package root directory should be the parent folder # App package root directory should be the parent folder
PKGDIR=$(cd ../; pwd) PKGDIR=$(cd ../; pwd)
@ -279,3 +279,31 @@ ynh_system_user_delete () {
echo "The user $1 was not found" >&2 echo "The user $1 was not found" >&2
fi fi
} }
# 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
}

View file

@ -58,6 +58,9 @@ ynh_system_user_create $app # Create dedicated user if not existing
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# Remove last version (we don't keep whitelist)
ynh_secure_remove "$final_path"
# Install files and set permissions # Install files and set permissions
sudo mv "$TMPDIR" "$final_path" sudo mv "$TMPDIR" "$final_path"
@ -66,7 +69,6 @@ sudo chown -R root: $final_path
sudo chown -R $app: $final_path/cache sudo chown -R $app: $final_path/cache
sudo chmod 755 $final_path sudo chmod 755 $final_path
[ -f $final_path/whitelist.txt ] && sudo rm $final_path/whitelist.txt
# Enable every bridge # Enable every bridge
for i in $final_path/bridges/*.php ; do for i in $final_path/bridges/*.php ; do
echo $(basename $i) | sed "s|Bridge.php$||g" | sudo tee -a $final_path/whitelist.txt echo $(basename $i) | sed "s|Bridge.php$||g" | sudo tee -a $final_path/whitelist.txt