1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gitlab_ynh.git synced 2024-09-03 18:36:35 +02:00

format files

This commit is contained in:
Pierre Bourré 2019-01-26 14:46:52 +01:00
parent 079f64b387
commit 2c14e80a2b
8 changed files with 113 additions and 125 deletions

View file

@ -107,27 +107,25 @@ setup_source() {
ynh_print_info "Downloading Gitlab files..." ynh_print_info "Downloading Gitlab files..."
if test -e "$local_src" if test -e "$local_src"; then # Use the local source file if it is present
then # Use the local source file if it is present
cp $local_src $src_filename cp $local_src $src_filename
else # If not, download the source else # If not, download the source
ynh_print_info $(wget -q --show-progress -O $src_filename $src_url) ynh_print_info $(wget -q --show-progress -O $src_filename $src_url)
fi fi
# Check the control sum # Check the control sum
echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status \ echo "${src_sum} ${src_filename}" | ${src_sumprg} -c --status ||
|| ynh_die "Corrupt source" ynh_die "Corrupt source"
ynh_print_info "Installing Gitlab..." ynh_print_info "Installing Gitlab..."
#Fix for the CI #Fix for the CI
if sudo grep -qa container=lxc /proc/1/environ; if sudo grep -qa container=lxc /proc/1/environ; then
then
dpkg -i $src_filename || true # This command will fail in lxc env dpkg -i $src_filename || true # This command will fail in lxc env
sed -i 's/command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"/command \"cat \/etc\/sysctl.conf\"/g' $final_path/embedded/cookbooks/package/resources/sysctl.rb sed -i 's/command \"cat \/etc\/sysctl.conf \/etc\/sysctl.d\/\*.conf | sysctl -e -p -\"/command \"cat \/etc\/sysctl.conf\"/g' $final_path/embedded/cookbooks/package/resources/sysctl.rb
dpkg --configure gitlab-ce || true dpkg --configure gitlab-ce || true
else else
dpkg -i $src_filename || true dpkg -i $src_filename || true
fi; fi
} }
#================================================= #=================================================
@ -140,8 +138,7 @@ waiting_to_start() {
log_path="/var/log/gitlab/unicorn/current" log_path="/var/log/gitlab/unicorn/current"
if [ ! -f "$log_path" ] if [ ! -f "$log_path" ]; then
then
return 0 return 0
fi fi
@ -160,10 +157,8 @@ waiting_to_start() {
# get the PID of the tail command # get the PID of the tail command
local pid_tail=$! local pid_tail=$!
for i in $(seq 1 500) for i in $(seq 1 500); do
do if grep --quiet "${line_match_new}" $templog || grep --quiet "${line_match_existing}" $templog; then
if grep --quiet "${line_match_new}" $templog || grep --quiet "${line_match_existing}" $templog
then
echo "Gitlab has correctly started." >&2 echo "Gitlab has correctly started." >&2
break break
fi fi

View file

@ -51,14 +51,12 @@ path_url="$new_path"
#================================================= #=================================================
change_domain=0 change_domain=0
if [ "$old_domain" != "$new_domain" ] if [ "$old_domain" != "$new_domain" ]; then
then
change_domain=1 change_domain=1
fi fi
change_path=0 change_path=0
if [ "$old_path" != "$new_path" ] if [ "$old_path" != "$new_path" ]; then
then
change_path=1 change_path=1
fi fi
@ -73,8 +71,7 @@ fi
# Gitlab configuration # Gitlab configuration
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]; then
then
ynh_print_info "Changing path..." ynh_print_info "Changing path..."
sudo gitlab-ctl stop unicorn sudo gitlab-ctl stop unicorn
@ -90,8 +87,7 @@ then
fi fi
# Change the domain for nginx # Change the domain for nginx
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]; then
then
ynh_print_info "Changing domain..." ynh_print_info "Changing domain..."
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -109,8 +105,7 @@ config_gitlab
sudo gitlab-ctl reconfigure sudo gitlab-ctl reconfigure
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]; then
then
sudo gitlab-ctl restart sudo gitlab-ctl restart
sudo gitlab-ctl restart unicorn sudo gitlab-ctl restart unicorn
fi fi

View file

@ -40,8 +40,8 @@ ynh_webpath_register $app $domain $path_url
#================================================= #=================================================
# Check user parameter # Check user parameter
ynh_user_exists "$admin" \ ynh_user_exists "$admin" ||
|| ynh_die "The chosen admin user does not exist." ynh_die "The chosen admin user does not exist."
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST

View file

@ -61,14 +61,12 @@ ynh_secure_remove "/var/log/$app"
# CLOSE PORTS # CLOSE PORTS
#================================================= #=================================================
if yunohost firewall list | grep -q "\- $port$" if yunohost firewall list | grep -q "\- $port$"; then
then
echo "Close port $port" >&2 echo "Close port $port" >&2
yunohost firewall disallow TCP $port 2>&1 yunohost firewall disallow TCP $port 2>&1
fi fi
if yunohost firewall list | grep -q "\- $portUnicorn$" if yunohost firewall list | grep -q "\- $portUnicorn$"; then
then
echo "Close port $portUnicorn" >&2 echo "Close port $portUnicorn" >&2
yunohost firewall disallow TCP $portUnicorn 2>&1 yunohost firewall disallow TCP $portUnicorn 2>&1
fi fi

View file

@ -47,10 +47,10 @@ path_url=$(ynh_app_setting_get "$app" path_url)
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_webpath_available $domain $path_url \ ynh_webpath_available $domain $path_url ||
|| ynh_die "Path not available: ${domain}${path_url}" ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path ||
|| ynh_die "There is already a directory: $final_path " ynh_die "There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS