Files
installer-scripts/lib/installer_common
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

49 lines
933 B
Bash

#!/usr/bin/env sh
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(){
# Remove application dir if it already exists in installation path
if [ -d "$installationPath" ]; then
rm -rf "$installationPath"
fi
installPack;
cd "$installTmp";
mv "$appName" "$installationPath";
}
updateBinLinks(){
cd $localBinDir;
for i in $(find "$appDir" -name 'binaries.lst'); do
for f in $(cat $i);do
if [ -e "./$(basename $f)" ]; then
echo "Removing already existing file $(basename $f)"
rm "./$(basename $f)";
fi
ln -s $(dirname $i)/$f ./;
done;
done;
}
mainInstaller(){
checkPaths;
performDownloads;
doInstall;
updateBinLinks;
}