mirror of
				https://github.com/vmstan/gravity-sync.git
				synced 2025-10-31 08:57:02 -04:00 
			
		
		
		
	Detect SSH-Keygen method
This commit is contained in:
		
							parent
							
								
									e54a01ecb6
								
							
						
					
					
						commit
						7e64129e49
					
				| @ -15,6 +15,7 @@ | |||||||
| - Changelog polarity reversed after heated discussions with marketing team. | - Changelog polarity reversed after heated discussions with marketing team. | ||||||
| - Improved method to activate development branch updates, as added in 1.7.2.  | - Improved method to activate development branch updates, as added in 1.7.2.  | ||||||
| - `./gravity-sync.sh dev` will now toggle dev flag on/off. No `touch` required, although it still works that way under the covers. | - `./gravity-sync.sh dev` will now toggle dev flag on/off. No `touch` required, although it still works that way under the covers. | ||||||
|  | - Detects absence of ssh-keygen on host OS and prompts to install (DietPi) | ||||||
| 
 | 
 | ||||||
| #### 1.7.3 | #### 1.7.3 | ||||||
| - Cleaning up output of argument listing | - Cleaning up output of argument listing | ||||||
|  | |||||||
| @ -99,7 +99,7 @@ function update_gs { | |||||||
| 	TASKTYPE='UPDATE' | 	TASKTYPE='UPDATE' | ||||||
| 	# logs_export 	# dumps log prior to execution because script stops after successful pull | 	# logs_export 	# dumps log prior to execution because script stops after successful pull | ||||||
| 	 | 	 | ||||||
| 	if [ -f "dev" ] | 	if [ -f "$HOME/${LOCAL_FOLDR}/dev" ] | ||||||
| 	then | 	then | ||||||
| 		BRANCH='development' | 		BRANCH='development' | ||||||
| 	else | 	else | ||||||
| @ -769,7 +769,7 @@ function config_generate { | |||||||
| 		MESSAGE="Defaulting to SSH Key-Pair Authentication" | 		MESSAGE="Defaulting to SSH Key-Pair Authentication" | ||||||
| 		echo_info | 		echo_info | ||||||
| 	fi | 	fi | ||||||
| 	 | 
 | ||||||
| 	if [ -z $INPUT_REMOTE_PASS ] | 	if [ -z $INPUT_REMOTE_PASS ] | ||||||
| 	then | 	then | ||||||
| 		if [ -f $HOME/${SSH_PKIF} ] | 		if [ -f $HOME/${SSH_PKIF} ] | ||||||
| @ -777,6 +777,9 @@ function config_generate { | |||||||
| 			MESSAGE="Using Existing ~/${SSH_PKIF}" | 			MESSAGE="Using Existing ~/${SSH_PKIF}" | ||||||
| 			echo_info | 			echo_info | ||||||
| 		else | 		else | ||||||
|  | 			KEYGEN_COMMAND="ssh-keygen -t rsa -f" | ||||||
|  | 			detect_sshkeygen | ||||||
|  | 						 | ||||||
| 			MESSAGE="Generating ~/${SSH_PKIF}" | 			MESSAGE="Generating ~/${SSH_PKIF}" | ||||||
| 			echo_info | 			echo_info | ||||||
| 			 | 			 | ||||||
| @ -788,7 +791,7 @@ function config_generate { | |||||||
| 			 | 			 | ||||||
| 			echo -e "========================================================" | 			echo -e "========================================================" | ||||||
| 			echo -e "========================================================" | 			echo -e "========================================================" | ||||||
| 			ssh-keygen -t rsa | 			${KEYGEN_COMMAND} $HOME/${SSH_PKIF} | ||||||
| 			echo -e "========================================================" | 			echo -e "========================================================" | ||||||
| 			echo -e "========================================================" | 			echo -e "========================================================" | ||||||
| 		fi | 		fi | ||||||
| @ -825,6 +828,69 @@ function config_generate { | |||||||
| 	exit_withchange | 	exit_withchange | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | ## Detect SSH-KEYGEN | ||||||
|  | function detect_sshkeygen { | ||||||
|  | 	MESSAGE="Checking for SSH-KEYGEN" | ||||||
|  | 		echo_stat | ||||||
|  | 	 | ||||||
|  | 	if hash ssh-keygen 2>/dev/null | ||||||
|  | 	then | ||||||
|  | 		echo_good | ||||||
|  | 	else | ||||||
|  | 		echo_fail | ||||||
|  | 		MESSAGE="SSH-KEYGEN is Required" | ||||||
|  | 		echo_info | ||||||
|  | 		MESSAGE="Attempting to Compensate" | ||||||
|  | 		echo_info | ||||||
|  | 
 | ||||||
|  | 		if is_command dropbearkey | ||||||
|  | 		then | ||||||
|  | 			MESSAGE="Using DROPBEARKEY Instead" | ||||||
|  | 			echo_info | ||||||
|  | 			KEYGEN_COMMAND="dropbearkey -t rsa -f" | ||||||
|  | 
 | ||||||
|  | 			MESSAGE="Installing SSH" | ||||||
|  | 			echo_stat | ||||||
|  | 				distro_check | ||||||
|  | 		 | ||||||
|  | 			${PKG_INSTALL} ssh | ||||||
|  | 				error_validate | ||||||
|  | 		else | ||||||
|  | 			MESSAGE="Installing SSH-KEYGEN" | ||||||
|  | 			echo_stat | ||||||
|  | 				distro_check | ||||||
|  | 		 | ||||||
|  | 			${PKG_INSTALL} ssh-keygen | ||||||
|  | 				error_validate | ||||||
|  | 		fi	 | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | ## Detect Package Manager | ||||||
|  | function distro_check {  | ||||||
|  | 	if is_command apt-get | ||||||
|  | 	then | ||||||
|  | 		PKG_MANAGER="apt-get" | ||||||
|  | 		PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install" | ||||||
|  | 	elif is_command rpm | ||||||
|  | 		if is_command dnf | ||||||
|  | 		then | ||||||
|  | 			PKG_MANAGER="dnf" | ||||||
|  | 		elif is_command yum | ||||||
|  | 			PKG_MANAGER="yum" | ||||||
|  | 		else | ||||||
|  | 			MESSAGE="Unable to find OS Package Manager" | ||||||
|  | 			echo_info | ||||||
|  | 			exit_nochange | ||||||
|  | 		fi | ||||||
|  | 		PKG_INSTALL="${PKG_MANAGER} install -y" | ||||||
|  | 	else | ||||||
|  | 		MESSAGE="Unable to find OS Package Manager" | ||||||
|  | 		echo_info | ||||||
|  | 		exit_nochange | ||||||
|  | 	fi | ||||||
|  | } | ||||||
|  | 
 | ||||||
| ## Delete Existing Configuration | ## Delete Existing Configuration | ||||||
| function config_delete { | function config_delete { | ||||||
| 	source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} | 	source $HOME/${LOCAL_FOLDR}/${CONFIG_FILE} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user