dogi / ole--vagrant-community

0 stars 19 forks source link

scripts for downloading all the necessary software #16

Open dogi opened 8 years ago

dogi commented 8 years ago
dogi commented 8 years ago

Maybe first we have to brainstorm, which software each os needs ...

xinglunxu commented 8 years ago

Can we do something like this?

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    brew install git 
    brew cask install vagrant
    brew cask install virtualbox

Just put all the install commands into one script.

dogi commented 8 years ago

yes ;)

I kinda would also check if user is "root" and if not switch to "root"

xinglunxu commented 8 years ago

Why do we need to switch to "root"? If there is permission issue can't we just run the script with sudo?

Here is the script I came up with:

#!/bin/bash

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew tap caskroom/cask
brew cask install vagrant
brew cask install virtualbox
mhalqurashi commented 8 years ago

As for Windows, I think we need: 1- git 2- Virtual box 3- Vagrant

dogi commented 8 years ago

@mhalqurashi

+ssh +bonjour

mhalqurashi commented 8 years ago

@dogi Why do we need these? I ran my BeLL app without them.

mhalqurashi commented 8 years ago

@dogi Also, if we are using Powershell as a scripting language for Windows, we need to install it. This link could help.

4- Powershell

mhalqurashi commented 8 years ago

@dogi I have created a PowerShell script which downloads and installs Git for Windows 10 x64. It has not been tested on x86 architecture yet. It will most likely work on Windows 7, 8, and 8.1 since they all have PowerShell pre-installed. Here is the file.

mhalqurashi commented 8 years ago

Also, I think I can create a script for Vagrant and Virtual Box.

dogi commented 8 years ago

@mhalqurashi please copy paste the code into this ;)

mhalqurashi commented 8 years ago

$LocalTempDir = $env:TEMP; $GitInstaller = "GitInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('https://github.com/git-for-windows/git/releases/download/v2.9.0.windows.1/Git-2.9.0-64-bit.exe', "$LocalTempDir\$GitInstaller"); & "$LocalTempDir\$GitInstaller" /silent /install; $Process2Monitor = "GitInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$GitInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)

cw-lin commented 7 years ago

@dogi I wrote a batch script for windows to download git, virtualbox, and vagrant.

@echo off

MKDIR Installation
CD Installation
set powershellDir=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe

IF EXIST "%PROGRAMFILES(X86)%" GOTO 64BIT
ELSE GOTO 32BIT

:64BIT
%powershellDir% -Command "Invoke-WebRequest https://github.com/git-for-windows/git/releases/download/v2.9.2.windows.1/Git-2.9.2-64-bit.exe -OutFile Git-2.9.2-32-bit.exe"
goto track
GOTO END

:32BIT
%powershellDir% -Command "Invoke-WebRequest https://github.com/git-for-windows/git/releases/download/v2.9.2.windows.1/Git-2.9.2-32-bit.exe -OutFile Git-2.9.2-32-bit.exe"
goto track
GOTO END

:track
%powershellDir% -Command "Invoke-WebRequest https://releases.hashicorp.com/vagrant/1.8.5/vagrant_1.8.5.msi -OutFile vagrant_1.8.5.msi"
%powershellDir% -Command "Invoke-WebRequest http://download.virtualbox.org/virtualbox/5.0.10/VirtualBox-5.0.10-104061-Win.exe -OutFile VirtualBox-5.0.10-104061-Win.exe"
END

It works for my computer but it would be helpful if anyone can test this script. Do you want me add installation into this script? It seems like that belongs to issue #9

sthak004 commented 7 years ago

@cw-lin Both @dogi and I ran your script it worked! And yes, if you can add installation to this script, that would be great so that I can test it with my uninstall script.

sthak004 commented 7 years ago

@cw-lin Also, @dogi mentioned that it would be preferable (if possible) to have installation as a one liner as the website brew.sh does so.

cw-lin commented 7 years ago

