-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add configurable cache bind for chroot #8973
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ function mount_chroot() { | |||||||||||||||
| display_alert "mount_chroot called outside of logging section..." "mount_chroot '$1'\n$(stack_color="${magenta_color:-}" show_caller_full)" "warn" | ||||||||||||||||
| fi | ||||||||||||||||
|
|
||||||||||||||||
| local target | ||||||||||||||||
| local target cache_src | ||||||||||||||||
| target="$(realpath "$1")" # normalize, remove last slash if dir | ||||||||||||||||
| display_alert "mount_chroot" "$target" "debug" | ||||||||||||||||
| mkdir -p "${target}/run/user/0" | ||||||||||||||||
|
|
@@ -26,16 +26,35 @@ function mount_chroot() { | |||||||||||||||
| mount -t sysfs chsys "${target}"/sys | ||||||||||||||||
| mount --bind /dev "${target}"/dev | ||||||||||||||||
| mount -t devpts chpts "${target}"/dev/pts || mount --bind /dev/pts "${target}"/dev/pts | ||||||||||||||||
|
|
||||||||||||||||
| # Bind host cache into chroot if present (configurable via ARMBIAN_CACHE_DIR) | ||||||||||||||||
| cache_src="${ARMBIAN_CACHE_DIR:-/armbian/cache}" | ||||||||||||||||
| if [[ -d "${cache_src}" ]]; then | ||||||||||||||||
| mkdir -p "${target}/armbian/cache" | ||||||||||||||||
| if ! mountpoint -q "${target}/armbian/cache" && mount --bind "${cache_src}" "${target}/armbian/cache"; then | ||||||||||||||||
| : | ||||||||||||||||
| else | ||||||||||||||||
| display_alert "cache bind failed or already bound" "${cache_src} -> ${target}/armbian/cache" "warn" | ||||||||||||||||
| fi | ||||||||||||||||
| else | ||||||||||||||||
| display_alert "Host cache not found — skipping cache mount" "${cache_src}" "warn" | ||||||||||||||||
| fi | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| # umount_chroot <target> | ||||||||||||||||
| function umount_chroot() { | ||||||||||||||||
| if [[ "x${LOG_SECTION}x" == "xx" ]]; then | ||||||||||||||||
| display_alert "umount_chroot called outside of logging section..." "umount_chroot '$1'\n$(stack_color="${magenta_color:-}" show_caller_full)" "warn" | ||||||||||||||||
| fi | ||||||||||||||||
| local target | ||||||||||||||||
| local target cache_src | ||||||||||||||||
| target="$(realpath "$1")" # normalize, remove last slash if dir | ||||||||||||||||
| display_alert "Unmounting" "$target" "info" | ||||||||||||||||
|
|
||||||||||||||||
| cache_src="${ARMBIAN_CACHE_DIR:-/armbian/cache}" | ||||||||||||||||
| if mountpoint -q "${target}/armbian/cache"; then | ||||||||||||||||
| umount "${target}/armbian/cache" || true | ||||||||||||||||
| fi | ||||||||||||||||
|
||||||||||||||||
| cache_src="${ARMBIAN_CACHE_DIR:-/armbian/cache}" | |
| if mountpoint -q "${target}/armbian/cache"; then | |
| umount "${target}/armbian/cache" || true | |
| fi | |
| if mountpoint -q "${target}/armbian/cache"; then | |
| umount "${target}/armbian/cache" || true | |
| fi |
🤖 Prompt for AI Agents
lib/functions/general/chroot-helpers.sh around lines 53 to 56: remove the unused
variable assignment "cache_src=\"${ARMBIAN_CACHE_DIR:-/armbian/cache}\"" on line
53 since it is never referenced; leave the subsequent mountpoint check and
umount logic intact and ensure no other code in the file expects that variable
before committing the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @benhoff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
Uh oh!
There was an error while loading. Please reload this page.