From 3ae4934a433257a069e8bcd8f2dca088576e5b6a Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Sun, 12 Jul 2015 13:13:04 +0530 Subject: [PATCH] Initial commit --- installer_common | 38 ++++++++++++++++++++++++++++++++++++++ nodejs | 18 ++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 installer_common create mode 100755 nodejs diff --git a/installer_common b/installer_common new file mode 100644 index 0000000..c448c2a --- /dev/null +++ b/installer_common @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +installTmp="$HOME/.local/installTmp"; +appDir="$HOME/.local/Apps"; +localBinDir="$HOME/.local/bin"; + +checkPaths() { + for i in $installTmp $appDir $localBinDir; do + if [ ! -d "$i" ]; then + mkdir -p "$i"; + fi + done +} + +performDownloads(){ + cd "$installTmp"; + downloadPack; +} + +doInstall(){ + + for i in $extractedName $installationPath; do + if [ -d "$i" ]; then + rm -rf "$i" + fi + done + installPack; + cd "$installTmp"; + mv "$extractedName" "$installationPath"; +} + +mainInstaller(){ + checkPaths; + performDownloads; + doInstall; +} + + diff --git a/nodejs b/nodejs new file mode 100755 index 0000000..4e179d8 --- /dev/null +++ b/nodejs @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +. $(dirname $(readlink -f $0))/installer_common; +export extractedName='node-v0.12.7-linux-x64'; +export installationPath="$appDir/$extractedName"; + +downloadPack(){ + wget -c 'https://nodejs.org/dist/v0.12.7/node-v0.12.7-linux-x64.tar.gz'; +} + +installPack(){ + tar -xzvf 'node-v0.12.7-linux-x64.tar.gz'; + cd "$extractedName"; + find ./bin -type f -or -type l -executable > 'binaries.lst'; +} + + +mainInstaller;