1

I'm trying to create a setup.sh script that includes the following

apt-get install openjdk-8-jdk

However, it prompts a yes/no during install but then also prompts to key in regions/countries/continents which have numeric responses. This will be consistent for my purposes, how can I pass in the prompt responses for this? -y works when everything is a yes or no question, but what about multiple prompts of mixed types? I'd like to respond 'y',105,2, etc.

EDIT: This is running in a hosted Jupyter Lab Cloud VM on Gradient by Paperspace. I'm running these commands from the terminal as root on 18.04, I have to install java 8 and some python packages. The VM comes preloaded with python3 but not java 8, and I want to create a setup script that doesn't need interaction from the user.

Jamalan
  • 111
  • 1
    apt-get install openjdk-8-jdk -y should work fine (although note that it isn't reccomended to use apt/apt-get in scripts). AFAIK, openjdk-*-* packages shouldn't have any dialogs that you have to choose. What exactly is it prompting you that you need to answer 105 for? Also, see this question – cocomac Dec 25 '21 at 02:54
  • What should I use instead to do installs for a setup.sh type file? And it prompts for region/country/timezone type things where it shows a list and you have to input the number corresponding to the thing. – Jamalan Dec 25 '21 at 03:00
  • Um... it shouldn't ask for those things when you install stuff. Can you see if it still happens in a live CD? Perhaps you didn't configure the region, but assuming a properly configured installation of a supported version of Ubuntu, apt-get install openjdk-8-jdk -y should just work. You shouldn't need to give the region. – cocomac Dec 25 '21 at 03:05
  • Its running on a cloud vm. Specifically in a cloud hosted jupyter notebook. Not sure how much control I have over it, and if I change it I'd need to change it programmatically and include it in a setup script. Also, can you expand on what I should use instead of apt-get install for a setup script? – Jamalan Dec 25 '21 at 03:25
  • The environment (VM and particularly Jupyter) are important! Those key facts need to be up in the Question, not buried in comments. – user535733 Dec 25 '21 at 04:29

0 Answers0