From 1226c966318dc8260d3bd40017c34f6ee6cfb314 Mon Sep 17 00:00:00 2001
From: Ayush Singh <ayushdevel1325@gmail.com>
Date: Fri, 1 Dec 2023 11:58:44 +0530
Subject: [PATCH] Add requirements.txt

- Allows simplifying local setup instructions without docker.
- Also use python venv (which is builtin with standard python3).
- Install as much stuff to python venv as possible to make things more
  cross-plaform.
- Fix some minor bash snippets which were not labled (and thus were
  being treated as cpp snippets)

Signed-off-by: Ayush Singh <ayushdevel1325@gmail.com>
---
 books/beaglebone-cookbook/11misc/misc.rst | 45 ++++++++++++++---------
 requirements.txt                          | 33 +++++++++++++++++
 2 files changed, 61 insertions(+), 17 deletions(-)
 create mode 100644 requirements.txt

diff --git a/books/beaglebone-cookbook/11misc/misc.rst b/books/beaglebone-cookbook/11misc/misc.rst
index db5c6c06..a0f1f931 100644
--- a/books/beaglebone-cookbook/11misc/misc.rst
+++ b/books/beaglebone-cookbook/11misc/misc.rst
@@ -219,51 +219,65 @@ You can always sudo from debian, but sometimes it's nice to login as root.
 Here's how to setup root so you can login from your host without a password.
 
 .. code-block:: bash
-    
-    host$ ssh bone
 
+    host$ ssh bone
     bone$ sudo -i
-    
     root@bone# nano /etc/ssh/sshd_config
 
 Search for the line
 
+.. code-block:: bash
+
     #PermitRootLogin prohibit-password
 
 and change it to
 
+.. code-block:: bash
+
     PermitRootLogin yes
 
 (The # symbol indicates a comment and must be removed in order for the setting to take effect.)
 
 Save the file and quit the editor. Restart ssh so it will reread the file.
 
+.. code-block:: bash
+
     root@bone# systemctl restart sshd
 
 And assign a password to root.
 
+.. code-block:: bash
+
     root@bone# passwd
 
 Now open another window on your host computer and enter:
 
+.. code-block:: bash
+
     host$ ssh-copy-id root@bone
 
 and enter the root password. Test it with:
 
+.. code-block:: bash
+
     host$ ssh root@bone
 
 You should be connected without a password. 
 Now go back to the Bone and turn off the root password access.
 
+.. code-block:: bash
+
     root@bone# nano /etc/ssh/sshd_config
 
 Restore the line:
 
+.. code-block:: bash
+
     #PermitRootLogin prohibit-password
 
 and restart sshd.
 
-.. code-block:: 
+.. code-block:: bash
 
     root@bone# systemctl restart sshd
     root@bone# exit
@@ -295,7 +309,7 @@ it display on the host.
 
 #.  First ssh to the Beagle using the `-X` flag.
 
-.. code-block:: 
+.. code-block:: bash
 
     host$ ssh -X debian@10.0.5.10
 
@@ -334,7 +348,7 @@ https://serverfault.com/questions/362529/how-can-i-sniff-the-traffic-of-remote-m
 First login to the Beagle and install tcpdump. Use your Beagle's 
 IP address.  
 
-.. code-block:: 
+.. code-block:: bash
 
     host$ ssh 192.168.7.2
     bone$ sudo apt update
@@ -343,7 +357,7 @@ IP address.
 
 Next, create a named pipe and have wireshark read from it.
 
-.. code-block:: 
+.. code-block:: bash
 
     host$ mkfifo /tmp/remote
     host$ wireshark -k -i /tmp/remote
@@ -351,7 +365,7 @@ Next, create a named pipe and have wireshark read from it.
 Then, run tcpdump over ssh on your remote machine and redirect the 
 packets to the named pipe:
 
-.. code-block:: 
+.. code-block:: bash
 
     host$ ssh root@192.168.7.2 "tcpdump -s 0 -U -n -w - -i any not port 22" > /tmp/remote
 
@@ -715,20 +729,17 @@ some 6G bytes.
     bone$ sudo apt upgrade
     bone$ sudo apt install -y \
         make git wget \
-        doxygen graphviz librsvg2-bin\
+        doxygen librsvg2-bin\
         texlive-latex-base texlive-latex-extra latexmk texlive-fonts-recommended \
         python3 python3-pip \
-        python3-sphinx python3-sphinx-rtd-theme python3-sphinxcontrib.svg2pdfconverter \
-        python3-pil \
         imagemagick-6.q16 librsvg2-bin webp \
         texlive-full texlive-latex-extra texlive-fonts-extra \
         fonts-freefont-otf fonts-dejavu fonts-dejavu-extra fonts-freefont-ttf
-    bone$ python3 -m pip install --upgrade pip
-    bone$ pip install -U sphinx_design 
-    bone$ pip install -U sphinxcontrib-images
-    bone$ pip install -U sphinx-serve
-       
-These instructions came from `lorforlinux 
+    bone$ python3 -m venv .venv
+    bone$ source .venv/bin/activate
+    bone$ pip install -r requirements.txt
+
+These instructions came from `lorforlinux
 <https://beagleboard.slack.com/archives/C8S7EKZC2/p1684940872699269>`_
 on the Beagleboard Slack channel.
 
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..767efb55
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,33 @@
+alabaster==0.7.13
+Babel==2.13.1
+breathe==4.35.0
+certifi==2023.11.17
+charset-normalizer==3.3.2
+docutils==0.18.1
+graphviz==0.20.1
+idna==3.6
+imagesize==1.4.1
+Jinja2==3.1.2
+MarkupSafe==2.1.3
+packaging==23.2
+Pillow==10.1.0
+Pygments==2.17.2
+requests==2.31.0
+setuptools==69.0.2
+snowballstemmer==2.2.0
+Sphinx==7.2.6
+sphinx-copybutton==0.5.2
+sphinx-rtd-theme==2.0.0
+sphinx-serve==1.0.1
+sphinx-tabs==3.4.4
+sphinx_design==0.5.0
+sphinxcontrib-applehelp==1.0.7
+sphinxcontrib-devhelp==1.0.5
+sphinxcontrib-htmlhelp==2.0.4
+sphinxcontrib-images==0.9.4
+sphinxcontrib-jquery==4.1
+sphinxcontrib-jsmath==1.0.1
+sphinxcontrib-qthelp==1.0.6
+sphinxcontrib-serializinghtml==1.1.9
+sphinxcontrib-svg2pdfconverter==1.2.2
+urllib3==2.1.0
-- 
GitLab