-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from hoobs-org/development
Development
- Loading branch information
Showing
7 changed files
with
512 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
#!/bin/bash | ||
|
||
################################################################################################## | ||
# hoobs-cli # | ||
# Copyright (C) 2020 HOOBS # | ||
# Copyright (C) 2020 NodeSource # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU General Public License as published by # | ||
# the Free Software Foundation, either version 3 of the License, or # | ||
# (at your option) any later version. # | ||
# # | ||
# This program is distributed in the hope that it will be useful, # | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||
# GNU General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
################################################################################################## | ||
|
||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
SCRSUFFIX="_current.x" | ||
NODENAME="Node.js 16.x" | ||
NODEREPO="node_16.x" | ||
NODEPKG="nodejs" | ||
|
||
if test -t 1; then # if terminal | ||
ncolors=$(which tput > /dev/null && tput colors) # supports color | ||
|
||
if test -n "$ncolors" && test $ncolors -ge 8; then | ||
termcols=$(tput cols) | ||
bold="$(tput bold)" | ||
underline="$(tput smul)" | ||
standout="$(tput smso)" | ||
normal="$(tput sgr0)" | ||
black="$(tput setaf 0)" | ||
red="$(tput setaf 1)" | ||
green="$(tput setaf 2)" | ||
yellow="$(tput setaf 3)" | ||
blue="$(tput setaf 4)" | ||
magenta="$(tput setaf 5)" | ||
cyan="$(tput setaf 6)" | ||
white="$(tput setaf 7)" | ||
fi | ||
fi | ||
|
||
bail() { | ||
echo 'Error executing command, exiting' | ||
exit 1 | ||
} | ||
|
||
exec_cmd_nobail() { | ||
echo "+ $1" | ||
bash -c "$1" | ||
} | ||
|
||
exec_cmd() { | ||
exec_cmd_nobail "$1" || bail | ||
} | ||
|
||
setup() { | ||
echo "Installing the NodeSource ${NODENAME} repo..." | ||
|
||
if $(uname -m | grep -Eq ^armv6); then | ||
echo "You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by HOOBS." | ||
|
||
exit 1 | ||
fi | ||
|
||
PRE_INSTALL_PKGS="" | ||
|
||
if [ ! -e /usr/lib/apt/methods/https ]; then | ||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https" | ||
fi | ||
|
||
if [ ! -x /usr/bin/lsb_release ]; then | ||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release" | ||
fi | ||
|
||
if [ ! -x /usr/bin/gpg ]; then | ||
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} gnupg" | ||
fi | ||
|
||
exec_cmd 'apt-get update' | ||
|
||
if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then | ||
exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1" | ||
fi | ||
|
||
IS_PRERELEASE=$(lsb_release -d | grep 'Ubuntu .*development' >& /dev/null; echo $?) | ||
|
||
if [[ $IS_PRERELEASE -eq 0 ]]; then | ||
echo "Your distribution, identified as \"$(lsb_release -d -s)\", is a pre-release version of Ubuntu. HOOBS does not support pre-release versions." | ||
exit 1 | ||
fi | ||
|
||
DISTRO=$(lsb_release -c -s) | ||
|
||
check_alt() { | ||
if [ "X${DISTRO}" == "X${2}" ]; then | ||
DISTRO="${4}" | ||
fi | ||
} | ||
|
||
check_alt "SolydXK" "solydxk-9" "Debian" "stretch" | ||
check_alt "Kali" "sana" "Debian" "jessie" | ||
check_alt "Kali" "kali-rolling" "Debian" "bullseye" | ||
check_alt "Sparky Linux" "Tyche" "Debian" "stretch" | ||
check_alt "Sparky Linux" "Nibiru" "Debian" "buster" | ||
check_alt "MX Linux 17" "Horizon" "Debian" "stretch" | ||
check_alt "MX Linux 18" "Continuum" "Debian" "stretch" | ||
check_alt "MX Linux 19" "patito feo" "Debian" "buster" | ||
check_alt "Linux Mint" "maya" "Ubuntu" "precise" | ||
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty" | ||
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty" | ||
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty" | ||
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty" | ||
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial" | ||
check_alt "Linux Mint" "serena" "Ubuntu" "xenial" | ||
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial" | ||
check_alt "Linux Mint" "sylvia" "Ubuntu" "xenial" | ||
check_alt "Linux Mint" "tara" "Ubuntu" "bionic" | ||
check_alt "Linux Mint" "tessa" "Ubuntu" "bionic" | ||
check_alt "Linux Mint" "tina" "Ubuntu" "bionic" | ||
check_alt "Linux Mint" "tricia" "Ubuntu" "bionic" | ||
check_alt "Linux Mint" "ulyana" "Ubuntu" "focal" | ||
check_alt "Linux Mint" "ulyssa" "Ubuntu" "focal" | ||
check_alt "LMDE" "betsy" "Debian" "jessie" | ||
check_alt "LMDE" "cindy" "Debian" "stretch" | ||
check_alt "LMDE" "debbie" "Debian" "buster" | ||
check_alt "elementaryOS" "luna" "Ubuntu" "precise" | ||
check_alt "elementaryOS" "freya" "Ubuntu" "trusty" | ||
check_alt "elementaryOS" "loki" "Ubuntu" "xenial" | ||
check_alt "elementaryOS" "juno" "Ubuntu" "bionic" | ||
check_alt "elementaryOS" "hera" "Ubuntu" "bionic" | ||
check_alt "elementaryOS" "odin" "Ubuntu" "focal" | ||
check_alt "Trisquel" "toutatis" "Ubuntu" "precise" | ||
check_alt "Trisquel" "belenos" "Ubuntu" "trusty" | ||
check_alt "Trisquel" "flidas" "Ubuntu" "xenial" | ||
check_alt "Trisquel" "etiona" "Ubuntu" "bionic" | ||
check_alt "Uruk GNU/Linux" "lugalbanda" "Ubuntu" "xenial" | ||
check_alt "BOSS" "anokha" "Debian" "wheezy" | ||
check_alt "BOSS" "anoop" "Debian" "jessie" | ||
check_alt "BOSS" "drishti" "Debian" "stretch" | ||
check_alt "BOSS" "unnati" "Debian" "buster" | ||
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie" | ||
check_alt "bunsenlabs" "helium" "Debian" "stretch" | ||
check_alt "bunsenlabs" "lithium" "Debian" "buster" | ||
check_alt "Tanglu" "chromodoris" "Debian" "jessie" | ||
check_alt "PureOS" "green" "Debian" "sid" | ||
check_alt "PureOS" "amber" "Debian" "buster" | ||
check_alt "Devuan" "jessie" "Debian" "jessie" | ||
check_alt "Devuan" "ascii" "Debian" "stretch" | ||
check_alt "Devuan" "beowulf" "Debian" "buster" | ||
check_alt "Devuan" "ceres" "Debian" "sid" | ||
check_alt "Deepin" "panda" "Debian" "sid" | ||
check_alt "Deepin" "unstable" "Debian" "sid" | ||
check_alt "Deepin" "stable" "Debian" "buster" | ||
check_alt "Pardus" "onyedi" "Debian" "stretch" | ||
check_alt "Liquid Lemur" "lemur-3" "Debian" "stretch" | ||
check_alt "Astra Linux" "orel" "Debian" "stretch" | ||
check_alt "Ubilinux" "dolcetto" "Debian" "stretch" | ||
|
||
if [ "X${DISTRO}" == "Xdebian" ]; then | ||
echo "Unknown Debian-based distribution, checking /etc/debian_version..." | ||
NEWDISTRO=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version) | ||
|
||
if [ "X${NEWDISTRO}" == "X" ]; then | ||
echo "Could not determine distribution from /etc/debian_version..." | ||
else | ||
DISTRO=$NEWDISTRO | ||
echo "Found \"${DISTRO}\" in /etc/debian_version..." | ||
fi | ||
fi | ||
|
||
echo "Confirming \"${DISTRO}\" is supported..." | ||
|
||
exec_cmd_nobail "wget -qO /dev/null -o /dev/null 'https://deb.nodesource.com/${NODEREPO}/dists/${DISTRO}/Release'" | ||
RC=$? | ||
|
||
if [[ $RC != 0 ]]; then | ||
echo "Your distribution, identified as \"${DISTRO}\", is not currently supported, please contact NodeSource at https://github.com/nodesource/distributions/issues if you think this is incorrect or would like your distribution to be considered for support" | ||
exit 1 | ||
fi | ||
|
||
if [ -f "/etc/apt/sources.list.d/chris-lea-node_js-$DISTRO.list" ]; then | ||
echo 'Removing Launchpad PPA Repository for NodeJS...' | ||
|
||
exec_cmd_nobail 'add-apt-repository -y -r ppa:chris-lea/node.js' | ||
exec_cmd "rm -f /etc/apt/sources.list.d/chris-lea-node_js-${DISTRO}.list" | ||
fi | ||
|
||
echo "Adding the NodeSource repository" | ||
|
||
exec_cmd 'wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -' | ||
exec_cmd "echo 'deb https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' > /etc/apt/sources.list.d/nodesource.list" | ||
exec_cmd "echo 'deb-src https://deb.nodesource.com/${NODEREPO} ${DISTRO} main' >> /etc/apt/sources.list.d/nodesource.list" | ||
|
||
echo "Adding the Yarn repository" | ||
|
||
exec_cmd "wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -" | ||
exec_cmd "echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list" | ||
|
||
echo "Adding the HOOBS repository" | ||
|
||
exec_cmd "wget -qO- https://dl.hoobs.org/deb/key.gpg | apt-key add -" | ||
exec_cmd "echo 'deb https://dl.hoobs.org/deb/bleeding/ buster main' | tee /etc/apt/sources.list.d/hoobs.list" | ||
|
||
echo "Updating packages" | ||
|
||
exec_cmd 'apt-get update' | ||
|
||
echo "Run \"${bold}sudo apt install -y hoobs${normal}\" to install HOOBS, node and yarn" | ||
} | ||
|
||
setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.