Commit 5ece8e2d authored by Eric Vidal's avatar Eric Vidal 💬
Browse files

force the restart of obarun-install after an update

parent e7a377b9
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -11,8 +11,11 @@
## Main variable
##################

# allow to update the script when it launched [yes|no]
UPDATE="yes"
# allow to update the obarun-install script when it launched [yes|no]
UPDATE_INS="yes"

# allow to update the obarun-install-themes script when it launched [yes|no]
UPDATE_TPL="yes"

# Be more/less verbose
# 1 for more, 0 for less
+38 −23
Original line number Diff line number Diff line
@@ -48,35 +48,50 @@ trap "clean_install" ERR QUIT KILL STOP INT TERM
##		Update package or not

main_update(){
	
	local r=0
	
	if [[ "$UPDATE_INS" == "yes" ]]; then 
		out_action "Do you want to update obarun-install package? [y|n]"

		reply_answer

		if (( ! $? )); then
			pac_update "obarun-install" "/var/lib/obarun/obarun-install" "$GIT_ADDR" || die " Impossible to update" "clean_install"
		sourcing
			#sourcing
			sed -i "s,^UPDATE_INS=.*$,UPDATE_INS=\"no\"," "${CONFIG}"
			r=1
		else
			out_notvalid "WARNING : Some functionalities will cannot works properly"
			out_info "Press enter to continue"
			read enter
		fi
	
	fi
	if [[ "$UPDATE_TPL" == "yes" ]]; then 
		out_action "Do you want to update obarun-install-themes package? [y|n]"
		
		reply_answer

		if (( ! $? )); then
			pac_update "obarun-install-themes" "/var/lib/obarun/obarun-install-themes" "https://github.com/Obarun/obarun-install-themes.git" || die " Impossible to update" "clean_install"
			sed -i "s,^UPDATE_TPL=.*$,UPDATE_TPL=\"no\"," "${CONFIG}"
		else
			out_notvalid "WARNING : Some configurations can be out of date"
			out_info "Press enter to continue"
			read enter
		fi
	fi
	if (( "${r}" )); then
		out_notvalid "Obarun-install was updated.The script need to be restarted to apply the changes."
		out_notvalid "Just start it again,thanks."
		out_notvalid "Existing..."
		exit 0
	fi
	unset r
}

if [[ "$UPDATE" == "yes" ]]; then
main_update
fi


main_menu