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

Add md5 check

This commit is contained in:
inrepublica 2016-05-30 22:28:35 +02:00
parent a3d6123809
commit 7b7bee5376
3 changed files with 27 additions and 12 deletions

View file

@ -5,6 +5,8 @@ set -eu
# Define app
app=phpsysinfo
version=3.2.5
md5_source=08875b31a9a7a662473d8cbe866059e7
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
@ -13,9 +15,6 @@ is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
display_mode=$YNH_APP_ARG_DISPLAY_MODE
# Version of PhpSysInfo
version=3.2.5
# Source YunoHost helpers
. /usr/share/yunohost/helpers
@ -30,8 +29,17 @@ ynh_app_setting_set "$app" display_mode "$display_mode"
sudo yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# Download source, untar and copy it
# Download source, check md5, untar, copy it
sudo wget https://github.com/phpsysinfo/phpsysinfo/archive/v$version.tar.gz -O /tmp/phpsysinfo.tar.gz
# Check md5
md5_check=($(md5sum /tmp/phpsysinfo.tar.gz))
if [ $md5_source != $md5_check ]
then
ynh_die "the download is corrupted (md5 different)"
fi
# untar and copy it
sudo tar -xvf /tmp/phpsysinfo.tar.gz -C /tmp/
final_path=/var/www/$app
sudo mkdir -p $final_path

View file

@ -13,7 +13,7 @@ domain=$(ynh_app_setting_get "$app" domain)
sudo rm -rf /var/www/$app
# Remove configuration files
sudo rm -f /etc/nginx/conf.d/$domain.d/phpsysinfo.conf
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
# Restart services
sudo service nginx reload

View file

@ -3,8 +3,10 @@
# Exit on command errors and treat unset variables as an error
set -eu
# See comments in install script
# Define app
app=phpsysinfo
version=3.2.5
md5_source=08875b31a9a7a662473d8cbe866059e7
# Source YunoHost helpers
. /usr/share/yunohost/helpers
@ -16,18 +18,23 @@ is_public=$(ynh_app_setting_get "$app" is_public)
language=$(ynh_app_setting_get "$app" language)
display_mode=$(ynh_app_setting_get "$app" display_mode)
# Version of PhpSysInfo
version=3.2.5
# Download source, untar and copy it
# Download source, check md5, untar, copy it
sudo wget https://github.com/phpsysinfo/phpsysinfo/archive/v$version.tar.gz -O /tmp/phpsysinfo.tar.gz
# Check md5
md5_check=($(md5sum /tmp/phpsysinfo.tar.gz))
if [ $md5_source != $md5_check ]
then
ynh_die "the download is corrupted (md5 different)"
fi
# untar and copy it
sudo tar -xvf /tmp/phpsysinfo.tar.gz -C /tmp/
final_path=/var/www/$app
sudo mkdir -p $final_path
sudo cp /tmp/phpsysinfo-$version/. $final_path
sudo cp -a /tmp/phpsysinfo-$version/. $final_path
# Set permissions to app files
# you may need to make some file and/or directory writeable by www-data (nginx user)
sudo chown -R root:root $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory