Преглед изворни кода

feat: add preliminary support for yum and apk

Kyle P Davis пре 5 година
родитељ
комит
a9603aeae4
3 измењених фајлова са 13 додато и 9 уклоњено
  1. 9 7
      gimme
  2. 1 1
      gimmes/gcc
  3. 3 1
      gimmes/node

+ 9 - 7
gimme

@@ -61,13 +61,15 @@ gimme_pkg() {
 				brew search "$1"
 			fi
 		fi
-	else
-		if ! has apt-get; then
-			echo "ERROR: Your OS does not have 'apt-get' and is not currently supported."
-			echo "For support please see the website: $GIMME_URL"
-		fi
-		if [[ "$1" ]]; then
+	elif [[ "$1" ]]; then
+		if has apt-get; then
 			sudo apt-get -y install "$@"
+		elif has yum; then
+			sudo yum -y install "$@"
+		elif has apk; then
+			sudo apk add "$@"
+		else
+			echo "ERROR: This OS is not currently supported. See the website for details: $GIMME_URL"
 		fi
 	fi
 }
@@ -110,7 +112,7 @@ if [[ "$0" =~ -?(z|ba)sh ]]; then # sourced or piped
 				exit 1
 			fi
 		else
-			has gcc  ||  gimme_pkg build-essential
+			has gcc  ||  gimme_pkg build-essential  ||  gimme_pkg gcc
 		fi
 
 		# gimmes/git: inlined for curl-based installs

+ 1 - 1
gimmes/gcc

@@ -11,5 +11,5 @@ if [[ "$OS" = "Darwin" ]]; then
 		exit 1
 	fi
 else
-	has gcc  ||  gimme_pkg build-essential
+	has gcc  ||  gimme_pkg build-essential  ||  gimme_pkg gcc
 fi

+ 3 - 1
gimmes/node

@@ -7,6 +7,8 @@ if ! has node; then
 	else
 		gimme_pkg nodejs npm libgnome-keyring-dev fakeroot
 		sudo npm config set python /usr/bin/python2 -g
-		sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
+		if has update-alternatives; then
+			sudo update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
+		fi
 	fi
 fi