1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jenkins_ynh.git synced 2024-09-03 19:26:18 +02:00
jenkins_ynh/scripts/install

58 lines
1.4 KiB
Text
Raw Normal View History

2014-12-09 21:00:17 +01:00
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
2014-12-16 00:14:01 +01:00
is_public=$3
2015-02-27 14:36:54 +01:00
port=$4
2014-12-09 21:00:17 +01:00
2015-02-27 14:36:54 +01:00
sudo yunohost app checkport $port
2014-12-09 21:00:17 +01:00
if [[ ! $? -eq 0 ]]; then
2015-02-27 14:36:54 +01:00
echo "Port $port is not available. Aborting..."
2014-12-09 21:00:17 +01:00
exit 1
fi
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a jenkins
if [[ ! $? -eq 0 ]]; then
exit 1
fi
echo "Install dependencies..."
2014-12-12 22:15:20 +01:00
wget -q -O - "http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key" | sudo apt-key add -
2014-12-09 21:00:17 +01:00
sudo bash -c "cat > /etc/apt/sources.list.d/jenkins.list << EOF
deb http://pkg.jenkins-ci.org/debian binary/
EOF
"
sudo apt-get update
sudo apt-get install jenkins -y
2014-12-16 08:14:48 +01:00
if [[ "$path" != "/" ]];
then
# $ means 'process only the last line'
sudo sed -i '$ s@--ajp13Port=$AJP_PORT@--ajp13Port=$AJP_PORT --prefix=$PREFIX@g' /etc/default/jenkins
fi
2015-02-27 15:23:55 +01:00
sudo sed -i "s/HTTP_PORT=.*/HTTP_PORT=$port/g" /etc/default/jenkins
2014-12-16 08:14:48 +01:00
sudo service jenkins restart
2014-12-09 21:00:17 +01:00
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
2015-02-27 14:36:54 +01:00
sed -i "s@YNH_PORT@$port@g" ../conf/nginx.conf
2014-12-09 21:00:17 +01:00
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/jenkins.conf
2014-12-16 00:14:01 +01:00
sudo yunohost app setting jenkins is_public -v $is_public
if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting jenkins unprotected_uris -v "/"
fi
2015-02-27 16:05:49 +01:00
# restart 2 times for debug
sudo service jenkins restart
2014-12-09 21:00:17 +01:00
sudo service nginx reload
sudo yunohost app ssowatconf