From b9ee447dee0789aea1222d1a96f8a78304fcb780 Mon Sep 17 00:00:00 2001 From: "Harish.K" Date: Mon, 6 Jan 2020 13:44:47 +0530 Subject: [PATCH] * Fix the logic of _generic installation script * Add a fallback option to install from any git repository URL ( including local one ) --- lib/installer_common | 10 ++++------ packages/_generic | 10 +++++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/installer_common b/lib/installer_common index 0c29de1..297b3f6 100644 --- a/lib/installer_common +++ b/lib/installer_common @@ -18,12 +18,10 @@ performDownloads(){ } doInstall(){ - - for i in $appName $installationPath; do - if [ -d "$i" ]; then - rm -rf "$i" - fi - done + # Remove application dir if it already exists in installation path + if [ -d "$installationPath" ]; then + rm -rf "$installationPath" + fi installPack; cd "$installTmp"; mv "$appName" "$installationPath"; diff --git a/packages/_generic b/packages/_generic index 209b12c..fa07c1a 100644 --- a/packages/_generic +++ b/packages/_generic @@ -25,6 +25,15 @@ downloadUrl(){ export appName="${repo}-${version}" export installationPath="$appDir/$appName"; wget -c "https://github.com/$username/$repo/archive/${version}.zip" -O "${appName}.zip" + unzip "${appName}.zip"; + ;; + *) + echo "Cloning git repository from $url in $PWD" + export appName=$(basename "$url") + export installationPath="$appDir/$appName"; + echo "installationPath = $installationPath" + if [ -d "$appName" ]; then rm -rf "$appName"; fi + git clone "$url" ;; esac @@ -36,7 +45,6 @@ downloadPack(){ } installPack(){ - unzip "${appName}.zip"; cd $appName; ./install.sh; }