PKGBUILD/MELAWY/Installer/clean.sh

43 lines
916 B
Bash
Executable File

#!/bin/bash
REPO="$(cat repo.txt | tr -d '[:blank:]' | tr -d '[:space:]')"
echo -n $( dirname -- "$( readlink -f -- "$0" )" ) > pwd.txt
CWD=$(cat pwd.txt)
dir_list=$(find . -mindepth 2 -maxdepth 4 -name "PKGBUILD" -type f)
for i in ${dir_list[@]}
do
path="$(dirname $i)"
full_path="$CWD/$path"
echo "$full_path"
cd "$full_path"
git_dir="$(find . -mindepth 1 -maxdepth 1 -name "$(basename $full_path)" -type d)"
if [ -n "$git_dir" ] && [ -d "$git_dir" ]; then
echo "rm -rf $git_dir"
rm -rf "$git_dir"
fi
if [ -d "$full_path/src" ]; then
rm -rf "$full_path/src"
fi
if [ -d "$full_path/pkg" ]; then
rm -rf "$full_path/pkg"
fi
cd "$CWD"
done
echo "Ready"
sleep 5
process=$(ps x | grep konsole | grep $0 | awk '{print $1}')
if [ $(( "$process" + 0 )) -ne 0 ]; then
kill $(ps x | grep konsole | grep $0 | awk '{print $1}')
fi