mirror of
				https://github.com/vmstan/gravity-sync.git
				synced 2025-11-04 01:26:59 -05:00 
			
		
		
		
	* Begin work on Docker support * rewrite permission detection * wrong else * Change pihole detection based on sudo results * Write out to devnull * nosodo handle * AND then * scanning * nosudo more * clearer wording on failures * headers * handle nosudo on docker detection better * SUDO sudo * AND THEN * status report rewrite * link * alert on no local install detected * yellow headers like the rest of GS * semi critical issues * purple instead of red * clean up output of sudo detection * give me space * Auto run config script * added logo * center logo * move intro * trying dev/tty * advanced config generate * != * logic is hard * new logo * image * fonts * svg image * remove h1 * use rihole variable * New root check * better method of checking sudo * remove messages * rihole * attempting realpath * GS_FILEPATH * remove $HOME call * remove config requirement for updates * no config for updates * all the variables * all kinds of variable replacements * double quotes * it’s like I’ve forgotten how to write this stuff * removals * updated requirements * variable rearrangement * validation check for docker * riholes * placeholder * more riholes * even more riholes * docker examples * docker rewrite * docker docker docker * docker custom checks * update from anywhere * correct validation error * check for current owner only if local install * give me space * stuff * more stuff * bash alias creation * cleanup installer * fix .sh * config errors, remove sshpass validation * skip directories if done * limit config script * fix for changes when both targets have changed * RIHOLE * cleanup warning messages * stop sign * big red * documenting new variables * master Co-authored-by: Michael Stanclift <vmstan@sovereign.vmstan.net> Co-authored-by: Michael Stanclift <vmstan@sovereign.local>
		
			
				
	
	
		
			71 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Bash
		
	
	
	
	
	
# GRAVITY SYNC BY VMSTAN #####################
 | 
						|
# gs-root.sh #################################
 | 
						|
 | 
						|
# For documentation or downloading updates visit https://github.com/vmstan/gravity-sync
 | 
						|
# This code is called from the main gravity-sync.sh file and should not execute directly!
 | 
						|
 | 
						|
## Sudo Creation Task
 | 
						|
function task_sudo {
 | 
						|
	TASKTYPE='SUDO'
 | 
						|
	MESSAGE="${MESSAGE}: ${TASKTYPE} Requested"
 | 
						|
	echo_good
 | 
						|
 | 
						|
	MESSAGE="Creating Sudoer.d Template"
 | 
						|
	echo_stat
 | 
						|
 | 
						|
	NEW_SUDO_USER=$(whoami)
 | 
						|
	echo -e "${NEW_SUDO_USER} ALL=(ALL) NOPASSWD: ALL" > ${LOCAL_FOLDR}/templates/gs-nopasswd.sudo
 | 
						|
		error_validate
 | 
						|
 | 
						|
	MESSAGE="Installing Sudoer.d File"
 | 
						|
	echo_stat
 | 
						|
 | 
						|
	sudo install -m 0440 ${LOCAL_FOLDR}/templates/gs-nopasswd.sudo /etc/sudoers.d/gs-nopasswd
 | 
						|
		error_validate
 | 
						|
	
 | 
						|
	exit_withchange
 | 
						|
}
 | 
						|
 | 
						|
## Root Check
 | 
						|
function root_check {
 | 
						|
	if [ ! "$EUID" -ne 0 ]
 | 
						|
  	then 
 | 
						|
		TASKTYPE='ROOT'
 | 
						|
		MESSAGE="${MESSAGE} ${TASKTYPE}"
 | 
						|
		echo_fail
 | 
						|
	  	
 | 
						|
		MESSAGE="${PROGRAM} Should Not Run As 'root'"
 | 
						|
		echo_warn
 | 
						|
		
 | 
						|
		exit_nochange
 | 
						|
	fi
 | 
						|
}
 | 
						|
 | 
						|
function new_root_check {
 | 
						|
	CURRENTUSER=$(whoami)
 | 
						|
	if [ ! "$EUID" -ne 0 ]
 | 
						|
	then
 | 
						|
		LOCALADMIN=""
 | 
						|
	else
 | 
						|
		# Check Sudo
 | 
						|
		SUDOCHECK=$(groups ${CURRENTUSER} | grep 'sudo')
 | 
						|
		if [ "$SUDOCHECK" == "" ]
 | 
						|
		then
 | 
						|
			LOCALADMIN="nosudo"
 | 
						|
		else
 | 
						|
			LOCALADMIN="sudo"
 | 
						|
		fi
 | 
						|
	fi
 | 
						|
		
 | 
						|
	if [ "$LOCALADMIN" == "nosudo" ]
 | 
						|
	then
 | 
						|
		TASKTYPE='ROOT'
 | 
						|
		MESSAGE="${MESSAGE} ${TASKTYPE}"
 | 
						|
		echo_fail
 | 
						|
			  
 | 
						|
		MESSAGE="Insufficent User Rights"
 | 
						|
		echo_warn
 | 
						|
				
 | 
						|
		exit_nochange
 | 
						|
	fi
 | 
						|
} |