Skip to content

Commit 4297b46

Browse files
committed
Update unRaid's built in image version database to updates show correctly in UI
1 parent 950105b commit 4297b46

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?PHP
2+
/* This file and functionality is based on and uses the Dynamix Docker Danager from unRaid
3+
* Script by mtongnz, Jan 2024
4+
*
5+
* Copyright 2005-2022, Lime Technology
6+
* Copyright 2014-2022, Guilherme Jardim, Eric Schultz, Jon Panozzo.
7+
* Copyright 2012-2022, Bergware International.
8+
*
9+
* This program is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU General Public License version 2,
11+
* as published by the Free Software Foundation.
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*/
16+
?>
17+
<?
18+
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
19+
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
20+
21+
$images = array();
22+
23+
// Take stdin from compose.sh and put into images array
24+
$f = fopen( 'php://stdin', 'r' );
25+
while( $image = fgets( $f ) )
26+
$images[] = trim($image);
27+
fclose( $f );
28+
$images = array_unique($images);
29+
30+
31+
echo "\nUpdating unRaid's image version details for " . count($images) . " image(s):\n";
32+
$DockerUpdate = new DockerUpdate();
33+
34+
foreach( $images as $image ) {
35+
echo " - updating " . $image . "\n";
36+
37+
// Delete current info to force an update
38+
$updateStatus = DockerUtil::loadJSON($dockerManPaths['update-status']);
39+
$updateStatus[$image]['local'] = null;
40+
DockerUtil::saveJSON($dockerManPaths['update-status'], $updateStatus);
41+
42+
// Update the version info
43+
$DockerUpdate->reloadUpdateStatus($image);
44+
}
45+
46+
echo "unRaid image versions updated\n";
47+
?>

source/compose.manager/scripts/compose.sh

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22
export HOME=/root
33

4+
phpScriptDir=/usr/local/emhttp/plugins/compose.manager/php
5+
46
SHORT=e:,c:,f:,p:,d:,o:
57
LONG=env,command:,file:,project_name:,project_dir:,override:,debug,recreate
68
OPTS=$(getopt -a -n compose --options $SHORT --longoptions $LONG -- "$@")
@@ -127,6 +129,9 @@ case $command in
127129
fi
128130
eval docker rmi ${images[*]}
129131
fi
132+
133+
# Update unRaid's local/remote image versions database so GUI shows correct info about updates
134+
docker compose -p "$name" ps --format "{{.Image}}" | php $phpScriptDir/DockerUpdate.php 2>&1
130135
;;
131136

132137
stop)

0 commit comments

Comments
 (0)