1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cops_ynh.git synced 2024-09-03 18:25:57 +02:00

We download sources instead of having them in the depot

This commit is contained in:
polytan02 2016-12-23 20:24:09 +00:00
parent 5901f8cb5e
commit 851321dbc7
9 changed files with 72 additions and 92 deletions

View file

@ -1,14 +1,14 @@
#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
#set -eu
TRAP_ON () { # Activate signal capture
trap EXIT_PROPERLY ERR # Capturing ex it signals on error
}
#TRAP_ON () { # Activate signal capture
# trap EXIT_PROPERLY ERR # Capturing ex it signals on error
#}
# Active trap pour arrêter le script si une erreur est détectée.
TRAP_ON
#TRAP_ON
# See comments in install script
app=$YNH_APP_INSTANCE_NAME

View file

@ -1,5 +1,5 @@
#!/bin/bash
set -eu
#set -eu
# Charge les fonctions génériques habituellement utilisées dans le script
source fonctions
@ -25,9 +25,9 @@ basicauthpass=$YNH_APP_ARG_BASICAUTHPASS
CHECK_VAR "$app" "app name not set"
# Check the path value and correct it (adds / at begining and removes it at the end)
CHECK_PATH
CHECK_PATH;
CHECK_CALIBREPATH
CHECK_CALIBREPATH;
# Check domain and path availibility
CHECK_DOMAINPATH
@ -56,18 +56,25 @@ sudo apt-get update -y
sudo apt-get install php5-gd php5-sqlite php5-json php5-intl -y
# Creation of folder
#sudo rm -rf $final_path
sudo mkdir -p $final_path
# We download the sources and check the md5sum
cops_file=`sudo cat ../sources/source_file`;
sudo wget -nv -i ../sources/source_url -P ../sources/
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
sudo unzip ../sources/${cops_file} -d $final_path
# Site adjustments
sudo cp ../conf/config_local.php ../sources/
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../sources/config_local.php
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../conf/config_local.php
timezone=`sudo cat /etc/timezone`;
sed -i "s@TIMEZONETOCHANGE@$timezone@g" ../sources/config_local.php
sed -i "s@TIMEZONETOCHANGE@$timezone@g" ../conf/config_local.php
sudo cp ../conf/robots.txt ../sources/
sudo cp ../conf/config_local.php $final_path
sudo cp ../conf/robots.txt $final_path
# To be done : make it an if loop
# Set permissions
sudo chmod 775 -R $final_path
sudo chown -hR $runninguser:$runninguser $final_path
# Add basic auth if requested
if [ "$basicauthcreate" = "Yes" ];
@ -82,6 +89,9 @@ then
sed 's#$#'"`echo -n $SALT | xxd -ps`"'#' |
xxd -r -ps |
base64);printf "$basicauthuser:{SSHA}$SHA1\n" >> ../sources/htpasswd)
sudo cp ../sources/htpasswd $final_path
sudo chmod 440 $final_path/htpasswd
sudo chown www-data:www-data $final_path/htpasswd
# Modif nginx
sed -i "s|^.*\bauth_basic\b.*$| auth_basic \"Private Library\";|" ../conf/nginx.conf;
@ -90,33 +100,16 @@ else
echo "No basic auth";
fi
# Base site
sudo cp -a ../sources/* $final_path/
# Set permissions
sudo chmod 775 -R $final_path
sudo chown -hR $runninguser:$runninguser $final_path
if [ "$basicauthcreate" = "Yes" ];
then
sudo chmod 440 $final_path/htpasswd
sudo chown www-data:www-data $final_path/htpasswd
else
echo "Nothing to do"
fi
# Modify Nginx configuration file and copy it to Nginx conf directory
# Modify Nginx configuration file and copy it to Nginx conf.d directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf $finalnginxconf
# Modify php-fpm configuration file and copy it to php-fpm pool.d directory
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
sed -i "s@FOLDERTOCHANGE@$final_path@g" ../conf/php-fpm.conf
sed -i "s@USERTOCHANGE@$runninguser@g" ../conf/php-fpm.conf
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
@ -128,7 +121,6 @@ then
ynh_app_setting_set $app skipped_uris "/"
fi
# Reload Nginx and regenerate SSOwat conf
sudo service php5-fpm reload
sudo service nginx reload

View file

@ -1,11 +1,11 @@
#!/bin/bash
set -eu
#set -eu
# Charge les fonctions génériques habituellement utilisées dans le script
source fonctions
#source fonctions
# Active trap pour arrêter le script si une erreur est détectée.
TRAP_ON
#TRAP_ON
# Source app helpers
source /usr/share/yunohost/helpers

View file

@ -4,14 +4,14 @@
# will be located in the current directory, regarding the last argument.
# Exit on command errors and treat unset variables as an error
set -eu
#set -eu
TRAP_ON () { # Activate signal capture
trap EXIT_PROPERLY ERR # Capturing ex it signals on error
}
#TRAP_ON () { # Activate signal capture
# trap EXIT_PROPERLY ERR # Capturing ex it signals on error
#}
# Active trap pour arrêter le script si une erreur est détectée.
TRAP_ON
#TRAP_ON
# See comments in install script
app=$YNH_APP_INSTANCE_NAME
@ -49,16 +49,6 @@ else
echo "Nothing to do"
fi
### MySQL (remove if not used) ###
# If a MySQL database is used:
# # Create and restore the database
# dbname=$app
# dbuser=$app
# dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
# ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass"
# ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql
### MySQL end ###
# Restore NGINX configuration
sudo cp -a ./nginx.conf $finalnginxconf

View file

@ -1,11 +1,11 @@
#!/bin/bash
set -eu
#set -eu
# Charge les fonctions génériques habituellement utilisées dans le script
source fonctions
# Active trap pour arrêter le script si une erreur est détectée.
TRAP_ON
#TRAP_ON
# Source app helpers
source /usr/share/yunohost/helpers
@ -28,6 +28,32 @@ basicauthcreate=$(ynh_app_setting_get $app basicauthcreate)
# We check that calibrepath is correct
CHECK_CALIBREPATH
# We install dependencies
sudo apt-get update -y
sudo apt-get install php5-gd php5-sqlite php5-json php5-intl -y
# Removal of old folder and restart from fresh
sudo rm -rf $final_path
sudo mkdir -p $final_path
# We download the sources and check the md5sum
cops_file=`sudo cat ../sources/source_file`;
sudo wget -nv -i ../sources/source_url -P ../sources/
sudo md5sum -c ../sources/source_md5 --status || (echo "Corrupt source" >&2 && false)
sudo unzip ../sources/${cops_file} -d $final_path
# Site adjustments
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../conf/config_local.php
timezone=`sudo cat /etc/timezone`;
sed -i "s@TIMEZONETOCHANGE@$timezone@g" ../conf/config_local.php
sudo cp ../conf/config_local.php $final_path
sudo cp ../conf/robots.txt $final_path
# Set permissions
sudo chmod 775 -R $final_path
sudo chown -hR $runninguser:$runninguser $final_path
# Add basic auth if requested
if [ "$basicauthcreate" = "Yes" ];
then
@ -41,62 +67,31 @@ then
sed 's#$#'"`echo -n $SALT | xxd -ps`"'#' |
xxd -r -ps |
base64);printf "$basicauthuser:{SSHA}$SHA1\n" >> ../sources/htpasswd)
sudo cp ../sources/htpasswd $final_path
sudo chmod 440 $final_path/htpasswd
sudo chown www-data:www-data $final_path/htpasswd
# Modif nginx
sed -i "s|^.*\bauth_basic\b.*$| auth_basic \"Private Library\";|" ../conf/nginx.conf;
sed -i "s|^.*\bauth_basic_user_file\b.*$| auth_basic_user_file $final_path/htpasswd;|" ../conf/nginx.conf;
sed -i "s|^.*\bauth_basic\b.*$| auth_basic \"Private Library\";|" ../conf/nginx.conf;
sed -i "s|^.*\bauth_basic_user_file\b.*$| auth_basic_user_file $final_path/htpasswd;|" ../conf/nginx.conf;
else
echo "No basic auth";
fi
# We install dependencies
sudo apt-get update -y
sudo apt-get install php5-gd php5-sqlite php5-json php5-intl -y
# Modify Nginx configuration file and copy it to Nginx conf directory
# Modify Nginx configuration file and copy it to Nginx conf.d directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf $finalnginxconf
# Modify php-fpm configuration file and copy it to php-fpm pool.d directory
sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf
sed -i "s@FOLDERTOCHANGE@$final_path@g" ../conf/php-fpm.conf
sed -i "s@USERTOCHANGE@$runninguser@g" ../conf/php-fpm.conf
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
# Removal of old folder and restart from fresh
sudo rm -rf $final_path
sudo mkdir -p $final_path
# Site adjustments
sudo cp ../conf/config_local.php ../sources/
sed -i "s@CALIBRETOCHANGE@$calibrepath@g" ../sources/config_local.php
timezone=`sudo cat /etc/timezone`;
sed -i "s@TIMEZONETOCHANGE@$timezone@g" ../sources/config_local.php
sudo cp ../conf/robots.txt ../sources/
# Base site
sudo cp -a ../sources/* $final_path/
# We adjust permissions
sudo chmod 775 -R $final_path
sudo chown -hR $runninguser:$runninguser $final_path
if [ "$basicauthcreate" = "Yes" ];
then
sudo chmod 440 $final_path/htpasswd
sudo chown www-data:www-data $final_path/htpasswd
else
echo "Nothing to do"
fi
# Make app public if necessary
is_public=$(ynh_app_setting_get $app is_public)
if [ "$is_public" = "Yes" ];

1
sources/source_file Normal file
View file

@ -0,0 +1 @@
cops-1.0.1.zip

1
sources/source_md5 Normal file
View file

@ -0,0 +1 @@
a688dfd66d31674637106f8430ca1103 cops-1.0.1.zip

1
sources/source_url Normal file
View file

@ -0,0 +1 @@
https://github.com/seblucas/cops/releases/download/1.0.1/cops-1.0.1.zip