diff --git a/manifest.json b/manifest.json index f3a405c..704f449 100644 --- a/manifest.json +++ b/manifest.json @@ -28,6 +28,15 @@ }, "example": "/jenkins", "default": "/jenkins" + }, + { + "name": "is_public", + "ask": { + "en": "Is it a public site?", + "fr": "Est-ce un site public ?" + }, + "choices": ["Yes", "No"], + "default": "Yes" } ] } diff --git a/scripts/install b/scripts/install index 6fb618d..96c47f6 100644 --- a/scripts/install +++ b/scripts/install @@ -3,6 +3,7 @@ # Retrieve arguments domain=$1 path=$2 +is_public=$3 sudo yunohost app checkport 8080 if [[ ! $? -eq 0 ]]; then @@ -32,5 +33,12 @@ sudo yunohost service add jenkins -l /var/log/jenkins/jenkins.log echo "Nginx configuration (sso disabled)..." sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jenkins.conf + +sudo yunohost app setting jenkins is_public -v $is_public +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting jenkins unprotected_uris -v "/" +fi + sudo service nginx reload sudo yunohost app ssowatconf diff --git a/scripts/remove b/scripts/remove index 30ce537..b159143 100644 --- a/scripts/remove +++ b/scripts/remove @@ -2,13 +2,15 @@ domain=$(sudo yunohost app setting jenkins domain) -sudo rm /etc/nginx/conf.d/$domain/jenkins.conf -sudo yunohost ssowatconf -sudo service nginx reload - -sudo yunohost service remove ynh-jenkins +sudo rm /etc/nginx/conf.d/$domain.d/jenkins.conf sudo apt-get purge jenkins sudo rm /etc/apt/sources.list.d/jenkins.list # TODO remove repo key sudo apt-get update + +sudo yunohost service remove jenkins + +sudo yunohost app ssowatconf +sudo service nginx reload + diff --git a/scripts/upgrade b/scripts/upgrade index 18acaa4..9a7ae48 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -4,9 +4,19 @@ domain=$(sudo yunohost app setting jenkins domain) path=$(sudo yunohost app setting jenkins path) path=${path%/} +is_public=$(sudo yunohost app setting jenkins is_public) sed -i "s@YNH_LOCATION@$path@g" ../conf/nginx.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jenkins.conf + + +if [ "$is_public" = "Yes" ]; +then + sudo yunohost app setting jenkins unprotected_uris -v "/" +else + sudo yunohost app setting jenkins unprotected_uris -d +fi + sudo service nginx reload sudo yunohost app ssowatconf