forked from mathbrook/KS5e-Data-Logging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketchy_setup.ps1
47 lines (37 loc) · 1.44 KB
/
sketchy_setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Define variables
$pythonVersion = "3.8.0"
$repoUrl = "https://github.com/KSU-MS/KS5e-Data-Logging.git"
$repoDirectoryName = "logging"
$repoDirectory = Join-Path $env:USERPROFILE "Documents\$repoDirectoryName"
$requirementsFile = "requirements.txt"
# Function to install Python
function InstallPython {
$pythonInstallerUrl = "https://www.python.org/ftp/python/$pythonVersion/python-$pythonVersion-amd64.exe"
$pythonInstaller = "$env:TEMP\python-installer.exe"
# Download Python installer
Invoke-WebRequest -Uri $pythonInstallerUrl -OutFile $pythonInstaller
# Install Python silently
Start-Process -Wait -FilePath $pythonInstaller -ArgumentList "/quiet", "InstallAllUsers=1", "PrependPath=1"
# Clean up
Remove-Item -Path $pythonInstaller -Force
}
# Function to clone the repository and install requirements
function CloneRepoAndInstallPackages {
# Clone repository
git clone $repoUrl $repoDirectory
# Navigate to repository directory
cd $repoDirectory
# Install Python packages
python -m pip install -r $requirementsFile
}
# Check if Python is installed
if (-not (Test-Path (Join-Path $env:ProgramFiles "Python" $pythonVersion))) {
InstallPython
}
# Check if Git is installed
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
Write-Host "Git is not installed. Please install Git and run the script again."
exit
}
# Clone repository and install packages
CloneRepoAndInstallPackages