summaryrefslogtreecommitdiff
path: root/static/thesiah-win.ps1
blob: b7f8bee09d5be45efb57f1d7e71b9a80016c49f7 (plain)
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
48
49
50
51
52
53
54
55
# Remote path to the CSV file
$csvUrl = "https://raw.githubusercontent.com/TheSiahxyz/THESIAH/main/static/winprogs.csv"
# Local temporary path for the CSV
$csvLocalPath = "C:\Temp\winprogs.csv"

# Ensure the temp directory exists
if (-Not (Test-Path "C:\Temp")) {
    New-Item -ItemType Directory -Path "C:\Temp"
}

# Download the CSV file
Invoke-WebRequest -Uri $csvUrl -OutFile $csvLocalPath

# Import the CSV and loop through each entry
$softwareList = Import-Csv -Path $csvLocalPath -Header "Type", "URL", "Description"
foreach ($software in $softwareList) {
    if ($software.Type -eq "R") {
        # Handle GitHub release (simple version: assume the latest release's .exe can be directly accessed via a predictable URL)
        $latestReleaseUrl = "$($software.URL)/releases/latest/download/"
        # Attempt to download from a constructed URL, assuming the repo uses this pattern
        $url = Invoke-WebRequest -Uri $latestReleaseUrl -UseBasicParsing | Select-Object -ExpandProperty Links | Where-Object { $_.href -like "*.exe" } | Select-Object -First 1 -ExpandProperty href
    } else {
        # Direct download link handling
        $url = $software.URL
    }

    $localPath = "C:\Temp\App_Setup.exe"

    # Download the installer if a URL was found
    if ($url -ne $null) {
        Invoke-WebRequest -Uri $url -OutFile $localPath

        # Install the application silently
        Start-Process -FilePath $localPath -Args "/S" -NoNewWindow -Wait

        # Remove the installer after installation
        Remove-Item -Path $localPath -Force

        # Output which software has been installed
        Write-Output "$($software.Description.trim()) has been installed successfully."
    } else {
        Write-Output "Failed to find download for $($software.Description.trim())."
    }
}

# Remove the CSV file after all installations
Remove-Item -Path $csvLocalPath -Force

# Arch WSL
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
TAG=$(curl --silent "https://api.github.com/repos/yuk7/ArchWSL/releases/latest"|grep '"tag_name"'|sed -E 's/.*"([^"]+)".*/\1/'|sed 's/v//')
wget https://github.com/yuk7/ArchWSL/releases/download/$TAG/Arch.zip
unzip Arch.zip
cd Arch
./Arch.exe