Skip to content

Instantly share code, notes, and snippets.

@Rodsevich
Created July 22, 2017 22:39
Show Gist options
  • Save Rodsevich/00b39b07d76eb8a77c23951834869e9e to your computer and use it in GitHub Desktop.
Save Rodsevich/00b39b07d76eb8a77c23951834869e9e to your computer and use it in GitHub Desktop.
Instalador de la úitima versión de dart
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "Ejecutá con sudo, pls..."
exit 1
fi
mkdir /tmp/dart_installer &> /dev/null
cd /tmp/dart_installer
rm -rf ./*
read -p "Version a instalar (https://www.dartlang.org/install mostrará la última versión estable disponible) en formato x.yy.z: " VERSION
#VERSION="1.24.2"
wget https://storage.googleapis.com/dart-archive/channels/stable/release/$VERSION/sdk/dartsdk-linux-x64-release.zip
wget https://storage.googleapis.com/dart-archive/channels/stable/release/$VERSION/dartium/dartium-linux-x64-release.zip
unzip -qq -o dartsdk-linux-x64-release.zip -d sdk
unzip -qq -o dartium-linux-x64-release.zip -d dartium
rm dartsdk-linux-x64-release.zip
rm dartium-linux-x64-release.zip
if [ -d /opt/dart ]
then
rm -rf /opt/dart/*
else
mkdir /opt/dart
fi
mv sdk/dart-sdk/* /opt/dart
chmod 755 /opt/dart/bin
if [ -d /opt/dartium ]
then
rm -rf /opt/dartium/*
else
mkdir /opt/dartium
fi
mv dartium/*/* /opt/dartium
if [ ! `grep "/opt/dart/bin" <(echo $PATH)` ]
then
echo -e "\033[31mNo tenés 'opt/dart/bin' en el PATH \033[0m"
echo "Agregá la siguiente linea en alguno de estos directorios /etc/bash/bashrc, /home/$(users | cut -d" " -f1)/.bashrc, etc..."
echo 'PATH="$PATH:/opt/dart/bin"'
else
dart --version
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment