Fix DEBUG messages indentation
This commit is contained in:
		
							parent
							
								
									6f67529e95
								
							
						
					
					
						commit
						c21a895747
					
				|  | @ -24,7 +24,7 @@ function AllowUserToConnectToThisMachineUsingSsh() | |||
| 	userLogin="$1" | ||||
| 	dscl . append '/Groups/com.apple.access_ssh' user "${userLogin}" | ||||
| 	dscl . append /Groups/com.apple.access_ssh groupmembers $(dscl . read "/Users/${userLogin}" GeneratedUID | cut -d " " -f 2) | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : Autoriser les accès SSH pour ${userLogin}." | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Autoriser les accès SSH pour ${userLogin}." | ||||
| } | ||||
| ## }}} | ||||
| 
 | ||||
|  | @ -32,7 +32,7 @@ function AllowUserToConnectToThisMachineUsingSsh() | |||
| function EnsurePingIsAllowed() | ||||
| { | ||||
| 	sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode off &> /dev/null | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : Désactivation du mode furtif (ping)." | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Désactivation du mode furtif (ping)." | ||||
| 	if [ $? != 0 ]; then | ||||
| 		printf '\e[1;31m%-6s\e[m\n' "ERREUR : La désactivation du mode furtif a échoué" | ||||
| 		return "$ERROR" | ||||
|  | @ -44,14 +44,14 @@ function EnsurePingIsAllowed() | |||
| function EnsureSshdIsRunning() | ||||
| { | ||||
| 	sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : Vérification si sshd est déjà en cours." | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Vérification si sshd est déjà en cours." | ||||
| 	if [ $? != 0 ]; then | ||||
| 		# enable 'Remote login' in 'system preferences' | ||||
| 		sudo launchctl enable system/com.openssh.sshd &> /dev/null | ||||
| 		sudo launchctl load /System/Library/LaunchDaemons/ssh.plist &> /dev/null | ||||
| 	fi | ||||
| 	sudo launchctl list | grep 'com.openssh.sshd' &> /dev/null | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : Activation du serveur ssh." | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Activation du serveur ssh." | ||||
| 	if [ $? != 0 ]; then | ||||
| 		printf '\e[1;31m%-6s\e[m\n' "ERREUR : L'activation du serveur ssh a échoué"; | ||||
| 		return "$ERROR" | ||||
|  | @ -141,11 +141,11 @@ function AddUserBackuppc() { | |||
| 	dscl . -create "/Users/$userLogin" PrimaryGroupID "$groupId" | ||||
| 	dscl . -create "/Users/$userLogin" NFSHomeDirectory "$homeDir" | ||||
| 	dscl . -create "/Users/$userLogin" IsHidden 1 # hide from login window | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : Création de l'utilisateur ${userLogin}." | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Création de l'utilisateur ${userLogin}." | ||||
| 
 | ||||
| 	# Homedir permissions | ||||
| 	chown -R "$userLogin:$groupId" "$homeDir" | ||||
| [[ "${DEBUG}" == "0" ]] && 	printf '\e[1;33m%-6s\e[m\n' "DEBUG : chown -R $userLogin:$groupId $homeDir" | ||||
| 	[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : chown -R $userLogin:$groupId $homeDir" | ||||
| 
 | ||||
| 	AllowUserToConnectToThisMachineUsingSsh "${userLogin}" | ||||
| 
 | ||||
|  | @ -164,7 +164,7 @@ function AllowBackuppcSudo() { | |||
| 			printf '%b\n' "Configuration de sudo pour BackupPC." | ||||
| 		else | ||||
| 				echo "#includedir /etc/sudoers.d" >> /etc/sudoers | ||||
| [[ "${DEBUG}" == "0" ]] && 				printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout de ${sudoersDir} dans le fichier sudoers." | ||||
| 				[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout de ${sudoersDir} dans le fichier sudoers." | ||||
| 		fi | ||||
| 	elif [ -f /private/etc/sudoers ]; then | ||||
| 		sudoersDir=$(grep "^#includedir " /private/etc/sudoers | cut -d" " -f2) | ||||
|  | @ -172,7 +172,7 @@ function AllowBackuppcSudo() { | |||
| 			printf '%b\n' "Configuration de sudo pour BackupPC." | ||||
| 		else | ||||
| 			echo "#includedir /private/etc/sudoers.d" >> /private/etc/sudoers | ||||
| [[ "${DEBUG}" == "0" ]] && 			printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout de ${sudoersDir} dans le fichier sudoers." | ||||
| 			[[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Ajout de ${sudoersDir} dans le fichier sudoers." | ||||
| 		fi | ||||
| 	else | ||||
| 		printf '\e[1;31m%-6s\e[m\n' "ERREUR : Impossible de trouver un fichier de configuratio pour sudo." | ||||
|  | @ -313,6 +313,7 @@ mv -f -- "${filepl}" "${dir1}" | |||
| #### CRÉATION DE L’UTILISATEUR BACKUPPC #### | ||||
| [[ "${DEBUG}" == "0" ]] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Partie - Création du compte backuppc" | ||||
| homebackuppc='/var/lib/backuppc' | ||||
| [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Création de l'utilisateur backuppc (homebackuppc=${homebackuppc}) avec des droits sur l'utilisateur ${usr}." | ||||
| AddUserBackuppc "${input_login}" "${homebackuppc}" | ||||
| mkdir -p -- "${homebackuppc}"/.ssh | ||||
| [[ "${DEBUG}" == "0" ]] && printf '\e[1;33m%-6s\e[m\n' "DEBUG : Création du répertoire .ssh de l'utilisateur : ${homebackuppc}/.ssh" | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue