summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/WebConsole/rest/opengnsys-api.yml12
-rw-r--r--admin/WebConsole/rest/repository.php7
-rwxr-xr-xrepoman/bin/checkrepo3
3 files changed, 19 insertions, 3 deletions
diff --git a/admin/WebConsole/rest/opengnsys-api.yml b/admin/WebConsole/rest/opengnsys-api.yml
index e37559d5..34b44752 100644
--- a/admin/WebConsole/rest/opengnsys-api.yml
+++ b/admin/WebConsole/rest/opengnsys-api.yml
@@ -1197,7 +1197,7 @@ definitions:
description: image name (file name without extension)
type: string
type:
- description: image type (file extension or ''dir'' for directory image)
+ description: image type (file extension or `dir` for directory image)
type: string
clientname:
description: source client name
@@ -1226,5 +1226,13 @@ definitions:
mode:
description: image access permissions (four octal digits)
type: string
- required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode ]
+ backedup:
+ description: image backed up flag (check if `.ant` file exists)
+ type: boolean
+ default: false
+ backupsize:
+ description: image backup size (bytes)
+ type: integer
+ format: int64
+ required: [ name, type, clientname, clonator, compressor, filesystem, datasize, size, modified, mode, backedup ]
diff --git a/admin/WebConsole/rest/repository.php b/admin/WebConsole/rest/repository.php
index e5ce76bd..3acb4230 100644
--- a/admin/WebConsole/rest/repository.php
+++ b/admin/WebConsole/rest/repository.php
@@ -97,6 +97,13 @@ $app->get('/repository/images(/)', 'validateRepositoryApiKey',
$response['images'][$i]['size'] = @stat($file)['size'];
$response['images'][$i]['modified'] = date("Y-m-d H:i:s", @stat($file)['mtime']);
$response['images'][$i]['mode'] = substr(decoct(@stat($file)['mode']), -4);
+ $backupfile = $file.".ant";
+ if (file_exists($backupfile)) {
+ $response['images'][$i]['backedup'] = true;
+ $response['images'][$i]['backupsize'] = @stat($backupfile)['size'];
+ } else {
+ $response['images'][$i]['backedup'] = false;
+ }
}
// Complete image in OUs information.
for ($j=0; $j<sizeof(@$response['ous']); $j++) {
diff --git a/repoman/bin/checkrepo b/repoman/bin/checkrepo
index 40643931..822ae20a 100755
--- a/repoman/bin/checkrepo
+++ b/repoman/bin/checkrepo
@@ -153,6 +153,7 @@ function checkfiles() {
# Retrieve image creation data and delete temporary file.
INFO="$IMG.info"
[ -e "$INFO" -a "$INFO" -ot "$IMG" ] && rm -f "$INFO" && echo "Warning: Deleted outdated file $INFO"
+ DATA=""
[ -r "$INFO" ] && DATA=$(cat "$INFO")
# Add data to configuration file (name, type and data) and remove image info file.
IMG=${IMG#$IMAGESDIR/}
@@ -170,7 +171,7 @@ function checkdirs() {
IMG="$(dirname "${INFO#$IMAGESDIR/}")"
# Skip repository root directory and locked images.
[ "$IMG" == "$IMAGESDIR" -o -e "$IMG.lock" ] && continue
- DATA=$(awk -F= '$1=="# fstype" {fs=$2} $1=="# sizedata" {sz=$2} END {printf "::%s:%s:",fs,sz}' "$INFO")
+ DATA=$(awk -F= '$1=="# fstype" {fs=$2} $1=="# sizedata" {sz=$2} END {printf "rsync::%s:%s:",fs,sz}' "$INFO")
# Add data to configuration file (name, type and data).
addToJson "$IMG" "dir" "$DATA"
done