Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman: Add data/config/connections persist #6438

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions bucket/podman.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
}
},
"bin": "podman.exe",
"pre_install": "if (Test-Path \"$persist_dir\\config\\*\") { Copy-Item \"$persist_dir\\config\\*\" \"$Env:UserProfile\\.config\\containers\" -Recurse }",
"installer": {
"script": [
"Expand-DarkArchive \"$dir\\podman-$version-setup.exe\" \"$dir\\_tmp\" -Removal",
Expand All @@ -20,9 +21,42 @@
"Add-Path -Path $original_dir -TargetEnvVar $scoopPathEnvVar -Global:$global -Force"
]
},
"post_install": [
"if ((Test-Path \"$Env:UserProfile\\.local\\share\\containers\\cache\\*\") -and !(Test-Path \"$dir\\data\\cache\\*\")) {",
" info '[Persist Data]: Moving data (cache) from default data directory to scoop persist directory . . .'",
" Move-Item \"$Env:UserProfile\\.local\\share\\containers\\cache\\*\" \"$dir\\data\\cache\"",
"}",
"if ((Test-Path \"$Env:UserProfile\\.local\\share\\containers\\podman\\*\") -and !(Test-Path \"$dir\\data\\podman\\*\")) {",
" info '[Persist Data]: Moving data (podman) from default data directory to scoop persist directory . . .'",
" Move-Item \"$Env:UserProfile\\.local\\share\\containers\\podman\\*\" \"$dir\\data\\podman\"",
"}",
"if ((Test-Path \"$Env:UserProfile\\.local\\share\\containers\\storage\\*\") -and !(Test-Path \"$dir\\data\\storage\\*\")) {",
" info '[Persist Data]: Moving data (storage) from default data directory to scoop persist directory . . .'",
" Move-Item \"$Env:UserProfile\\.local\\share\\containers\\storage\\*\" \"$dir\\data\\storage\"",
"}",
"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\"",
"}"
],
"uninstaller": {
"script": "Remove-Path -Path $dir -TargetEnvVar $scoopPathEnvVar -Global:$global -Force"
},
"env_set": {
"XDG_DATA_HOME": "$dir\\data",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This environment variable will impact numerous other applications. Is there an alternative method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the doc, it is the most elegant way to config.

Or, I can use the method for config persist directory, like L13 and L43-L46, which avoid the use of environment variable XDG_CONFIG_HOME.

I implemented different methods because I'm not sure which is the preferred way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is advisable to avoid using XDG_CONFIG_HOME imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, now all environment variables start with XDG_ are removed from this PR.

"PODMAN_CONNECTIONS_CONF": "$dir\\connections\\podman-connections.json"
},
"persist": [
"data",
"config",
"connections"
],
"checkver": {
"github": "https://github.com/containers/podman"
},
Expand Down