portzap/libexec/portzap/portzap-erase

39 lines
771 B
Text
Raw Normal View History

#!/bin/sh -e
##
# variables
gitdir=$1
installdir=$2
##
# main
printf "[-] Are you sure ? \n"
printf "[-] These directories will be erased:\n"
2024-04-18 02:02:58 +02:00
printf " [*] %s \n" "${gitdir}"
printf " [*] %s \n" "${installdir}\n"
printf "[y|n] "
while true; do
2024-04-18 02:05:12 +02:00
read -r r
if [ "${r}" = "y" ]; then
break
elif [ "${r}" = "n" ]; then
printf "[-] Nothing to do\n"
exit
else
2024-04-18 02:02:58 +02:00
printf "[-] '%s' is not a valid option.\n" "${r}"
printf "[y|n] "
fi
done
for dir in "${gitdir}" "${installdir}"; do
2024-04-18 02:05:12 +02:00
printf "%s " "${dir}"
find "${dir}" \
-maxdepth 1 \
\! -name "." \
\! -name ".." \
\! -name "ports" \
-exec printf . \; \
-exec rm -rf "{}" \;
echo
done
printf "[-] Done\n"