Improve autoinstall and other scripts
This commit is contained in:
		
							parent
							
								
									cf6ef78b67
								
							
						
					
					
						commit
						26d81c5c5e
					
				
					 3 changed files with 26 additions and 4 deletions
				
			
		|  | @ -28,6 +28,8 @@ _autoinstall_base () { | |||
| 	_autoinstall_file \ | ||||
| 		"https://raw.githubusercontent.com/qw3rtman/git-fire/master/git-fire" \ | ||||
| 		"$HOME/.local/bin/git-fire" | ||||
| 
 | ||||
| 	return 0 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_graphical () { | ||||
|  | @ -50,11 +52,21 @@ _autoinstall_graphical () { | |||
| 	_autoinstall_archive \ | ||||
| 		"https://github.com/dracula/gtk/releases/download/v3.0/Dracula-cursors.tar.xz" \ | ||||
| 		"$HOME/.icons/Dracula-cursors.tar.xz" | ||||
| 
 | ||||
| 	_autoinstall_archive \ | ||||
| 		"$(curl -fsSL 'https://data.services.jetbrains.com/products?code=TBA&release.type=release&fields=releases' | jq -r '.[0].releases[0].downloads.linux.link')" \ | ||||
| 		"$HOME/.local/bin/jetbrains-toolbox.tar.gz" \ | ||||
| 		&& mv -f "$HOME/.local/bin/jetbrains-toolbox-"*"/jetbrains-toolbox" "$HOME/.local/bin/" \ | ||||
| 		&& rm -rf "$HOME/.local/bin/jetbrains-toolbox-"* | ||||
| 
 | ||||
| 	return 0 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_all () { | ||||
| 	_autoinstall_base | ||||
| 	_autoinstall_graphical | ||||
| 
 | ||||
| 	return 0 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_git () { | ||||
|  | @ -63,7 +75,9 @@ _autoinstall_git () { | |||
| 		echo "Installing repo $1 to $2" | ||||
| 		mkdir -p "$2" | ||||
| 		git clone "$1" "$2" >/dev/null 2>&1 | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	return 1 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_file () { | ||||
|  | @ -74,7 +88,9 @@ _autoinstall_file () { | |||
| 		mkdir -p "$file_path" | ||||
| 		cd "$file_path" || exit | ||||
| 		curl -fsSLo "$2" "$1" | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	return 1 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_archive () { | ||||
|  | @ -86,17 +102,22 @@ _autoinstall_archive () { | |||
| 		cd "$file_path" || exit | ||||
| 		curl -fsSLo "$2" "$1" | ||||
| 		tar xaf "$2" | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	return 1 | ||||
| } | ||||
| 
 | ||||
| _autoinstall_env () { | ||||
| 	if [ -x "$(command -v envsubst)" ] | ||||
| 	then | ||||
| 		envsubst < "$1.tpl" > "$1" | ||||
| 		return 0 | ||||
| 	fi | ||||
| 	return 1 | ||||
| } | ||||
| 
 | ||||
| case $1 in | ||||
| action="${1:-base}" | ||||
| case $action in | ||||
| 	all)		_autoinstall_all ;; | ||||
| 	base)		_autoinstall_base ;; | ||||
| 	graphical)	_autoinstall_graphical ;; | ||||
|  | @ -104,5 +125,5 @@ case $1 in | |||
| 	file)		_autoinstall_file "$2" "$3" ;; | ||||
| 	archive)	_autoinstall_archive "$2" "$3" ;; | ||||
| 	env)		_autoinstall_env "$2" ;; | ||||
| 	*)			echo "'$1' is not valid" ;; | ||||
| 	*)			echo "'$action' is not a valid action." ;; | ||||
| esac | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue