diff options
author | albertogp <albertogp@uma.es> | 2014-04-22 09:51:04 +0000 |
---|---|---|
committer | albertogp <albertogp@uma.es> | 2014-04-22 09:51:04 +0000 |
commit | 4a51c8baee9985b63c3a75e8c65e974228486323 (patch) | |
tree | a5ca64633d38ba6597f6b2e4d2f18ccbfccfa27d /repoman | |
parent | c8bbcdc04f2c3960623c414552dbd1450451b162 (diff) |
branches-version1.0
Integrando cambios en version 1.0
#462
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4244 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'repoman')
-rwxr-xr-x | repoman/bin/deleteimage | 18 | ||||
-rwxr-xr-x | repoman/bin/deletepreimage | 27 |
2 files changed, 37 insertions, 8 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 diff --git a/repoman/bin/deletepreimage b/repoman/bin/deletepreimage index fbaa233e..076ae8e8 100755 --- a/repoman/bin/deletepreimage +++ b/repoman/bin/deletepreimage @@ -29,9 +29,34 @@ mv /opt/opengnsys/www/tmp/*.* /opt/opengnsys/images/ ls /opt/opengnsys/images/*.delete &>/dev/null || exit for IMG in `ls /opt/opengnsys/images/*.delete`; do + ## Obtenemos el nombre de la imagen DELETEIMAGE=$(echo $IMG | awk -F"." '{print $1}' | awk -F"/opt/opengnsys/images/" '{print $2}') + # Borramos marca .delete para que el proximo cron no trabaje sobre este conjunto. [ -f $IMG ] && rm $IMG + + ## Comprobamos si es un Directorio .delete + DELETEdir=$(echo $IMG | awk -F"." '{print $2}') ## .delete + DELETEant=$(echo $IMG | awk -F"." '{print $3}') ## .ant + DELETEdiff=$(echo $IMG | awk -F"." '{print $3}') ## .diff + ## Si NO es ninguno es un img + ## se llama al escript de borrado de imagen. - /opt/opengnsys/bin/deleteimage $DELETEIMAGE + ## Si es un Directorio Borramos + if [[ $DELETEdir == "delete" ]]; then + /opt/opengnsys/bin/deleteimage $DELETEIMAGE d + + # Si es un Imagen Backup Borramos + elif [[ $DELETEant == "ant" ]]; then + DELETEIMAGE=$DELETEIMAGE".ant" + /opt/opengnsys/bin/deleteimage $DELETEIMAGE + + # Si es un Imagen diff Borramos + elif [[ $DELETEdiff == "diff" ]]; then + /opt/opengnsys/bin/deleteimage $DELETEIMAGE + + # Si no es una de las anteriores lo que queda es img + else + /opt/opengnsys/bin/deleteimage $DELETEIMAGE + fi done
\ No newline at end of file |