Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
550e52cf1e | ||
|
|
0077844000 | ||
|
|
c086ad5552 | ||
|
|
0c298432f2 | ||
|
|
981fea7af8 | ||
|
|
edd7717a08 | ||
|
|
5fc505d789 | ||
|
|
fa59eed572 | ||
|
|
d9e3ca1f50 | ||
|
|
51c1c71475 | ||
|
|
0e8df6cf77 | ||
|
|
b23ded7286 | ||
|
|
f238391707 | ||
|
|
64e8e294c4 | ||
|
|
dd4ba9f34a | ||
|
|
5513cabf3e | ||
|
|
cc541e78de | ||
|
|
2d31e5199f | ||
|
|
c5fa538b42 |
@@ -5,10 +5,8 @@ This is a re-implementation of the [15 seconds ADB Installer](https://forum.xda-
|
||||
|
||||
This installer requires an internet connection.
|
||||
|
||||
The main component is [the PowerShell script](https://github.com/josephsmendoza/ADB-Installer/blob/master/install.ps1) which downloads [the latest android platform tools for windows](https://dl.google.com/android/repository/platform-tools-latest-windows.zip) and installs them to either `C:\android-platform-tools`, an auto-detected previous install location, or a path you can specify via `-installPath`.
|
||||
|
||||
For conveinence, this is wrapped in an `.exe` file which runs the script with `ExecutionPolicy` set to `Bypass`. This file is fully automated.
|
||||
|
||||
Icon is from [Google via icon-icons.com](https://icon-icons.com/icon/adb/90476)
|
||||
|
||||
Built with [7z SFX Builder](https://sourceforge.net/projects/s-zipsfxbuilder)
|
||||
Windows version packaged with [Ptiso](https://pismotec.com/ptiso/)
|
||||
|
||||
Linux & Mac version packaged with [UPX](https://upx.github.io/)
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
Param( [Parameter(Position=0)] [String[]] $installPath )
|
||||
Set-PSDebug -Trace 2
|
||||
$ErrorActionPreference = 'Inquire'
|
||||
$localZip="$env:temp\platform-tools-latest-windows.zip"
|
||||
$remoteZip="https://dl.google.com/android/repository/platform-tools-latest-windows.zip"
|
||||
$shell = New-Object -ComObject Wscript.Shell
|
||||
$application= New-Object -ComObject shell.application
|
||||
$webClient = New-Object Net.WebClient
|
||||
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
|
||||
$fastboot=Get-Command "fastboot" -ErrorAction SilentlyContinue
|
||||
|
||||
if($installPath.Length.Equals(0)){
|
||||
if(!$adb -and $fastboot){
|
||||
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
|
||||
}
|
||||
if($adb){
|
||||
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
|
||||
Invoke-Command -ScriptBlock {
|
||||
$ErrorActionPreference = 'Ignore'
|
||||
adb kill-server
|
||||
}
|
||||
}
|
||||
if($installPath.Length.Equals(0)){
|
||||
$installPath="$env:APPDATA\SideQuest\platform-tools"
|
||||
}
|
||||
}
|
||||
|
||||
if ( (cmd /c sc query Windefend) -like "*RUNNING*" ){
|
||||
Add-MpPreference -ExclusionPath $installPath
|
||||
Add-MpPreference -ExclusionProcess "adb.exe"
|
||||
} else {
|
||||
$shell.Popup("Windows Defender is not running!
|
||||
If you have antivirus, exclude $installPath")
|
||||
}
|
||||
|
||||
if(!$adb -and !$fastboot){
|
||||
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
|
||||
$newpath = "$oldpath;$installPath"
|
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
|
||||
}
|
||||
|
||||
$webClient.DownloadFile($remoteZip,$localZip)
|
||||
foreach ( $item in $application.NameSpace($localZip).items() ) {
|
||||
$application.NameSpace("$env:temp").CopyHere($item,16)
|
||||
}
|
||||
if(-Not (Test-Path $installPath)){
|
||||
mkdir $installPath
|
||||
}
|
||||
Copy-Item -Path "$env:temp\platform-tools\*" -Destination "$installPath\" -Force
|
||||
|
||||
$PSScriptRootLegacy=split-path -parent $MyInvocation.MyCommand.Definition
|
||||
Start-Process $PSScriptRootLegacy/android_winusb.inf -Verb Install
|
||||
|
||||
$shell.Popup("Done!")
|
||||
@@ -0,0 +1,130 @@
|
||||
/+ dub.sdl:
|
||||
targetPath "bin/$PLATFORM/$ARCH"
|
||||
+/
|
||||
|
||||
import std.path;
|
||||
import std.stdio : writeln;
|
||||
import std.algorithm.searching : canFind;
|
||||
import std.process : environment;
|
||||
|
||||
bool sys,user,silent,verbose;
|
||||
string installDir;
|
||||
|
||||
int installTools(){
|
||||
import std.zip,std.conv,std.file,std.net.curl,std.conv : octal;
|
||||
|
||||
version(Windows) string url="https://dl.google.com/android/repository/platform-tools-latest-windows.zip";
|
||||
version(OSX) string url="https://dl.google.com/android/repository/platform-tools-latest-darwin.zip";
|
||||
version(linux) string url="https://dl.google.com/android/repository/platform-tools-latest-linux.zip";
|
||||
|
||||
ubyte[] data;
|
||||
auto http=HTTP(url);
|
||||
http.onReceive=(ubyte[] response){
|
||||
data~=response;
|
||||
return response.length;
|
||||
};
|
||||
http.perform();
|
||||
"Download complete".writeln();
|
||||
|
||||
auto zip=new ZipArchive(data);
|
||||
foreach (x;zip.directory){
|
||||
auto path=buildNormalizedPath(installDir,x.name[15 .. $]);
|
||||
if(x.compressedSize!=0){
|
||||
if(!path.dirName.exists) path.dirName.mkdirRecurse();
|
||||
if(path.exists) path.remove();
|
||||
zip.expand(x);
|
||||
write(path, x.expandedData);
|
||||
setAttributes(path,octal!775);
|
||||
} else {
|
||||
try if(path.isFile) {
|
||||
path.remove;
|
||||
path.mkdirRecurse;
|
||||
} catch (Exception e) path.mkdirRecurse;
|
||||
}
|
||||
}
|
||||
"Extraction complete".writeln();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int installPath(){
|
||||
string path=environment.get("PATH");
|
||||
if(path.canFind(installDir)){
|
||||
"Install folder is already in PATH".writeln;
|
||||
return 0;
|
||||
}
|
||||
|
||||
version(Windows){
|
||||
import std.windows.registry;
|
||||
Key env;
|
||||
if(user){
|
||||
env=Registry.currentUser.getKey("Environment",REGSAM.KEY_ALL_ACCESS);
|
||||
}
|
||||
if(sys){
|
||||
env=Registry.localMachine.getKey("SYSTEM").getKey("CurrentControlSet")
|
||||
.getKey("Control").getKey("Session Manager").getKey("Environment",REGSAM.KEY_ALL_ACCESS);
|
||||
}
|
||||
path=env.getValue("Path").value_SZ;
|
||||
path~=pathSeparator~installDir;
|
||||
env.setValue("Path",path);
|
||||
//import core.sys.windows.winuser; SendNotifyMessageW(HWND_BROADCAST,WM_SETTINGCHANGE,cast(ulong)null,cast(long)"Environment");
|
||||
} else {
|
||||
import std.file : append;
|
||||
if(user) append("~/.profile".expandTilde,"\nexport PATH=$PATH"~pathSeparator~installDir);
|
||||
if(sys) append("/etc/profile","\nexport PATH=$PATH"~pathSeparator~installDir);
|
||||
}
|
||||
|
||||
"Install folder was added to PATH".writeln();
|
||||
"logout/login or reboot to coplete install".writeln();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int install(){
|
||||
if(user) "Installing for current user".writeln();
|
||||
if(sys) "Installing for all users".writeln();
|
||||
("Installing to " ~ installDir).writeln();
|
||||
return installTools() + installPath();
|
||||
}
|
||||
|
||||
int main(string[] args){
|
||||
|
||||
import std.getopt : getopt,defaultGetoptPrinter;
|
||||
|
||||
auto xargs=getopt(args,
|
||||
"all-users|a","Install for all users.",&sys,
|
||||
"user|u","Install for current user.",&user,
|
||||
//"silent|s","Silent standard output.",&silent,
|
||||
//"verbose|v","Verbose standard output.",&verbose,
|
||||
"install-dir|i","Install to specified directory",&installDir
|
||||
);
|
||||
|
||||
if(installDir){
|
||||
installDir=installDir.buildNormalizedPath.absolutePath;
|
||||
if(!sys && !user){
|
||||
string allHome="~".expandTilde.dirName;
|
||||
if(!allHome.isRooted && installDir.canFind(allHome)) user=true;
|
||||
else sys=true;
|
||||
}
|
||||
return install();
|
||||
}
|
||||
|
||||
if(user || sys){
|
||||
auto append=buildNormalizedPath("Android","SDK","platform-tools");
|
||||
|
||||
if(user){
|
||||
version(Windows)installDir=buildNormalizedPath(environment.get("LocalAppData"),append);
|
||||
version(linux)installDir=buildNormalizedPath("~".expandTilde,append);
|
||||
version(OSX)installDir=buildNormalizedPath("~/Library".expandTilde,append);
|
||||
return install();
|
||||
}
|
||||
|
||||
if(sys){
|
||||
version(Windows)installDir=buildNormalizedPath(environment.get("ProgramFiles"),append);
|
||||
version(linux)installDir=buildNormalizedPath("/opt",append);
|
||||
version(OSX)installDir=buildNormalizedPath("/Library",append);
|
||||
return install();
|
||||
}
|
||||
}
|
||||
|
||||
defaultGetoptPrinter("Download platform-tools and add to PATH.",xargs.options);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
%~dp0\adbi.exe %*
|
||||
pause
|
||||
@@ -0,0 +1,2 @@
|
||||
dub build --single adbi.d
|
||||
ptiso create -z lzma -c crc32 -x stub ptse_cmd.stub -x runas admin -x mount_system_visible 0 -x process_visible 1 -x run_relative 1 -x use_stderr 1 -x run_exe adbi.cmd -x icon adb.ico ADB-Installer.exe bin/windows/x86_64
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
dub build --single adbi.d
|
||||
upx --best bin/linux/x86_64/adbi
|
||||
@@ -0,0 +1,30 @@
|
||||
/+ dub.sdl:
|
||||
dependency "tkd" version="1.1.13"
|
||||
targetPath "bin/$PLATFORM/$ARCH"
|
||||
copyFiles \
|
||||
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tcl86t.dll" \
|
||||
"$TCLTK_PACKAGE_DIR/dist/$ARCH/tk86t.dll" \
|
||||
"$TCLTK_PACKAGE_DIR/dist/library" \
|
||||
platform="windows"
|
||||
+/
|
||||
|
||||
import tkd.tkdapplication;
|
||||
|
||||
class GUI : TkdApplication
|
||||
{
|
||||
override protected void initInterface()
|
||||
{
|
||||
auto frame = new Frame().pack(5);
|
||||
new Label(frame, "Select an install location").pack(0);
|
||||
auto searchLabel=new Label(frame,"Searching for pre-existing files...").pack(0);
|
||||
new Button(frame, "System").pack(0);
|
||||
new Button(frame, "User").pack(0);
|
||||
new Button(frame, "Mixed").pack(0);
|
||||
}
|
||||
}
|
||||
|
||||
void main(string[] args)
|
||||
{
|
||||
auto gui = new GUI();
|
||||
gui.run();
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
Param( [Parameter(Position=0)] [String[]] $installPath )
|
||||
Set-PSDebug -Trace 2
|
||||
$ErrorActionPreference = 'Inquire'
|
||||
$localZip="$env:temp\platform-tools-latest-windows.zip"
|
||||
$remoteZip="https://dl.google.com/android/repository/platform-tools-latest-windows.zip"
|
||||
$shell = New-Object -ComObject Wscript.Shell
|
||||
$application= New-Object -ComObject shell.application
|
||||
$webClient = New-Object Net.WebClient
|
||||
$adb=Get-Command "adb" -ErrorAction SilentlyContinue
|
||||
$fastboot=Get-Command "fastboot" -ErrorAction SilentlyContinue
|
||||
|
||||
if($installPath.Length.Equals(0)){
|
||||
if(!$adb -and $fastboot){
|
||||
$installPath=fastboot --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
|
||||
}
|
||||
if($adb){
|
||||
$installPath=adb --version | Select-String -Pattern "(?<=installed as )(.+)(?=\\.*\.exe)" | % { $_.Matches } | % { $_.Value }
|
||||
Invoke-Command -ScriptBlock {
|
||||
$ErrorActionPreference = 'Ignore'
|
||||
adb kill-server
|
||||
}
|
||||
}
|
||||
if($installPath.Length.Equals(0)){
|
||||
$installPath="C:\android-platform-tools"
|
||||
}
|
||||
}
|
||||
|
||||
if ( (cmd /c sc query Windefend) -like "*RUNNING*" ){
|
||||
Add-MpPreference -ExclusionPath $installPath
|
||||
Add-MpPreference -ExclusionProcess "adb.exe"
|
||||
} else {
|
||||
$shell.Popup("Windows Defender is not running!
|
||||
If you have antivirus, exclude $installPath")
|
||||
}
|
||||
|
||||
if(!$adb -and !$fastboot){
|
||||
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path
|
||||
$newpath = "$oldpath;$installPath"
|
||||
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value $newPath
|
||||
}
|
||||
|
||||
$webClient.DownloadFile($remoteZip,$localZip)
|
||||
foreach ( $item in $application.NameSpace($localZip).items() ) {
|
||||
$application.NameSpace("$env:temp").CopyHere($item,16)
|
||||
}
|
||||
if(-Not (Test-Path $installPath)){
|
||||
mkdir $installPath
|
||||
}
|
||||
Copy-Item -Path "$env:temp\platform-tools\*" -Destination "$installPath\" -Force
|
||||
|
||||
$shell.Popup("Done!")
|
||||
@@ -1,8 +0,0 @@
|
||||
;!@Install@!UTF-8!
|
||||
RunProgram="powershell -executionpolicy bypass -file %%T\install.ps1"
|
||||
;Config file generated by 7z SFX Builder v2.1. (http://sourceforge.net/projects/s-zipsfxbuilder/)
|
||||
;!@InstallEnd@!
|
||||
7zSFXBuilder_7zArchive=C:\Users\Josef\Documents\ADB-Installer\install.7z
|
||||
7zSFXBuilder_SFXIcon=C:\Users\Josef\Documents\ADB-Installer\adb.ico
|
||||
7zSFXBuilder_UseDefMod=7zsd_All_x64
|
||||
7zSFXBuilder_UPXCommands=--best --all-methods
|
||||
Reference in New Issue
Block a user