diff --git a/includes.container/usr/bin/wait-for-connection b/includes.container/usr/bin/wait-for-connection new file mode 100644 index 0000000..e3e10d1 --- /dev/null +++ b/includes.container/usr/bin/wait-for-connection @@ -0,0 +1,21 @@ +#!/bin/bash + +is_network_online() { + nmcli -t g | grep -q "connected" + return $? +} + +retry_count=0 +max_retries=30 + +until is_network_online; do + if [ $retry_count -ge $max_retries ]; then + echo "Network not available after 1 minute. Exiting." + exit 1 + fi + echo "Waiting for network..." + sleep 2 + ((retry_count++)) +done + +echo "Network is online." diff --git a/includes.container/usr/lib/systemd/user/vso-pre-run.service b/includes.container/usr/lib/systemd/user/vso-pre-run.service new file mode 100644 index 0000000..55b95ef --- /dev/null +++ b/includes.container/usr/lib/systemd/user/vso-pre-run.service @@ -0,0 +1,10 @@ +[Unit] +Description=VSO Shell Pre-Run + +[Service] +ExecStartPre=/usr/bin/wait-for-connection +ExecStart=/usr/bin/vso run -n -- ls || true +Restart=always + +[Install] +WantedBy=default.target diff --git a/modules/00-vanilla-system-operator.yml b/modules/00-vanilla-system-operator.yml index dbf3d8c..19be233 100644 --- a/modules/00-vanilla-system-operator.yml +++ b/modules/00-vanilla-system-operator.yml @@ -26,6 +26,10 @@ modules: type: shell commands: - chmod +x /usr/bin/reset-vso +- name: wait-for-connection + type: shell + commands: + - chmod +x /usr/bin/wait-for-connection - name: vso-gnome-ext type: shell source: @@ -40,11 +44,6 @@ modules: packages: - dpkg-dev - ifstat -- name: vso-tasks-rotation-autostart - type: shell - commands: - - mkdir /usr/lib/systemd/user/default.target.wants - - ln -s /usr/lib/systemd/user/vso-tasks-rotation.service /usr/lib/systemd/user/default.target.wants/vso-tasks-rotation.service - name: adwdialog type: dpkg-buildpackage source: @@ -74,3 +73,6 @@ modules: commands: - ln -s /usr/lib/systemd/system/vanilla-updates.service /etc/systemd/system/multi-user.target.wants/vanilla-updates.service - ln -s /usr/lib/systemd/system/vanilla-updates.timer /etc/systemd/system/timers.target.wants/vanilla-updates.timer + - mkdir -p /usr/lib/systemd/user/default.target.wants + - ln -s /usr/lib/systemd/user/vso-pre-run.service /usr/lib/systemd/user/default.target.wants/vso-pre-run.service + - ln -s /usr/lib/systemd/user/vso-tasks-rotation.service /usr/lib/systemd/user/default.target.wants/vso-tasks-rotation.service