Skip to content

Commit 157cfe3

Browse files
authored
Add option to install script to install latest code (#664)
* Move optional steps for testing VMs out of README.md file This may help avoid new users being confused that they must follow those instructions. Signed-off-by: Andy Fingerhut <[email protected]> * Add option to new install.sh script to install latest version of source code Signed-off-by: Andy Fingerhut <[email protected]> --------- Signed-off-by: Andy Fingerhut <[email protected]>
1 parent 429c782 commit 157cfe3

File tree

3 files changed

+45
-11
lines changed

3 files changed

+45
-11
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,13 @@ for a list of virtual machine images that you can download, then use
108108
VirtualBox's File->Import Appliance menu item to add the virtual
109109
machine to those on your system.
110110

111+
There is one user account:
112+
+ Username: p4 | Password: p4
113+
111114
### To build a virtual machine with the P4 development tools.
112115

113116
See the instructions [here](vm-ubuntu-24.04/README.md).
114117

115-
### Accessing the VM
116-
117-
+ There are two user accounts:
118-
+ Username: p4 | Password: p4 (Usage of this account is expected)
119-
+ Username: vagrant | Password: vagrant (There is no need to use this account)
120-
121118
### To install P4 development tools on an existing system
122119

123120
There are instructions and scripts in another Github repository that can, starting from a freshly installed Ubuntu 20.04, 22.04, or 24.04 Linux system with enough RAM and free disk space, install all of the necessary P4 development tools to run the exercises in this repository. You can find those instructions and scripts [here](https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md) (note that you must clone a copy of that entire repository in order for its install scripts to work).

vm-ubuntu-24.04/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ Linux virtual machine on a cloud service like Amazon Web Services,
2323
Google Cloud, or Microsoft Azure. Or install Ubuntu Linux on a bare
2424
metal system. Details of these other methods are not documented here.
2525

26+
The `install.sh` script mentioned later will work on several supported
27+
versions of Ubuntu Linux, even if you do not install the Ubuntu GNOME
28+
desktop, but note that there are portions of the tutorials,
29+
e.g. `xterm` commands, and `wireshark`, that require a graphical
30+
desktop.
31+
2632
All of the detailed instructions below require first installing
2733
[VirtualBox](https://virtualbox.org) on your host system.
2834

vm-ubuntu-24.04/install.sh

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,44 @@ THIS_SCRIPT_FILE_MAYBE_RELATIVE="$0"
2222
THIS_SCRIPT_DIR_MAYBE_RELATIVE="${THIS_SCRIPT_FILE_MAYBE_RELATIVE%/*}"
2323
THIS_SCRIPT_DIR_ABSOLUTE=`readlink -f "${THIS_SCRIPT_DIR_MAYBE_RELATIVE}"`
2424

25+
print_usage() {
26+
1>&2 echo "usage: $0 [ latest | <date> ]"
27+
1>&2 echo ""
28+
1>&2 echo "Dates supported:"
29+
1>&2 echo " 2025-Jan-01"
30+
}
31+
32+
if [ $# -eq 0 ]
33+
then
34+
VERSION="2025-Jan-01"
35+
echo "No version specified. Defaulting to ${VERSION}"
36+
elif [ $# -eq 1 ]
37+
then
38+
VERSION="$1"
39+
else
40+
print_usage
41+
exit 1
42+
fi
43+
44+
case ${VERSION} in
45+
2025-Jan-01)
46+
# 2025-Jan-01 versions:
47+
export INSTALL_BEHAVIORAL_MODEL_SOURCE_VERSION="7ca39eda3529347e4ba66f1976351b0087294bf8"
48+
export INSTALL_PI_SOURCE_VERSION="2bb40f7ab800b91b26f3aed174bbbfc739a37ffa"
49+
export INSTALL_P4C_SOURCE_VERSION="1dc0afae2207f4bb9f5ab45f105ed569cc1ac89b"
50+
export INSTALL_PTF_SOURCE_VERSION="c554f83685186be4cfa9387eb5d6d700d2bbd7c0"
51+
;;
52+
latest)
53+
echo "Using the latest version of all p4lang repository source code."
54+
;;
55+
*)
56+
print_usage
57+
exit 1
58+
;;
59+
esac
60+
2561
${THIS_SCRIPT_DIR_ABSOLUTE}/user-bootstrap.sh
2662

27-
# 2025-Jan-01 versions:
28-
export INSTALL_BEHAVIORAL_MODEL_SOURCE_VERSION="7ca39eda3529347e4ba66f1976351b0087294bf8"
29-
export INSTALL_PI_SOURCE_VERSION="2bb40f7ab800b91b26f3aed174bbbfc739a37ffa"
30-
export INSTALL_P4C_SOURCE_VERSION="1dc0afae2207f4bb9f5ab45f105ed569cc1ac89b"
31-
export INSTALL_PTF_SOURCE_VERSION="c554f83685186be4cfa9387eb5d6d700d2bbd7c0"
3263

3364
${THIS_SCRIPT_DIR_ABSOLUTE}/install-p4dev-v8.sh
3465

0 commit comments

Comments
 (0)