@dogi @sthak004 Thanks for testing the script Here's the installation script

start \wait %cd%\vagrant_1.8.5.msi
start \wait %cd%\VirtualBox-5.0.10-104061-Win.exe
start \wait %cd%\Git-2.9.2-64-bit.exe
sthak004 commented 7 years ago

@cw-lin I ran into a problem when attempting to run your script.

I went and combined your installation script to your download script as such:

code

and it successfully downloaded the correct installers into a Installation folder however, when it came time to installation component of your script (outlined above), windows gave me this error regarding the wait\ command:

capture

Did it work on your machine? I can try and troubleshoot but I'd rather just ask first in case I'm doing something wrong. Thanks.

cw-lin commented 7 years ago

@sthak004 Sorry about the typo, \wait should be /wait

start /wait %cd%\vagrant_1.8.5.msi
start /wait %cd%\VirtualBox-5.0.10-104061-Win.exe
start /wait %cd%\Git-2.9.2-64-bit.exe

I typed the script out into comment instead of copy and paste from my code, that's probably why /wait becomes \wait

sthak004 commented 7 years ago

@cw-lin So I ran your script and it ran successfully! I was able to install everything using your script and uninstall everything with my script. Thanks!

I have some feedback:

  1. I think there should be a branch to install either the 32 bit version or the 64 bit version of Git because as of right now, the script only installs the 64 bit version.
  2. After the script finishes, see if you can delete the folder called Installation since we don't need the installers anymore.
  3. If you can find a way to install each program silently that would be great because I believe that's what @dogi mentioned in the hangout on Monday.

Here are the options for installing silently for each of the separate installers

Git Installer: git installer options

Virtual Box Installer: virtualbox installer options

Vagrant Installer: vagrant installer options

cw-lin commented 7 years ago

@sthak004 Haven't tested the silent installation yet but here's the more complete version of script I made together.

@echo off
MKDIR Installation
CD Installation
set powershellDir=%WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe
IF EXIST "%PROGRAMFILES(X86)%" GOTO GIT64BIT
ELSE GOTO GIT32BIT
:GIT64BIT
%powershellDir% -Command "Invoke-WebRequest https://github.com/git-for-windows/git/releases/download/v2.9.2.windows.1/Git-2.9.2-64-bit.exe -OutFile Git-2.9.2.exe"
%powershellDir% -Command "Start-Process -FilePath '%cd%\Git-2.9.2.exe' -ArgumentList '/silent', '/install', '/norestart' -Wait"
goto VBANDVAGRANT
GOTO END
:GIT32BIT
%powershellDir% -Command "Invoke-WebRequest https://github.com/git-for-windows/git/releases/download/v2.9.2.windows.1/Git-2.9.2-32-bit.exe -OutFile Git-2.9.2.exe"
%powershellDir% -Command "Start-Process -FilePath '%cd%\Git-2.9.2.exe' -ArgumentList '/silent', '/install', '/norestart' -Wait"
goto VBANDVAGRANT
GOTO END
:VBANDVAGRANT
%powershellDir% -Command "Invoke-WebRequest https://releases.hashicorp.com/vagrant/1.8.5/vagrant_1.8.5.msi -OutFile vagrant_1.8.5.msi"
%powershellDir% -Command "Invoke-WebRequest http://download.virtualbox.org/virtualbox/5.0.10/VirtualBox-5.0.10-104061-Win.exe -OutFile VirtualBox-5.0.10-104061-Win.exe"
msiexec /package vagrant_1.8.5.msi /quiet /norestart
%powershellDir% -Command "Start-Process -FilePath '%cd%\VirtualBox-5.0.10-104061-Win.exe' -ArgumentList '/silent', '/install', '/norestart' -Wait"
goto cleanup
GOTO END
:cleanup
del Git-2.9.2.exe vagrant_1.8.5.msi VirtualBox-5.0.10-104061-Win.exe
cd ..
RMDIR Installation
exit