mirror of
https://github.com/YunoHost/test_apps.git
synced 2024-09-03 20:06:29 +02:00
Initial commit
This commit is contained in:
commit
ddce191fdb
11 changed files with 203 additions and 0 deletions
5
change_url_app_ynh/conf/index.html
Normal file
5
change_url_app_ynh/conf/index.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
This is a dummy app to test the change url feature.
|
||||
</body>
|
||||
</html>
|
3
change_url_app_ynh/conf/nginx.conf
Normal file
3
change_url_app_ynh/conf/nginx.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
location PATHTOCHANGE {
|
||||
alias /var/www/FOLDER;
|
||||
}
|
36
change_url_app_ynh/manifest.json
Normal file
36
change_url_app_ynh/manifest.json
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "Change Url",
|
||||
"id": "change_url_app",
|
||||
"description": {
|
||||
"en": "Dummy app to test change_url"
|
||||
},
|
||||
"license": "GPL-3+",
|
||||
"maintainer": {
|
||||
"name": "bram",
|
||||
"email": "cortex@worlddomination.be",
|
||||
"url": "http://worlddomination.be"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.4.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path"
|
||||
},
|
||||
"example": "/",
|
||||
"default": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
25
change_url_app_ynh/scripts/change_url
Normal file
25
change_url_app_ynh/scripts/change_url
Normal file
|
@ -0,0 +1,25 @@
|
|||
set -eux
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
number=$YNH_APP_INSTANCE_NUMBER
|
||||
|
||||
# Retrieve arguments
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
old_path_trimed=$YNH_APP_OLD_PATH_TRIMED
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
new_path_trimed=$YNH_APP_NEW_PATH_TRIMED
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
if [[ "$new_path" == "" ]]; then
|
||||
sudo sed -i "s@location .\+ {@location / {@g" $nginx_conf_path
|
||||
else
|
||||
sudo sed -i "s@location .\+ {@location $new_path_trimed {@g" $nginx_conf_path
|
||||
fi
|
||||
|
||||
if [ $old_domain != $new_domain ]; then
|
||||
sudo mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||
fi
|
34
change_url_app_ynh/scripts/install
Normal file
34
change_url_app_ynh/scripts/install
Normal file
|
@ -0,0 +1,34 @@
|
|||
set -eux
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
number=$YNH_APP_INSTANCE_NUMBER
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app checkurl $domain$path -a $app
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$path" == "" ]]; then
|
||||
sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf
|
||||
else
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
fi
|
||||
|
||||
sudo sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
|
||||
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sudo mkdir -p /var/www/$app
|
||||
|
||||
sudo cp ../conf/index.html /var/www/$app
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
|
||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
11
change_url_app_ynh/scripts/remove
Normal file
11
change_url_app_ynh/scripts/remove
Normal file
|
@ -0,0 +1,11 @@
|
|||
set -eux
|
||||
|
||||
# See comments in install script
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
sudo rm -rf /var/www/$app
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sudo service nginx reload
|
5
register_url_app_ynh/conf/index.html
Normal file
5
register_url_app_ynh/conf/index.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
This is a dummy app to test urlregister
|
||||
</body>
|
||||
</html>
|
3
register_url_app_ynh/conf/nginx.conf
Normal file
3
register_url_app_ynh/conf/nginx.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
location PATHTOCHANGE {
|
||||
alias /var/www/FOLDER;
|
||||
}
|
36
register_url_app_ynh/manifest.json
Normal file
36
register_url_app_ynh/manifest.json
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "RegisterUrl Test App",
|
||||
"id": "register_url_app",
|
||||
"description": {
|
||||
"en": "App to test the yunohost app registerurl action"
|
||||
},
|
||||
"license": "GPL-3+",
|
||||
"maintainer": {
|
||||
"name": "Aleks",
|
||||
"email": "alex.aubin@mailoo.org",
|
||||
"url": "https://github.com/alexAubin/"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">> 2.4.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"arguments": {
|
||||
"install" : [
|
||||
{
|
||||
"name": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path"
|
||||
},
|
||||
"example": "/",
|
||||
"default": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
34
register_url_app_ynh/scripts/install
Normal file
34
register_url_app_ynh/scripts/install
Normal file
|
@ -0,0 +1,34 @@
|
|||
set -eux
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
number=$YNH_APP_INSTANCE_NUMBER
|
||||
|
||||
# Retrieve arguments
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path=$YNH_APP_ARG_PATH
|
||||
|
||||
# Check domain/path availability
|
||||
sudo yunohost app registerurl $app $domain $path
|
||||
if [[ ! $? -eq 0 ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$path" == "" ]]; then
|
||||
sed -i "s@PATHTOCHANGE@/@g" ../conf/nginx.conf
|
||||
else
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
fi
|
||||
|
||||
sudo sed -i "s@FOLDER@$app/@g" ../conf/nginx.conf
|
||||
|
||||
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sudo mkdir -p /var/www/$app
|
||||
|
||||
sudo cp ../conf/index.html /var/www/$app
|
||||
|
||||
# Reload Nginx and regenerate SSOwat conf
|
||||
sudo service nginx reload
|
||||
|
||||
sudo yunohost app setting $app unprotected_uris -v "/"
|
||||
sudo yunohost app ssowatconf
|
11
register_url_app_ynh/scripts/remove
Normal file
11
register_url_app_ynh/scripts/remove
Normal file
|
@ -0,0 +1,11 @@
|
|||
set -eux
|
||||
|
||||
# See comments in install script
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(sudo yunohost app setting $app domain)
|
||||
|
||||
sudo rm -rf /var/www/$app
|
||||
sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
sudo service nginx reload
|
Loading…
Add table
Reference in a new issue