Files
installer-scripts/packages/_generic
T
harish2704 b9ee447dee * Fix the logic of _generic installation script
* Add a fallback option to install from any git repository URL ( including local one )
2020-01-06 13:44:47 +05:30

51 lines
992 B
Bash

#!/usr/bin/env sh
export appName
downloadUrl(){
url=$1;
host='';
repo='';
tree='';
case $url in
https://github.com/*)
host='github.com';
url=${url#https://github.com/};
username=${url%%/*}
url=${url#*/}
repo=${url%%/*}
url=${url#*/}
version=${url%%/*}
if [ $version = $url ]; then version='master'; fi;
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
}
downloadPack(){
downloadUrl $packageName
}
installPack(){
cd $appName;
./install.sh;
}