Skip to content

Commit

Permalink
Add distclean.sh
Browse files Browse the repository at this point in the history
This should simplify full cleanup when packaging.

The script was slightly modified from the original contribution of
Eriberto to pass shellcheck checks.

Closes baruch#52
  • Loading branch information
baruch committed Nov 14, 2015
1 parent 6f69475 commit aefe9a2
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions distclean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

# distclean.sh for diskscan
# Copyright 2015 Joao Eriberto Mota Filho <[email protected]>
# v2015111402
# This file can used under GPL-3+ license or BSD-3-Clause.

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

PREFIX="."

# Files and directories to remove

OBJS=" CMakeFiles/ \
Makefile \
CMakeCache.txt \
Documentation/diskscan.1 \
cmake_install.cmake \
install_manifest.txt \
libscsicmd/src/CMakeFiles/ \
libscsicmd/src/Makefile \
libscsicmd/src/cmake_install.cmake \
tags"

# Main procedures

remove_files () {
if [ -e "$PREFIX/$TARGET" ]; then
echo "Removing $PREFIX/$TARGET"
rm -rf "${PREFIX:?}/$TARGET"
else
echo "$PREFIX/$TARGET NOT FOUND."
fi
}

# Distclean

echo "DOING DISTCLEAN..."

for TARGET in $OBJS
do
remove_files
done

echo "DONE."
echo

0 comments on commit aefe9a2

Please sign in to comment.