summarylogtreecommitdiffstats
path: root/cleanup.sh
blob: d67060be05dde4f2d16edd874ac6452754b6f048 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh

# Prompts for confirmation, returns 1 if Yes
#
# Usage: getConfirmation "Question message"
# You can get anwser value on retcode
# if [[ $? == "1"]]; then
#   echo "You choose yes"
# fi
function getConfirmation {
  value=0
  while true; do
    read -p "${1} [Y/n]" yn

    case $yn in
      [Yy]* ) return 0 ;;
      [Nn]* ) return 1 ;;
      * ) return 0 ;;
    esac

  done
}

echo "This script will cleanup all workfiles"
getConfirmation "Do you want to proccess"
if [[ $1 == "0" ]]; then
  echo "Aborting"
  exit 1
fi

rm -r src/
rm -r pkg/
rm v*.zip
rm v*.zip.part
rm *tar.xz

exit 0