mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
context: default and relative BEESHOME
Allow relative paths with BEESHOME. These paths will be relative to the root of the dedup target filesystem. BEESHOME is now optional. If not specified, '.beeshome' is used. We don't try to create BEESHOME if it doesn't exist. BEESHOME might not be on a btrfs filesystem, so we can't insist it be a subvol.
This commit is contained in:
parent
6fa8de660b
commit
fdfa78a81b
@ -229,12 +229,23 @@ BeesContext::show_progress()
|
||||
}
|
||||
}
|
||||
|
||||
Fd
|
||||
BeesContext::home_fd()
|
||||
{
|
||||
const char *base_dir = getenv("BEESHOME");
|
||||
if (!base_dir) {
|
||||
base_dir = ".beeshome";
|
||||
}
|
||||
m_home_fd = openat(root_fd(), base_dir, FLAGS_OPEN_DIR);
|
||||
if (!m_home_fd) {
|
||||
THROW_ERRNO("openat: " << name_fd(root_fd()) << " / " << base_dir);
|
||||
}
|
||||
return m_home_fd;
|
||||
}
|
||||
|
||||
BeesContext::BeesContext(shared_ptr<BeesContext> parent) :
|
||||
m_parent_ctx(parent)
|
||||
{
|
||||
auto base_dir = getenv_or_die("BEESHOME");
|
||||
BEESLOG("BEESHOME = " << base_dir);
|
||||
m_home_fd = open_or_die(base_dir, FLAGS_OPEN_DIR);
|
||||
if (m_parent_ctx) {
|
||||
m_hash_table = m_parent_ctx->hash_table();
|
||||
m_hash_table->set_shared(true);
|
||||
|
@ -719,7 +719,7 @@ public:
|
||||
void set_root_path(string path);
|
||||
|
||||
Fd root_fd() const { return m_root_fd; }
|
||||
Fd home_fd() const { return m_home_fd; }
|
||||
Fd home_fd();
|
||||
string root_path() const { return m_root_path; }
|
||||
string root_uuid() const { return m_root_uuid; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user