summaryrefslogtreecommitdiffstats
path: root/repoman/bin/deleteimage
diff options
context:
space:
mode:
Diffstat (limited to 'repoman/bin/deleteimage')
-rwxr-xr-xrepoman/bin/deleteimage18
1 files changed, 11 insertions, 7 deletions
diff --git a/repoman/bin/deleteimage b/repoman/bin/deleteimage
index 1c9751cf..3807b841 100755
--- a/repoman/bin/deleteimage
+++ b/repoman/bin/deleteimage
@@ -25,28 +25,31 @@ DIFFEXT="diff"
if [ "$*" == "help" ]; then
cat << EOT
$PROG: Borra los ficheros de una imagen del repositorio.
-Formato: $PROG [ -b | -r | -i ] str_image
+Formato: $PROG [ -b | -r | -i | -d ] str_image
-b Elimina también la copia de seguridad de la imagen.
-r Recupera la copia de seguridad de la imagen.
-i Elimina imagen Incremental o Basica
+ -d Elimina Directorios
Ejemplo: $PROG imagen1
EOT
exit 0
fi
# Procesar parámetros
-while getopts bri OPTION; do
+while getopts brid OPTION; do
case $OPTION in
b) DELETEBACKUP=1 ;;
r) RECOVERBACKUP=1 ;;
i) DELETEINCREMEN=1 ;;
+ d) DELETEDIRECTORIO=1 ;;
*) ERR=1 ;;
esac
shift $((OPTIND-1))
done
-[ -n "$DELETEBACKUP" ] && [ -n "$RECOVERBACKUP" ] && [ -n "$DELETEINCREMEN" ] && ERR=1
+
+[ -n "$DELETEBACKUP" ] && [ -n "$RECOVERBACKUP" ] && [ -n "$DELETEINCREMEN" ] && [ -n "$DELETEDIRECTORIO" ] && ERR=1
if [ $# != 1 -o -n "$ERR" ]; then
- echo "$PROG Error: Formato: $PROG [ -b | -r | -i ] str_image"
+ echo "$PROG Error: Formato: $PROG [ -b | -r | -i | -d ] str_image"
exit 1
fi
@@ -71,8 +74,9 @@ fi
# Si el Nombre canonico es un directorio eliminamos
# o si la opcion es i tambien eliminamos
IMGFILECA="$OGIMG/$1"
-if [ -d "$IMGFILECA" ];then
-rm -R $IMGFILECA
+if [ -n "$DELETEDIRECTORIO" ]; then
+rm -R $IMGFILECA && exit
+
# Si el Nomobre canonico NO es un directorio
else
# Comprobamos si es un archivo backup .ant
@@ -97,4 +101,4 @@ else
fi
fi
-fi
+fi \ No newline at end of file