@@ -35,21 +35,33 @@ var installCmd = &cobra.Command{
3535 slog .Error (err .Error ())
3636 return
3737 }
38+ anythingChanged := false
3839 for _ , file := range files {
39- binPath , err := shim .Install (& config , file .Name ())
40+ fileName := file .Name ()
41+ runtimeName := shim .RuntimeName (fileName )
42+
43+ binPath , changed , err := shim .Install (& config , fileName )
4044 if err != nil {
41- slog .Error (err . Error () )
45+ slog .Error ("failed to install shim" , "shim" , runtimeName , "error" , err )
4246 return
4347 }
44- slog .Info ("shim installed" , "shim" , shim .RuntimeName (file .Name ()), "path" , binPath )
48+ anythingChanged = anythingChanged || changed
49+ slog .Info ("shim installed" , "shim" , runtimeName , "path" , binPath , "new-version" , changed )
50+
4551 configPath , err := containerd .WriteConfig (& config , binPath )
4652 if err != nil {
47- slog .Error (err . Error () )
53+ slog .Error ("failed to write containerd config" , "shim" , runtimeName , "path" , configPath , "error" , err )
4854 return
4955 }
50- slog .Info ("shim configured" , "shim" , shim .RuntimeName (file .Name ()), "path" , configPath )
56+ slog .Info ("shim configured" , "shim" , runtimeName , "path" , configPath )
57+ }
58+
59+ if ! anythingChanged {
60+ slog .Info ("nothing changed, nothing more to do" )
61+ return
5162 }
5263
64+ slog .Info ("restarting containerd" )
5365 err = containerd .RestartRuntime ()
5466 if err != nil {
5567 slog .Error ("failed to restart containerd" , "error" , err )
0 commit comments