Improve autoinstall and other scripts
This commit is contained in:
		
							parent
							
								
									cf6ef78b67
								
							
						
					
					
						commit
						26d81c5c5e
					
				
					 3 changed files with 26 additions and 4 deletions
				
			
		
							
								
								
									
										1
									
								
								.bin/.e
									
										
									
									
									
								
							
							
						
						
									
										1
									
								
								.bin/.e
									
										
									
									
									
								
							|  | @ -10,6 +10,7 @@ declare -A mapper=( | ||||||
| 	["environment.local"]="$HOME/.config/environment.local" | 	["environment.local"]="$HOME/.config/environment.local" | ||||||
| 	["git"]="$HOME/.config/git/config" | 	["git"]="$HOME/.config/git/config" | ||||||
| 	["git-ignore"]="$HOME/.config/git/ignore" | 	["git-ignore"]="$HOME/.config/git/ignore" | ||||||
|  | 	["home-manager"]="$HOME/.config/nixpkgs/home.nix" | ||||||
| 	["qutebrowser"]="$HOME/.config/qutebrowser/common.py" | 	["qutebrowser"]="$HOME/.config/qutebrowser/common.py" | ||||||
| 	["starship"]="$HOME/.config/starship.toml" | 	["starship"]="$HOME/.config/starship.toml" | ||||||
| 	["sxhkd"]="$HOME/.config/sxhkd/sxhkdrc" | 	["sxhkd"]="$HOME/.config/sxhkd/sxhkdrc" | ||||||
|  |  | ||||||
|  | @ -28,6 +28,8 @@ _autoinstall_base () { | ||||||
| 	_autoinstall_file \ | 	_autoinstall_file \ | ||||||
| 		"https://raw.githubusercontent.com/qw3rtman/git-fire/master/git-fire" \ | 		"https://raw.githubusercontent.com/qw3rtman/git-fire/master/git-fire" \ | ||||||
| 		"$HOME/.local/bin/git-fire" | 		"$HOME/.local/bin/git-fire" | ||||||
|  | 
 | ||||||
|  | 	return 0 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autoinstall_graphical () { | _autoinstall_graphical () { | ||||||
|  | @ -50,11 +52,21 @@ _autoinstall_graphical () { | ||||||
| 	_autoinstall_archive \ | 	_autoinstall_archive \ | ||||||
| 		"https://github.com/dracula/gtk/releases/download/v3.0/Dracula-cursors.tar.xz" \ | 		"https://github.com/dracula/gtk/releases/download/v3.0/Dracula-cursors.tar.xz" \ | ||||||
| 		"$HOME/.icons/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_all () { | ||||||
| 	_autoinstall_base | 	_autoinstall_base | ||||||
| 	_autoinstall_graphical | 	_autoinstall_graphical | ||||||
|  | 
 | ||||||
|  | 	return 0 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autoinstall_git () { | _autoinstall_git () { | ||||||
|  | @ -63,7 +75,9 @@ _autoinstall_git () { | ||||||
| 		echo "Installing repo $1 to $2" | 		echo "Installing repo $1 to $2" | ||||||
| 		mkdir -p "$2" | 		mkdir -p "$2" | ||||||
| 		git clone "$1" "$2" >/dev/null 2>&1 | 		git clone "$1" "$2" >/dev/null 2>&1 | ||||||
|  | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  | 	return 1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autoinstall_file () { | _autoinstall_file () { | ||||||
|  | @ -74,7 +88,9 @@ _autoinstall_file () { | ||||||
| 		mkdir -p "$file_path" | 		mkdir -p "$file_path" | ||||||
| 		cd "$file_path" || exit | 		cd "$file_path" || exit | ||||||
| 		curl -fsSLo "$2" "$1" | 		curl -fsSLo "$2" "$1" | ||||||
|  | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  | 	return 1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autoinstall_archive () { | _autoinstall_archive () { | ||||||
|  | @ -86,17 +102,22 @@ _autoinstall_archive () { | ||||||
| 		cd "$file_path" || exit | 		cd "$file_path" || exit | ||||||
| 		curl -fsSLo "$2" "$1" | 		curl -fsSLo "$2" "$1" | ||||||
| 		tar xaf "$2" | 		tar xaf "$2" | ||||||
|  | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  | 	return 1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| _autoinstall_env () { | _autoinstall_env () { | ||||||
| 	if [ -x "$(command -v envsubst)" ] | 	if [ -x "$(command -v envsubst)" ] | ||||||
| 	then | 	then | ||||||
| 		envsubst < "$1.tpl" > "$1" | 		envsubst < "$1.tpl" > "$1" | ||||||
|  | 		return 0 | ||||||
| 	fi | 	fi | ||||||
|  | 	return 1 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| case $1 in | action="${1:-base}" | ||||||
|  | case $action in | ||||||
| 	all)		_autoinstall_all ;; | 	all)		_autoinstall_all ;; | ||||||
| 	base)		_autoinstall_base ;; | 	base)		_autoinstall_base ;; | ||||||
| 	graphical)	_autoinstall_graphical ;; | 	graphical)	_autoinstall_graphical ;; | ||||||
|  | @ -104,5 +125,5 @@ case $1 in | ||||||
| 	file)		_autoinstall_file "$2" "$3" ;; | 	file)		_autoinstall_file "$2" "$3" ;; | ||||||
| 	archive)	_autoinstall_archive "$2" "$3" ;; | 	archive)	_autoinstall_archive "$2" "$3" ;; | ||||||
| 	env)		_autoinstall_env "$2" ;; | 	env)		_autoinstall_env "$2" ;; | ||||||
| 	*)			echo "'$1' is not valid" ;; | 	*)			echo "'$action' is not a valid action." ;; | ||||||
| esac | esac | ||||||
|  |  | ||||||
|  | @ -32,13 +32,13 @@ main() | ||||||
|     if [ -n "$1" ] && [ -e "$1" ] |     if [ -n "$1" ] && [ -e "$1" ] | ||||||
|     then |     then | ||||||
|         convert "$1" "$path" |         convert "$1" "$path" | ||||||
|         clip_image "$path" |  | ||||||
|         upload_image "$path" |         upload_image "$path" | ||||||
|  |         clip_image "$path" | ||||||
|     else |     else | ||||||
|         if [ "$(flameshot gui -r | tee $path | wc -c)" -gt 0 ] |         if [ "$(flameshot gui -r | tee $path | wc -c)" -gt 0 ] | ||||||
|         then |         then | ||||||
|             clip_image "$path" |  | ||||||
|             upload_image "$path" |             upload_image "$path" | ||||||
|  |             clip_image "$path" | ||||||
|         fi |         fi | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue