ThirdParty: modification to the bash uninstallPackage() function.

Make it easier to read, and more portable.
This commit is contained in:
Martin Beaudoin 2018-06-25 22:37:58 -04:00
parent 6aba1630ed
commit 8a12411d38

View file

@ -284,22 +284,42 @@ uninstallPackage()
pkg="$1";
echo "Removing ${pkg}"
[ -f $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}*.rpm ] && \
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}*.rpm || \
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}*.rpm"
[ -f $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz ] && \
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz || \
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz"
[ -f $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz ] && \
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz || \
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz"
[ -d $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}* ] && \
rm -rf $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}* || \
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}*"
if [ "$2" = "alsoPackage" ]; then
[ -d $WM_THIRD_PARTY_DIR/packages/$pkg ] && \
rm -rf $WM_THIRD_PARTY_DIR/packages/$pkg || \
echo "Not found: $WM_THIRD_PARTY_DIR/packages/$pkg"
if [[ -f $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}-$WM_OPTIONS.$architecture.rpm ]]; then
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}-$WM_OPTIONS.$architecture.rpm
else
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/RPMS/$architecture/${pkg}*.rpm"
fi
if [[ -f $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz ]]; then
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz
else
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/SOURCES/${pkg}.tar.gz"
fi
if [[ -f $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz ]]; then
rm -f $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz
else
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/TGZS/$architecture/${pkg}.tgz"
fi
foundDir=false
for dir_ in $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}*
do
if [[ -d "$dir_" ]]; then
rm -rf $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}*
foundDir=true
fi
done
if [ "$foundDir" = false ] ; then
echo "Not found: $WM_THIRD_PARTY_DIR/rpmBuild/BUILD/${pkg}*"
fi
if [[ "$2" = "alsoPackage" ]]; then
if [[ -d $WM_THIRD_PARTY_DIR/packages/$pkg ]]; then
rm -rf $WM_THIRD_PARTY_DIR/packages/$pkg
else
echo "Not found: $WM_THIRD_PARTY_DIR/packages/$pkg"
fi
else
echo "Add option alsoPackage to remove the installed files."
fi