Persistencia setters, compat-resolved, journald→CAS, compat-polkit
- hostnamed: SetHostname llama sethostname(2) + cache. SetStaticHostname
escribe atómico a /etc/hostname (tmp + fsync + rename, perms 0644).
Set{Pretty,Icon,Chassis,Deployment,Location} mergean k=v en
/etc/machine-info preservando otras keys. Validación: hostname RFC 1123
+ chassis enum.
- timedated: SetTimezone valida que /usr/share/zoneinfo/<tz> exista,
hace symlink atómico a /etc/localtime.
- localed: SetLocale valida formato KEY=value, escribe a /etc/locale.conf.
- compat-resolved (nuevo): org.freedesktop.resolve1.Manager con
ResolveHostname (vía tokio::lookup_host) y ResolveAddress (getnameinfo).
ResolveRecord devuelve NotSupported.
- journald-compat: persiste cada datagram al CAS por SHA. Append a
~/.local/share/ente/journal/index.log con
timestamp_ms:source:unit:sha_hex. Mutex serializa escrituras.
- compat-polkit (nuevo): org.freedesktop.PolicyKit1.Authority always-yes.
CheckAuthorization/CheckAuthorizationByAsync responden true,false,{}.
EnumerateActions vacío. Loguea action_id + pid/uid del subject.
7 compat-shims operativos en paralelo.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,7 +105,21 @@ impl TimedateManager {
|
||||
}
|
||||
|
||||
async fn set_timezone(&self, timezone: String, _interactive: bool) -> fdo::Result<()> {
|
||||
info!(%timezone, "SetTimezone (stub: no actualizamos /etc/localtime)");
|
||||
// Validar contra zoneinfo: el archivo destino debe existir.
|
||||
let zoneinfo = format!("/usr/share/zoneinfo/{timezone}");
|
||||
if !std::path::Path::new(&zoneinfo).exists() {
|
||||
return Err(fdo::Error::InvalidArgs(format!("timezone desconocida: {timezone}")));
|
||||
}
|
||||
// Atomic relink: crear localtime.tmp como symlink, rename.
|
||||
let tmp = "/etc/localtime.tmp";
|
||||
let _ = std::fs::remove_file(tmp);
|
||||
if let Err(e) = std::os::unix::fs::symlink(&zoneinfo, tmp) {
|
||||
return Err(fdo::Error::Failed(format!("symlink: {e}")));
|
||||
}
|
||||
if let Err(e) = std::fs::rename(tmp, "/etc/localtime") {
|
||||
return Err(fdo::Error::Failed(format!("rename: {e}")));
|
||||
}
|
||||
info!(%timezone, "SetTimezone → /etc/localtime");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user