Skip to content

Commit

Permalink
feat[close #169]: pre-run vso shell at boot if already initialized
Browse files Browse the repository at this point in the history
fix: wrong path

feat: add custom script to check for connectivity

feat: improve network connectivity check
  • Loading branch information
mirkobrombin authored and taukakao committed Jul 21, 2024
1 parent c41c9cf commit bcf3d72
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
21 changes: 21 additions & 0 deletions includes.container/usr/bin/wait-for-connection
Original file line number Diff line number Diff line change
@@ -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."
10 changes: 10 additions & 0 deletions includes.container/usr/lib/systemd/user/vso-pre-run.service
Original file line number Diff line number Diff line change
@@ -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
12 changes: 7 additions & 5 deletions modules/00-vanilla-system-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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

0 comments on commit bcf3d72

Please sign in to comment.