Repository: Team766/apriltags_cuda
Pull request #71: Updating install_deps.sh to include NTP & setup static IPs
Author: login: clifflocked
Created: 2025-02-25T03:05:53Z | Merged: 2025-03-08T05:10:44Z

Makes `install_deps.sh` interactive

Adds `ntp` as an installed package

Sets up static IP using netplan

Sets up NTP 


Diff:
diff --git a/install_deps.sh b/install_deps.sh
index 4f1b95d..e0f2983 100755
--- a/install_deps.sh
+++ b/install_deps.sh
@@ -52,9 +52,15 @@ case $arch in
         install_cuda_x86
         ;;
     aarch64)
-        echo "Installing cuda on jetson"
-        install_cuda_jetson
-        ;;
+        case $(cat /proc/cpuinfo) in
+	    *0xd42*)
+                echo "Installing cuda on jetson"
+                install_cuda_jetson
+                ;;    
+	    *)
+                echo "Device is not detected to be Jetson Orin Nano; Not installing CUDA."
+	        ;;
+            esac
     *)
         echo "Unknown architecture: $arch"
         # Handle unknown architecture here
diff --git a/ntp.sh b/ntp.sh
new file mode 100644
index 0000000..5e878f9
--- /dev/null
+++ b/ntp.sh
@@ -0,0 +1,39 @@
+# Install NTP
+sudo apt-get install ntp
+
+# Setup static IP for the device
+echo "Do you want to setup this device to have a static IP? (y/N)"
+read setupIP
+case $setupIP in
+    yes|Y|y)
+        echo "Please enter the IP that this device will be assigned in form of *.*.*.*/*:"
+        read IP
+        sudo /bin/bash -c 'echo "network:
+  version: 2
+  renderer: NetworkManager
+  ethernets:
+    br0:
+      addresses:
+        - $IP" > /etc/netplan/staticip.yaml' # you have to have this all in a quotation mark so the '>' runs with root access
+        sudo netplan apply
+	;;
+    *)
+        echo "Not setting up device with a static IP."
+	;;
+esac
+
+# Set up NTP on device
+echo "Do you want to set up NTP to point to a server? (y/N)"
+read NTP
+case $NTP in
+    yes|Y|y)
+        echo "IP of server you want to sync with (in form *.*.*.*): "
+	read IP
+	rm /etc/ntp.conf
+ 	echo "tos maxclock 8
+	pool $IP iburst" > /etc/ntp.conf
+ 	;;
+    *)
+    	echo "Not setting up NTP to point to a server"
+ 	;;
+esac


Reviews:
user: login: cwosw
body: This looks good. Lets ensure that we can get this tested.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-01T05:23:59Z
user: login: cwosw
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-01T05:25:35Z
user: login: jamesi8086
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T10:40:19Z
user: login: jamesi8086
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T10:44:38Z
user: login: jamesi8086
body: small fixes needed, lets get this merged today
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T10:44:53Z
user: login: cwosw
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T14:25:56Z
user: login: cwosw
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T14:26:51Z
user: login: jamesi8086
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-03T23:25:40Z
user: login: cwosw
body: I forgot this.
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-08T05:09:44Z

Review comments:
diff_hunk: @@ -45,6 +43,35 @@ if dpkg -l | grep -q cuda-toolkit-11-8; then
 	exit 0
 fi
 
+# Setup static IP for the device
+echo "Please enter the IP that this device will be assigned in form of *.*.*.*/*:"
+read IP
+echo "network:
+  version: 2
+  renderer: NetworkManager
+  ethernets:
+    enp3s0:
+      addresses:
+        - $IP" > /etc/netplan/staticip.yaml
+netplan apply
+
+# Set up NTP on device
+echo "Do you want to set up NTP to point to a server? (y/N)"
+read NTP
path: install_deps.sh
user: login: cwosw
body: I do not know if this works like this. However there are other segments of code that you can find that will run this whole thing in one line. 
created_at: 2025-02-26T16:25:52Z
author_association: COLLABORATOR
diff_hunk: @@ -45,6 +43,35 @@ if dpkg -l | grep -q cuda-toolkit-11-8; then
 	exit 0
 fi
 
+# Setup static IP for the device
+echo "Please enter the IP that this device will be assigned in form of *.*.*.*/*:"
path: install_deps.sh
user: login: cwosw
body: Is there an option to make this an option and not required? (this is not required).
created_at: 2025-02-26T16:26:34Z
author_association: COLLABORATOR
diff_hunk: @@ -45,6 +43,35 @@ if dpkg -l | grep -q cuda-toolkit-11-8; then
 	exit 0
 fi
 
