2013-10-07 12:30:08 +02:00
|
|
|
function showhelp {
|
2013-10-09 14:52:10 +02:00
|
|
|
echo -e "\nusage: clean-container-state [-g <ghn_home>] [-h] \n"
|
|
|
|
echo " ghn_home = the gHN directory."
|
2013-10-07 12:30:08 +02:00
|
|
|
echo -e " h = shows this help.\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
while getopts "g:h" opt; do
|
|
|
|
case $opt in
|
|
|
|
g) ghnhome=$OPTARG;;
|
|
|
|
h) showhelp
|
|
|
|
exit 0 ;;
|
|
|
|
:) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
|
|
|
|
showhelp;
|
|
|
|
echo -e "\naborting.\n"
|
|
|
|
exit 1;;
|
|
|
|
\?) echo -e "\nERROR:invalid option: -$OPTARG";
|
|
|
|
showhelp;
|
|
|
|
echo -e "\naborting.\n"
|
|
|
|
exit 1 >&2 ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$ghnhome" ]; then
|
|
|
|
if [ -z "$GHN_HOME" ]; then
|
|
|
|
echo -e "\nERROR:please specify the gHN directory (-g) or define the GHN_HOME env var." >&2
|
|
|
|
showhelp
|
|
|
|
echo -e "\naborting.\n"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
ghnhome=$GHN_HOME
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Removing container state $ghnhome"
|
|
|
|
#removing folder
|
2013-10-07 17:30:38 +02:00
|
|
|
rm -rf $ghnhome/state
|