From 56fe303b086a830c188cc0aeb1532fb78dacb41d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Grondek?= Date: Tue, 19 Nov 2019 09:53:51 +0100 Subject: [PATCH] [nodejs] Created nodejs installation script --- nodejs/Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 nodejs/Makefile diff --git a/nodejs/Makefile b/nodejs/Makefile new file mode 100644 index 0000000..62fbe4b --- /dev/null +++ b/nodejs/Makefile @@ -0,0 +1,25 @@ +NODE_PACKAGES=nodejs +VERSION=node_12.x +NODE_BIN=/usr/bin/nodejs + +ROOT_TEE=sudo tee +ROOT_APT=sudo aptitude +ROOT_ADD_KEY=sudo apt-key +ROOT_ADD_USER_TO_GROUP=sudo adduser +ROOT_ADD_PPA=add-apt-repository -y +RELEASE:=$(shell lsb_release -cs) + +clean: + -$(ROOT_APT) -y purge $(NODE_PACKAGES) + -$(ROOT_ADD_PPA) -i ppa:chris-lea/node.js + -sudo rm -f /etc/apt/sources.list.d/chislea-node_js-*.list + -sudo rm -f /etc/apt/sources.list.d/chislea-node_js-*.list.save + +install: $(NODE_BIN) + +$(NODE_BIN): + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | $(ROOT_ADD_KEY) add - + echo "deb https://deb.nodesource.com/$(VERSION) $(RELEASE) main" | $(ROOT_TEE) /etc/apt/sources.list.d/nodesource.list + echo "deb-src https://deb.nodesource.com/$(VERSION) $(RELEASE) main" | $(ROOT_TEE) -a /etc/apt/sources.list.d/nodesource.list + $(ROOT_APT) update + $(ROOT_APT) install -y $(NODE_PACKAGES)