+# Setup static IP for the device
+echo "Please enter the IP that this device will be assigned in form of *.*.*.*/*:"
+read IP
+echo "network:
+  version: 2
+  renderer: NetworkManager
+  ethernets:
+    enp3s0:
+      addresses:
+        - $IP" > /etc/netplan/staticip.yaml
+netplan apply
+
+# Set up NTP on device
+echo "Do you want to set up NTP to point to a server? (y/N)"
+read NTP
+case $NTP in
+    yesY)
path: install_deps.sh
user: login: cwosw
body: that will match the string "yesY" which is not intended. it should be replaced with "yes|Y|y)" for the sake of clarity.
created_at: 2025-02-26T16:27:42Z
author_association: COLLABORATOR
diff_hunk: @@ -2,6 +2,8 @@ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
 
 RUN apt-get update && apt-get install -y sudo git vim lsb-release software-properties-common
 
+RUN timedatectl set-timezone "America/Los_Angeles"
+
 COPY install_deps.sh /install_deps.sh
 RUN chmod +x /install_deps.sh
path: Dockerfile
user: login: cwosw
body: no wonder the build had issues, you are just running it!
created_at: 2025-03-01T05:22:32Z
author_association: COLLABORATOR
diff_hunk: @@ -52,9 +52,15 @@ case $arch in
         install_cuda_x86
         ;;
     aarch64)
-        echo "Installing cuda on jetson"
-        install_cuda_jetson
-        ;;
+        case $(cat /proc/cpuinfo) in
+	    *0xd42*)
+                echo "Installing cuda on jetson"
+                install_cuda_jetson
+                ;;    
+	    *)
path: install_deps.sh
user: login: cwosw
body: do we want more verbosity?
created_at: 2025-03-01T05:23:03Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,36 @@
+# Setup static IP for the device
+echo "Do you want to setup this device to have a static IP? (y/N)"
+read setupIP
+case $setupIP in
+    yes|Y|y)
path: ntp.sh
user: login: cwosw
body: themks
created_at: 2025-03-01T05:23:17Z
author_association: COLLABORATOR
diff_hunk: @@ -2,6 +2,8 @@ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
 
 RUN apt-get update && apt-get install -y sudo git vim lsb-release software-properties-common
 
+RUN timedatectl set-timezone "America/Los_Angeles"
+
 COPY install_deps.sh /install_deps.sh
 RUN chmod +x /install_deps.sh
path: Dockerfile
user: login: cwosw
body: Turns out this does not work.
created_at: 2025-03-01T05:25:34Z
author_association: COLLABORATOR
diff_hunk: @@ -2,6 +2,8 @@ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
 
 RUN apt-get update && apt-get install -y sudo git vim lsb-release software-properties-common
 
+RUN timedatectl set-timezone "America/Los_Angeles"
path: Dockerfile
user: login: jamesi8086
body: this should be moved into install_deps or service script
created_at: 2025-03-03T10:40:19Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,36 @@
+# Setup static IP for the device
path: ntp.sh
user: login: jamesi8086
body: where is this file called from? should be added to setup script
created_at: 2025-03-03T10:44:38Z
author_association: COLLABORATOR
diff_hunk: @@ -2,6 +2,8 @@ FROM nvidia/cuda:11.8.0-devel-ubuntu22.04
 
 RUN apt-get update && apt-get install -y sudo git vim lsb-release software-properties-common
 
+RUN timedatectl set-timezone "America/Los_Angeles"
path: Dockerfile
user: login: cwosw
body: this is in the dockerfile because the build for some reason stops and dies trying to ask the user to input their timezone. this was supposed to fix that problem in the tests.
created_at: 2025-03-03T14:25:56Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,36 @@
+# Setup static IP for the device
path: ntp.sh
user: login: cwosw
body: the goal was to have NTP setup separate from the main setup script.
created_at: 2025-03-03T14:26:51Z
author_association: COLLABORATOR
diff_hunk: @@ -0,0 +1,36 @@
+# Setup static IP for the device
path: ntp.sh
user: login: jamesi8086
body: ok, we didn't really have to, but fine if it isn't
created_at: 2025-03-03T23:25:40Z
author_association: COLLABORATOR

PR comments:
user: login: cwosw
created_at: 2025-02-26T16:24:06Z
body: The build failed, which is odd. I looked at it and it appears to be a simple abort. The build seemed to fail in the configuration of the environment. This code also does not modify any segment responsible for ws_server, so there is no test that will work on it anyway.
author_association: COLLABORATOR
user: login: clifflocked
created_at: 2025-03-01T03:27:25Z
body: Builds are failing because I removed the `DEBIAN_FRONTEND=noninteractive`, which is causing builds to fail because Docker gets stuck on changing tzdata. I will move the setup for NTP & static IPs to another file, so that Docker won't get stuck.
author_association: CONTRIBUTOR
user: login: cwosw
created_at: 2025-03-08T05:09:32Z
body: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
I forgot to approve this and I am really tired. Get approved.
author_association: COLLABORATOR