diff --git a/bucket/podman.json b/bucket/podman.json index 150f540e6d34f..b341d12776567 100644 --- a/bucket/podman.json +++ b/bucket/podman.json @@ -10,6 +10,24 @@ } }, "bin": "podman.exe", + "pre_install": [ + "if (Test-Path \"$persist_dir\\config\\*\") {", + " New-Item \"$Env:UserProfile\\.config\\containers\" -ItemType Directory -Force | Out-Null", + " Copy-Item \"$persist_dir\\config\\*\" \"$Env:UserProfile\\.config\\containers\" -Recurse", + "}", + "if (Test-Path \"$persist_dir\\data\\cache\\*\") {", + " New-Item \"$Env:UserProfile\\.local\\share\\containers\\cache\" -ItemType Directory -Force | Out-Null", + " Copy-Item \"$persist_dir\\data\\cache\\*\" \"$Env:UserProfile\\.local\\share\\containers\\cache\" -Recurse", + "}", + "if (Test-Path \"$persist_dir\\data\\podman\\*\") {", + " New-Item \"$Env:UserProfile\\.local\\share\\containers\\podman\" -ItemType Directory -Force | Out-Null", + " Copy-Item \"$persist_dir\\data\\podman\\*\" \"$Env:UserProfile\\.local\\share\\containers\\podman\" -Recurse", + "}", + "if (Test-Path \"$persist_dir\\data\\storage\\*\") {", + " New-Item \"$Env:UserProfile\\.local\\share\\containers\\storage\" -ItemType Directory -Force | Out-Null", + " Copy-Item \"$persist_dir\\data\\storage\\*\" \"$Env:UserProfile\\.local\\share\\containers\\storage\" -Recurse", + "}" + ], "installer": { "script": [ "Expand-DarkArchive \"$dir\\podman-$version-setup.exe\" \"$dir\\_tmp\" -Removal", @@ -20,9 +38,41 @@ "Add-Path -Path $original_dir -TargetEnvVar $scoopPathEnvVar -Global:$global -Force" ] }, + "post_install": [ + "if ((Test-Path \"$Env:AppData\\containers\\*\") -and !(Test-Path \"$dir\\connections\\*\")) {", + " info '[Persist Data]: Moving connections from default data directory to scoop persist directory . . .'", + " Move-Item \"$Env:AppData\\containers\\*\" \"$dir\\connections\"", + "}" + ], + "pre_uninstall": [ + "if (Test-Path \"$Env:UserProfile\\.config\\containers\\*\") {", + " Remove-Item \"$dir\\config\\*\" -Recurse -Force", + " Move-Item \"$Env:UserProfile\\.config\\containers\\*\" \"$dir\\config\"", + "}", + "if (Test-Path \"$Env:UserProfile\\.local\\share\\containers\\cache\\*\") {", + " Remove-Item \"$dir\\data\\cache\\*\" -Recurse -Force", + " Move-Item \"$Env:UserProfile\\.local\\share\\containers\\cache\\*\" \"$dir\\data\\cache\"", + "}", + "if (Test-Path \"$Env:UserProfile\\.local\\share\\containers\\podman\\*\") {", + " Remove-Item \"$dir\\data\\podman\\*\" -Recurse -Force", + " Move-Item \"$Env:UserProfile\\.local\\share\\containers\\podman\\*\" \"$dir\\data\\podman\"", + "}", + "if (Test-Path \"$Env:UserProfile\\.local\\share\\containers\\storage\\*\") {", + " Remove-Item \"$dir\\data\\storage\\*\" -Recurse -Force", + " Move-Item \"$Env:UserProfile\\.local\\share\\containers\\storage\\*\" \"$dir\\data\\storage\"", + "}" + ], "uninstaller": { "script": "Remove-Path -Path $dir -TargetEnvVar $scoopPathEnvVar -Global:$global -Force" }, + "env_set": { + "PODMAN_CONNECTIONS_CONF": "$dir\\connections\\podman-connections.json" + }, + "persist": [ + "data", + "config", + "connections" + ], "checkver": { "github": "https://github.com/containers/podman" },