mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
wait for time sync before starting tor (#2209)
* wait for time sync before starting tor * don't initialize /var/lib/docker
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
Description=Embassy Init
|
Description=Embassy Init
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
Requires=network-online.target
|
Requires=network-online.target
|
||||||
Wants=avahi-daemon.service tor.service
|
Wants=avahi-daemon.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
|||||||
@@ -319,16 +319,8 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
}
|
}
|
||||||
let tmp_docker = cfg.datadir().join("package-data/tmp/docker");
|
let tmp_docker = cfg.datadir().join("package-data/tmp/docker");
|
||||||
let tmp_docker_exists = tokio::fs::metadata(&tmp_docker).await.is_ok();
|
let tmp_docker_exists = tokio::fs::metadata(&tmp_docker).await.is_ok();
|
||||||
if should_rebuild || !tmp_docker_exists {
|
if should_rebuild && tmp_docker_exists {
|
||||||
if tmp_docker_exists {
|
tokio::fs::remove_dir_all(&tmp_docker).await?;
|
||||||
tokio::fs::remove_dir_all(&tmp_docker).await?;
|
|
||||||
}
|
|
||||||
Command::new("cp")
|
|
||||||
.arg("-ra")
|
|
||||||
.arg("/var/lib/docker")
|
|
||||||
.arg(&tmp_docker)
|
|
||||||
.invoke(crate::ErrorKind::Filesystem)
|
|
||||||
.await?;
|
|
||||||
}
|
}
|
||||||
Command::new("systemctl")
|
Command::new("systemctl")
|
||||||
.arg("stop")
|
.arg("stop")
|
||||||
@@ -392,6 +384,26 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
.await?;
|
.await?;
|
||||||
tracing::info!("Enabled Docker QEMU Emulation");
|
tracing::info!("Enabled Docker QEMU Emulation");
|
||||||
|
|
||||||
|
let mut warn_time_not_synced = true;
|
||||||
|
for _ in 0..60 {
|
||||||
|
if check_time_is_synchronized().await? {
|
||||||
|
warn_time_not_synced = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||||
|
}
|
||||||
|
if warn_time_not_synced {
|
||||||
|
tracing::warn!("Timed out waiting for system time to synchronize");
|
||||||
|
} else {
|
||||||
|
tracing::info!("Syncronized system clock");
|
||||||
|
}
|
||||||
|
|
||||||
|
Command::new("systemctl")
|
||||||
|
.arg("start")
|
||||||
|
.arg("tor")
|
||||||
|
.invoke(crate::ErrorKind::Tor)
|
||||||
|
.await?;
|
||||||
|
|
||||||
receipts
|
receipts
|
||||||
.ip_info
|
.ip_info
|
||||||
.set(&mut handle, crate::net::dhcp::init_ips().await?)
|
.set(&mut handle, crate::net::dhcp::init_ips().await?)
|
||||||
@@ -407,6 +419,7 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<InitResult, Error> {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
receipts
|
receipts
|
||||||
.system_start_time
|
.system_start_time
|
||||||
.set(&mut handle, time().await?)
|
.set(&mut handle, time().await?)
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ $SYSTEMCTL enable systemd-resolved.service
|
|||||||
$SYSTEMCTL enable systemd-networkd-wait-online.service
|
$SYSTEMCTL enable systemd-networkd-wait-online.service
|
||||||
$SYSTEMCTL disable wpa_supplicant.service
|
$SYSTEMCTL disable wpa_supplicant.service
|
||||||
|
|
||||||
|
$SYSTEMCTL disable docker.service
|
||||||
$SYSTEMCTL disable postgresql.service
|
$SYSTEMCTL disable postgresql.service
|
||||||
|
$SYSTEMCTL disable tor.service
|
||||||
$SYSTEMCTL disable bluetooth.service
|
$SYSTEMCTL disable bluetooth.service
|
||||||
$SYSTEMCTL disable hciuart.service
|
$SYSTEMCTL disable hciuart.service
|
||||||
$SYSTEMCTL disable triggerhappy.service
|
$SYSTEMCTL disable triggerhappy.service
|
||||||
|
|||||||
Reference in New Issue
Block a user