-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install script improvements #1456
Install script improvements #1456
Conversation
Thanks for these updates. What platforms have you tested the new script on? |
Yeah high level this looks fantastic! Maybe we should finally commit to migrating this script over to the other repo too |
I'm working on a PR for that and the document update. |
scripts/install.sh
Outdated
echo "" | ||
echo "Photonvision uses NetworkManager to control networking on your device." | ||
|
||
if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the logic here will override --install-nm=yes
if the --quiet
flag is also passed. That's not the current behavior and could cause unexpected results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes you're right. Let me fix that.
Tried to address some of the issues in the most recent version. I also caught a few typos. I'll probably try to test them tonight. What would you need from me in order to get this merged? |
We'd wanna test it on all supported platforms is all. Maybe it makes more sense to move this all into photon image modifier now for testing and generating images? |
I copied an earlier version of the script over and the images build. I still need to test them on coprocessors. We could merge the PR here once we've tested for manual install. After that, I'll pull it over to photon-image-modifier and PR the changes to remove it from here. |
scripts/install.sh
Outdated
# Quiet makes the default "no" instead of "ask". | ||
if [[ -n "$QUIET" && "$INSTALL_NETWORK_MANAGER" == "ask" ]] ; then | ||
INSTALL_NETWORK_MANAGER="no" | ||
fi | ||
|
||
DISTRO=$(lsb_release -is) | ||
if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then | ||
echo "" | ||
echo "Photonvision uses NetworkManager to control networking on your device." | ||
|
||
# NetworkManager cannot be installed on non-Ubuntu distros | ||
# --no-networking takes precedence over --install-nm | ||
if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" ]] ; then | ||
INSTALL_NETWORK_MANAGER="no" | ||
fi | ||
|
||
if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then | ||
debug "" | ||
debug "Photonvision uses NetworkManager to control networking on your device." | ||
read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response | ||
if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then | ||
INSTALL_NETWORK_MANAGER="true" | ||
INSTALL_NETWORK_MANAGER="yes" | ||
fi | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't think this matches the original logic. The test for Ubuntu was intended to ask for permission if someone was installing it on Ubuntu to make sure that it wasn't messing up their network configuration. This logic will override --install-nm=yes
if the platform isn't Ubuntu, even though the user explicitly calls for it to be installed. I'll propose this alternative:
# Quiet makes the default "no" instead of "ask". | |
if [[ -n "$QUIET" && "$INSTALL_NETWORK_MANAGER" == "ask" ]] ; then | |
INSTALL_NETWORK_MANAGER="no" | |
fi | |
DISTRO=$(lsb_release -is) | |
if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then | |
echo "" | |
echo "Photonvision uses NetworkManager to control networking on your device." | |
# NetworkManager cannot be installed on non-Ubuntu distros | |
# --no-networking takes precedence over --install-nm | |
if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" ]] ; then | |
INSTALL_NETWORK_MANAGER="no" | |
fi | |
if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then | |
debug "" | |
debug "Photonvision uses NetworkManager to control networking on your device." | |
read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response | |
if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then | |
INSTALL_NETWORK_MANAGER="true" | |
INSTALL_NETWORK_MANAGER="yes" | |
fi | |
fi | |
DISTRO=$(lsb_release -is) | |
if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then | |
if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then | |
# Only ask if it makes sense to do so | |
INSTALL_NETWORK_MANAGER="no" | |
else | |
debug "" | |
debug "Photonvision uses NetworkManager to control networking on your device." | |
read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response | |
if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then | |
INSTALL_NETWORK_MANAGER="yes" | |
else | |
INSTALL_NETWORK_MANAGER="no" | |
fi | |
fi | |
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I can make these changes. I had the impression that NetworkManager was only available on Ubuntu which is why I had that logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a huge fan of large nested ifs. I think it's more readable just to have two seperate ones, but the behavior is equivalent. You can see the most recent commit for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. This looks right to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the updates. I think this is good to go. Please merge when you are able.
You can also? I think? Yolo Let's move this into photon image modifier and delete from this repo post merge |
Transfer the updates from PhotonVision/photonvision#1456 to this repo.
Various improvements to the installation script. Main feature is to allow specification of the version of PhotonVision to install. Various small backend improvements. Made to address Issue #1452 so that older versions of PhotonVision may be installed for older versions of WPILibPi, allowing users more flexibility.