mirror of
				https://gitea.blesmrt.net/mikaela/scripts.git
				synced 2025-11-04 11:27:37 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			531 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			531 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
set -x
 | 
						|
 | 
						|
export LC_ALL=C.utf8
 | 
						|
 | 
						|
# if yay is installed and we aren't root, run it instead
 | 
						|
if [[ -f /usr/bin/yay && $(id -u) != 0 ]]; then
 | 
						|
	if [[ "$1" == "-S" ]]; then
 | 
						|
		/usr/bin/yay --needed $*
 | 
						|
	else
 | 
						|
		/usr/bin/yay $*
 | 
						|
	fi
 | 
						|
# otherwise attempt to run pacman, but keep the --needed for installs
 | 
						|
elif [[ -f /usr/bin/pacman ]]; then
 | 
						|
	if [[ "$1" == "-S" ]]; then
 | 
						|
		/usr/bin/pacman --needed $*
 | 
						|
	else
 | 
						|
		/usr/bin/pacman $*
 | 
						|
	fi
 | 
						|
# otherwise fail gracefully
 | 
						|
else
 | 
						|
	printf "Neither yay or pacman was found.\n"
 | 
						|
	exit 1
 | 
						|
fi
 | 
						|
set +x
 |