Skip to content

Instantly share code, notes, and snippets.

@Garbee
Last active September 9, 2015 03:58
Show Gist options
  • Save Garbee/2bae80bdedf1b9a2ab1d to your computer and use it in GitHub Desktop.
Save Garbee/2bae80bdedf1b9a2ab1d to your computer and use it in GitHub Desktop.
Get chromium script
#!/bin/bash
# Change program folder to where you want it stored
PROGFOLDER=/home/jonathan/programs
cd /tmp
# getting 64 bit version since that is what I use. Check appspot to get the link for your system/bit length.
wget -q https://download-chromium.appspot.com/dl/Linux_x64 -O chromium.zip
rm -rf $PROGFOLDER/chrome-linux
unzip -q chromium.zip -d $PROGFOLDER
rm chromium.zip
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.3" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2015-06-17T21:23:23.0422017</Date>
<Author>Office-7\Jonathan</Author>
<Description>Update the Chromium open-source browser from appspot binaries.</Description>
</RegistrationInfo>
<Triggers>
<CalendarTrigger>
<Repetition>
<Interval>PT4H</Interval>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2015-06-17T04:00:00Z</StartBoundary>
<ExecutionTimeLimit>PT30M</ExecutionTimeLimit>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>1</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>Office-7\Jonathan</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>LeastPrivilege</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
<RestartOnFailure>
<Interval>PT5M</Interval>
<Count>3</Count>
</RestartOnFailure>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Users\Jonathan\scripts\update-chromium.ps1</Command>
</Exec>
<ShowMessage>
<Title>Chromium</Title>
<Body>An update is being attempted for Chromium.</Body>
</ShowMessage>
</Actions>
</Task>
# Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force
$userBin = "$env:USERPROFILE\bin"
$waitSeconds = 20
function InstallChromium($file, $destination)
{
$shell = New-Object -com shell.application
$zip = $shell.NameSpace($file)
$thing = New-Item -ItemType Directory -Force -Path $destination
$target = $shell.NameSpace($destination)
$item = $zip.items() | Select-Object -first 1
$name = $item.Name
$targetPath = "$destination\$name"
If((Test-Path $targetPath)) {
function DoCopy($targetPath, $target, $zip) {
$running = Get-Process | ?{$_.path -eq "$targetPath\chrome.exe"}
if(!$running) {
Remove-Item $targetPath -Recurse -Force
$target.CopyHere($zip.items(),0x14)
} Else {
Start-Sleep -s $waitSeconds
DoCopy $targetPath $target $zip
}
}
DoCopy $targetPath $target $zip
} Else {
$target.CopyHere($zip.items(), 0x14)
}
}
$tempfile = "$env:TEMP\chromium.zip";
Invoke-WebRequest 'https://download-chromium.appspot.com/dl/Win' -OutFile $tempfile
InstallChromium $tempfile $userBin
Remove-Item $tempfile
@S1L3NTone
Copy link

badass,ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment