Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Bash Question
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Bash Question

Hello LET!

I am currently making a script that installs the Multicraft Control Panel with 1 simple command.

The problem that I am facing is that the Auto Installer asks a few questions during installation. How would I answer these questions in Bash?

Example:


***
*** Welcome to Multicraft!
***

This installer will help you get Multicraft up and running.
No changes are made to the system until all of the required information has been collected.

NOTE: This script automates the installation as described on the Multicraft website. Use it at your own risk.


Run each Minecraft server under its own user? (Multicraft will create system users): [y]/n n
Run Multicraft under this user: [minecraft] 
User not found. Create user 'minecraft' on start of installation? [y]/n y
Install Multicraft in: [/home/minecraft/multicraft] 
If you have a license key you can enter it now: [no] 
If you control multiple machines from one control panel you need to assign each daemon a unique ID (requires a Dynamic or custom license). Daemon ID? [1] 

How would I automate the installation of something like this?

I've attempted the Yes command but it doesn't work for this.

Comments

  • The installer doesn't support command line options or a configuration template?

  • I'm guessing the script you are using is this one? If so, just replace the ask functions with straight variables.

    eg

    ask "MC_MULTIUSER" "y" "Run each Minecraft server under its own user? (Multicraft will create system users): [\$def]/n" "Create system user for each Minecraft server: \$var"    
    ask "MC_USER" "$def" "Run Multicraft under this user: [\$def]" "Multicraft will run as \$var"    
    

    becomes

    MC_MULTIUSER="n"    
    MC_USER="minecraft"    
    

    etc etc

  • @SegmentationFault said:
    I'm guessing the script you are using is this one? If so, just replace the ask functions with straight variables.

    eg

    ask "MC_MULTIUSER" "y" "Run each Minecraft server under its own user? (Multicraft will create system users): [\$def]/n" "Create system user for each Minecraft server: \$var"    
    ask "MC_USER" "$def" "Run Multicraft under this user: [\$def]" "Multicraft will run as \$var"    
    

    becomes

    MC_MULTIUSER="n"    
    MC_USER="minecraft"    
    

    etc etc

    Actually it's just the default one.

    http://multicraft.org/site/docs?view=install

  • perennateperennate Member, Host Rep
    edited December 2013
    echo 'n
    
    y
    
    
    
    ' | ./setup.py

    Edit: I mean setup.sh. You could also just edit it probably, as @SegmentationFault suggested.

  • @perennate said:

    echo 'n
    > 
    > y
    > 
    > 
    > 
    > ' | ./setup.py

    The problem is that there is more than 1 argument.

  • perennateperennate Member, Host Rep

    mcmyhost said: The problem is that there is more than 1 argument.

    So, put each on one line?

  • @perennate said:
    So, put each on one line?

    Does that work?

  • perennateperennate Member, Host Rep
    edited December 2013

    mcmyhost said: Does that work?

    Why don't you try it and find out?? If not do what @SegmentationFault said, but with setup.sh

  • @perennate said:
    Why don't you try it and find out?? If not do what SegmentationFault said, but with setup.sh

    Good idea.

  • Looks like the github script I found is the original setup script modified for Debian. The variables/functions/etc are all the same though so like I said above - just replace the lines where it calls the ask function with static variables instead.

  • Dont use the installer?...

    Direct from their website:

    The script does the following:

    -Create the user for running the servers if the user you specified doesn't exist

    -Create the Multicraft base directory you specified and copy the folders "bin" and "jar" in there

    -Creating a file "multicraft.key" with your license (if any)

    -Copy the file "multicraft.conf.dist" into your Multicraft base directory as "multicraft.conf"

    -Change the "multicraft.conf" according to your answers during the script

    -Copy the directory "panel" to your web root

    -Set directory ownership for the Multicraft base directory and the front end files

    -Run the multicraft binary with "./bin/multicraft -v set_permissions" to fix up file permissions if required

Sign In or Register to comment.